Solved Cancel clicking on berry bushes

Discussion in 'Spigot Plugin Development' started by David_Mayr, Jul 23, 2019.

  1. How can i cancel this?

  2. Disable playerinteractevent when clicking on such blocks?
  3. @Shin1gamiX how can i check if the click on this block?
    I know how to do a playerinteractevent but not how to check what block they clicked on...
  4. @_Donut_ if(e.getClickedBlock().equals()) { but what should i put in the equals thing?
  5. Code (Java):

    public void onInteract(PlayerInteractEvent e) {
         if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
              if(e.getBlock().getType() == Material.SWEET_BERRY_BUSH) e.setCancelled(true);
    Don't forget! Your class with this method must be implementing `Listener` using:
    Code (Java):
    implements Listener
    Also don't forget: Register your Listener-Class in your main using:
    Code (Java):
    Bukkit.getPluginManager().registerEvents(new YourClass(), this);
  6. @Programmer i know that :D i forgott to mark the issue as solved
    • Like Like x 1
  7. hello guys where is I use this code?

    and can you share the complete code?
  8. First: Dont answer on really old posts
    Second: @Programmer literally posted everything you need wtf