Provide feedback for the tool when the current world is not logged

This commit is contained in:
Dark_Arc
2013-04-22 22:30:47 -04:00
committed by Dark Arc
parent e37a584f89
commit aa0c562db3

View File

@@ -45,7 +45,12 @@ public class ToolListener implements Listener
final int type = event.getMaterial().getId();
final Tool tool = toolsByType.get(type);
final Player player = event.getPlayer();
if (tool != null && (action == Action.RIGHT_CLICK_BLOCK || action == Action.LEFT_CLICK_BLOCK) && isLogged(player.getWorld()) && logblock.hasPermission(player, "logblock.tools." + tool.name)) {
if (tool != null && (action == Action.RIGHT_CLICK_BLOCK || action == Action.LEFT_CLICK_BLOCK) && logblock.hasPermission(player, "logblock.tools." + tool.name)) {
if (!isLogged(player.getWorld())) {
player.sendMessage(ChatColor.RED + "This world is not currently logged.");
event.setCancelled(true);
return;
}
final ToolBehavior behavior = action == Action.RIGHT_CLICK_BLOCK ? tool.rightClickBehavior : tool.leftClickBehavior;
final ToolData toolData = getSession(player).toolData.get(tool);
if (behavior != ToolBehavior.NONE && toolData.enabled) {