diff --git a/plugin/src/lightling/gibsoniacraft/GibsoniaCraft.java b/plugin/src/lightling/gibsoniacraft/GibsoniaCraft.java index fc7c868..d44dbbc 100644 --- a/plugin/src/lightling/gibsoniacraft/GibsoniaCraft.java +++ b/plugin/src/lightling/gibsoniacraft/GibsoniaCraft.java @@ -3,18 +3,21 @@ package lightling.gibsoniacraft; import org.bukkit.plugin.java.JavaPlugin; import lightling.gibsoniacraft.crafting.Excavator; +import lightling.gibsoniacraft.crafting.Hammer; import lightling.gibsoniacraft.util.BlockListener; import lightling.gibsoniacraft.util.PlayerInteractListener; public final class GibsoniaCraft extends JavaPlugin { private Excavator excavatorClass; + private Hammer hammerClass; private PlayerInteractListener pListener; private BlockListener bListener; @Override public void onEnable() { excavatorClass = new Excavator(this); + hammerClass = new Hammer(this); pListener = new PlayerInteractListener(this); bListener = new BlockListener(this); } diff --git a/plugin/src/lightling/gibsoniacraft/util/BlockListener.java b/plugin/src/lightling/gibsoniacraft/util/BlockListener.java index 62091c7..a62b77e 100644 --- a/plugin/src/lightling/gibsoniacraft/util/BlockListener.java +++ b/plugin/src/lightling/gibsoniacraft/util/BlockListener.java @@ -26,13 +26,15 @@ import org.bukkit.enchantments.Enchantment; */ public class BlockListener implements Listener { + GibsoniaCraft gcPlugin; public BlockListener(GibsoniaCraft plugin) { - plugin.getServer().getPluginManager().registerEvents(this, plugin); + gcPlugin = plugin; + gcPlugin.getServer().getPluginManager().registerEvents(this, gcPlugin); } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) - public void Break(GibsoniaCraft plugin, BlockBreakEvent bbEvent) + public void Break(BlockBreakEvent bbEvent) { // Grab current tool information Player player = bbEvent.getPlayer(); @@ -43,15 +45,19 @@ public class BlockListener implements Listener if (player != null && (player instanceof Player)) { if (player.isSneaking()) + { return; - if (!ToolUtil.IsExcavator(itemType) || !ToolUtil.IsHammer(itemType)) - return; + } + if (!ToolUtil.IsExcavator(itemType) && !ToolUtil.IsHammer(itemType)) + { + return; + } } // Get blockface information via the player listener Block block = bbEvent.getBlock(); String pName = player.getName(); - PlayerInteractListener pListener = plugin.GetPlayerInteractListener(); + PlayerInteractListener pListener = gcPlugin.GetPlayerInteractListener(); BlockFace blockFace = pListener.GetFaceByName(pName); // getDurability deprecated, must now go through meta information