From e86c93d9e59be6c67298131048c7b74704ec6f0e Mon Sep 17 00:00:00 2001 From: Brianna <bri@songoda.com> Date: Mon, 10 Jun 2019 23:21:33 -0400 Subject: [PATCH] Fix for a nasty avoidable error. --- .gitlab-ci.yml | 2 +- .../songoda/epicfurnaces/listeners/BlockListeners.java | 2 +- .../epicfurnaces/listeners/InteractListeners.java | 10 +++------- .../songoda/epicfurnaces/managers/HologramManager.java | 2 +- .../songoda/epicfurnaces/objects/FurnaceObject.java | 6 +++--- .../com/songoda/epicfurnaces/tasks/FurnaceTask.java | 4 ++-- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e1b307..ab84bc0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "EpicFurnaces" path: "/builds/$CI_PROJECT_PATH" - version: "4.2.4" + version: "4.2.5" build: stage: build diff --git a/core/src/main/java/com/songoda/epicfurnaces/listeners/BlockListeners.java b/core/src/main/java/com/songoda/epicfurnaces/listeners/BlockListeners.java index d7a45db..569dce3 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/listeners/BlockListeners.java +++ b/core/src/main/java/com/songoda/epicfurnaces/listeners/BlockListeners.java @@ -92,7 +92,7 @@ public class BlockListeners implements Listener { return; } - if (event.getBlock().getType() != Material.FURNACE && event.getBlock().getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) { + if (event.getBlock().getType() != Material.FURNACE && !event.getBlock().getType().name().equals("BURNING_FURNACE")) { return; } diff --git a/core/src/main/java/com/songoda/epicfurnaces/listeners/InteractListeners.java b/core/src/main/java/com/songoda/epicfurnaces/listeners/InteractListeners.java index 36dcedc..1be220d 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/listeners/InteractListeners.java +++ b/core/src/main/java/com/songoda/epicfurnaces/listeners/InteractListeners.java @@ -23,11 +23,8 @@ public class InteractListeners implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onClick(PlayerInteractEvent event) { - if (event.getClickedBlock() == null) { - return; - } - - if (instance.getBlacklistHandler().isBlacklisted(event.getPlayer())) { + if (event.getClickedBlock() == null + && instance.getBlacklistHandler().isBlacklisted(event.getPlayer())) { return; } @@ -37,11 +34,10 @@ public class InteractListeners implements Listener { if (!player.hasPermission("EpicFurnaces.overview") || event.getAction() != Action.LEFT_CLICK_BLOCK || player.isSneaking() - || (block.getType() != Material.FURNACE && block.getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) + || (block.getType() != Material.FURNACE && !block.getType().name().equals("BURNING_FURNACE")) || player.getInventory().getItemInHand().getType().name().contains("PICKAXE")) { return; } - event.setCancelled(true); instance.getFurnaceManager().getFurnace(block.getLocation()).orElseGet(() -> instance.getFurnaceManager().createFurnace(block.getLocation())).openOverview(player); } diff --git a/core/src/main/java/com/songoda/epicfurnaces/managers/HologramManager.java b/core/src/main/java/com/songoda/epicfurnaces/managers/HologramManager.java index 8bec3c1..a48c2f2 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/managers/HologramManager.java +++ b/core/src/main/java/com/songoda/epicfurnaces/managers/HologramManager.java @@ -28,7 +28,7 @@ public class HologramManager { public void updateHologram(FurnaceObject furnaceObject) { Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> { if (furnaceObject.getLocation().getBlock().getType() != Material.FURNACE && - furnaceObject.getLocation().getBlock().getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) { + !furnaceObject.getLocation().getBlock().getType().name().equals("BURNING_FURNACE")) { if (hologramMap.containsKey(furnaceObject)) { hologramMap.remove(furnaceObject).delete(); } diff --git a/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java b/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java index ca93b95..1d040d1 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java +++ b/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java @@ -55,7 +55,7 @@ public class FurnaceObject { public void plus(FurnaceSmeltEvent e) { Block block = location.getBlock(); - if (block.getType() != Material.FURNACE && block.getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) { + if (block.getType() != Material.FURNACE && !block.getType().name().equals("BURNING_FURNACE")) { return; } @@ -168,7 +168,7 @@ public class FurnaceObject { } private void syncName() { - if (location.getBlock().getType() != Material.FURNACE && location.getBlock().getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) { + if (location.getBlock().getType() != Material.FURNACE && !location.getBlock().getType().name().equals("BURNING_FURNACE")) { return; } @@ -194,7 +194,7 @@ public class FurnaceObject { public void updateCook() { Block block = location.getBlock(); - if (block == null || (block.getType() != Material.FURNACE && block.getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType())) { + if (block == null || (block.getType() != Material.FURNACE && !block.getType().name().equals("BURNING_FURNACE"))) { return; } Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(instance, () -> { diff --git a/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java b/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java index 22d4faa..e12404c 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java +++ b/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java @@ -46,7 +46,7 @@ public class FurnaceTask extends BukkitRunnable { } if (furnace.getLocation().getBlock().getType() != Material.FURNACE && - furnace.getLocation().getBlock().getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) { + !furnace.getLocation().getBlock().getType().name().equals("BURNING_FURNACE")) { continue; } @@ -111,7 +111,7 @@ public class FurnaceTask extends BukkitRunnable { Block block = location.getBlock(); - if (block.getType() != Material.FURNACE && block.getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) { + if (block.getType() != Material.FURNACE && !block.getType().name().equals("BURNING_FURNACE")) { continue; }