Solved How to cancel something?

Discussion in 'Spigot Plugin Development' started by pumpkinpuzzles, Dec 8, 2018 at 10:08 PM.

Thread Status:
Not open for further replies.
  1. I've been trying to code something and I saw people use event.setCancelled(true);
    But that was a long time ago. I don't know what changed or something but event.setCancelled(); isn't a thing
    Code (Java):
        @EventHandler
        public void onBreak(PlayerItemBreakEvent event){
            Player player = event.getPlayer();
            player.sendMessage(ChatColor.RED + "You can't do that!");
        }
    That's what I had
    Then if I do:
    Code (Java):
        @EventHandler
        public void onBreak(PlayerItemBreakEvent event){
            Player player = event.getPlayer();
            event.setCancelled(true);
            player.sendMessage(ChatColor.RED + "You can't do that!");
        }
    It says setCancelled isn't a thing

    EDIT: I realized I did something wrong with PlayerItemBreakEvent
     
Thread Status:
Not open for further replies.

Share This Page