public void onPlayerInteract(PlayerInteractEvent event) { Block b = event.getClickedBlock(); Player p = event.getPlayer(); Action a = event.getAction(); // Handle field building tool operations if (p.getItemInHand().getTypeId() == 276) { Builder fb = plugin.getBattlefieldManager().getBuilder(p); if (fb != null) { if (fb.getTool() != null) { Tool tool = fb.getTool(); switch (a) { case RIGHT_CLICK_BLOCK: tool.rightClick(b); break; case LEFT_CLICK_BLOCK: tool.leftClick(b); break; case RIGHT_CLICK_AIR: tool.rightClick(); break; case LEFT_CLICK_AIR: tool.leftClick(); break; default: break; } } } } TeamMember m = plugin.getBattlefieldManager().getPlayer(p); if (m != null) { Battlefield field = m.getTeam().getField(); // Handle sign clicks if (b != null) { if (b.getState() instanceof Sign) { Sign sign = (Sign) b.getState(); String line = sign.getLine(0); if (line.equals("[Options]")) { BattlefieldSign bs = field.getSign(b); if (bs != null) { if (field.isActive()) Format.sendMessage(m, "You cannot change settings during a game."); else if (a == Action.LEFT_CLICK_BLOCK) bs.executeOption(m); else if (a == Action.RIGHT_CLICK_BLOCK) bs.cycleOption(m); } } } } if (field.isActive()) field.getGametype().getListener().onClick(m, event.getClickedBlock(), event.getAction()); } }