Ejemplo n.º 1
0
 @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);
   }
 }
Ejemplo n.º 2
0
 @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);
   }
 }
Ejemplo n.º 3
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onDisconnect(PlayerQuitEvent event) {
   SessionManager.removeSession(event.getPlayer());
 }