diff --git a/src/xyz/soper/arty/debug/DebugCommand.java b/src/xyz/soper/arty/debug/DebugCommand.java index 670c1bb..31a1f19 100644 --- a/src/xyz/soper/arty/debug/DebugCommand.java +++ b/src/xyz/soper/arty/debug/DebugCommand.java @@ -1,7 +1,6 @@ package xyz.soper.arty.debug; import org.bukkit.ChatColor; -import org.bukkit.block.Block; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/xyz/soper/arty/event/Listener/MortarInteract.java b/src/xyz/soper/arty/event/Listener/MortarInteract.java index b134414..6776297 100644 --- a/src/xyz/soper/arty/event/Listener/MortarInteract.java +++ b/src/xyz/soper/arty/event/Listener/MortarInteract.java @@ -4,7 +4,6 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Nameable; import org.bukkit.block.Block; -import org.bukkit.block.Container; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -24,21 +23,29 @@ public class MortarInteract implements Listener { Player player = event.getPlayer(); ItemStack item = player.getInventory().getItemInMainHand(); Block block = event.getClickedBlock(); - if(block == null) return; - if(block.getBlockData().getMaterial() == Material.BREWING_STAND){ - Nameable brewingStandMortar = (Nameable) event.getClickedBlock().getState(); - String blockName = brewingStandMortar.getCustomName(); - if(blockName == null) return; - if(blockName.equals(ChatColor.GRAY + "Basic Mortar") || blockName.equals(ChatColor.GRAY + "Mortar")){ - if(event.getAction() == Action.RIGHT_CLICK_BLOCK) event.setCancelled(true); - if((item.getType() == Material.ARROW) && item.hasItemMeta() && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().equals(ChatColor.GRAY + "Shell")){ + if((item.getType() == Material.ARROW) + && item.hasItemMeta() + && item.getItemMeta().hasDisplayName() + && item.getItemMeta().getDisplayName().equals(ChatColor.GRAY + "Shell")){ + if(block == null) { + player.sendMessage("Block is null."); + return; + } + else if(block.getBlockData().getMaterial() == Material.BREWING_STAND){ + player.sendMessage("Block is an brewing stand."); + Nameable brewingStandMortar = (Nameable) event.getClickedBlock().getState(); + String blockName = brewingStandMortar.getCustomName(); + if(blockName == null) return; + if(blockName.equals(ChatColor.GRAY + "Basic Mortar") + || blockName.equals(ChatColor.GRAY + "Mortar")){ + player.sendMessage("Block is a mortar."); + if(event.getAction() == Action.RIGHT_CLICK_BLOCK) event.setCancelled(true); MortarHandler mortarHandler = new MortarHandler(new Mortar(block)); - player.sendMessage(mortarHandler.fireShell(new Shell(item))); + mortarHandler.fireShell(new Shell(item)); if(item.getAmount() > 1) item.setAmount(item.getAmount()-1); else player.getInventory().setItemInMainHand(null); } } } } - } diff --git a/src/xyz/soper/arty/util/MortarHandler.java b/src/xyz/soper/arty/util/MortarHandler.java index 89a4654..b192d73 100644 --- a/src/xyz/soper/arty/util/MortarHandler.java +++ b/src/xyz/soper/arty/util/MortarHandler.java @@ -11,9 +11,8 @@ public class MortarHandler { this.mortar = mortar; } - public String /*void*/ fireShell(Shell shell){ + public void fireShell(Shell shell){ mortar.block.getWorld().playSound(mortar.location, "entity.generic.explode", 1, 1.5F); - return "DEBUG: Shell has been fired."; } } \ No newline at end of file