use of net.dzikoysk.funnyguilds.command.ExcInfo in project FunnyGuilds by FunnyGuilds.
the class PlayerInteract method onInteract.
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Action eventAction = event.getAction();
Player p = event.getPlayer();
if (eventAction == Action.RIGHT_CLICK_BLOCK || eventAction == Action.LEFT_CLICK_BLOCK) {
Block clicked = event.getClickedBlock();
if (RegionUtils.isIn(clicked.getLocation())) {
Region region = RegionUtils.getAt(clicked.getLocation());
Block heart = region.getCenter().getBlock().getRelative(BlockFace.DOWN);
if (clicked.equals(heart)) {
Guild g = region.getGuild();
if (SecuritySystem.getSecurity().checkPlayer(p, g)) {
return;
}
if (eventAction == Action.LEFT_CLICK_BLOCK) {
WarSystem.getInstance().attack(p, g);
event.setCancelled(true);
return;
} else if (eventAction == Action.RIGHT_CLICK_BLOCK) {
PluginConfig config = Settings.getConfig();
if (config.informationMessageCooldowns.cooldown(p, TimeUnit.SECONDS, config.infoPlayerCooldown)) {
return;
}
new ExcInfo().execute(p, new String[] { g.getTag() });
event.setCancelled(true);
return;
}
}
}
}
if (ProtectionUtils.action(eventAction, event.getClickedBlock())) {
event.setCancelled(false);
}
}
Aggregations