@EventHandler(priority = EventPriority.HIGHEST)
 public void onPlayerInteract(PlayerInteractEvent event) {
   Player player = event.getPlayer();
   if (event.getAction() == Action.LEFT_CLICK_BLOCK
       && player.getItemInHand().equals(Config.ToolBlock)
       && SessionManager.getSession(player).isUsingTool()) {
     ToolManager.toolSearch(player, event.getClickedBlock());
     event.setCancelled(true);
   }
 }
 @SuppressWarnings("deprecation")
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onBlockPlace(BlockPlaceEvent event) {
   Player player = event.getPlayer();
   if (event.getItemInHand().equals(Config.ToolBlock)
       && SessionManager.getSession(player).isUsingTool()) {
     ToolManager.toolSearch(player, event.getBlock());
     if (player.getGameMode() == GameMode.SURVIVAL) player.updateInventory();
     event.setCancelled(true);
   }
 }
Exemple #3
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onDisconnect(PlayerQuitEvent event) {
   SessionManager.removeSession(event.getPlayer());
 }