From 8bdd49d98829f00d6708fa4ec4a424956d690521 Mon Sep 17 00:00:00 2001 From: Zrips Date: Fri, 21 Apr 2023 13:58:52 +0300 Subject: [PATCH] Cleanup --- src/main/java/com/gamingmesh/jobs/Jobs.java | 1 - .../jobs/config/BlockProtectionManager.java | 3 +- .../jobs/listeners/JobsListener.java | 847 +++++++++--------- .../jobs/listeners/JobsPayment14Listener.java | 2 - .../jobs/listeners/JobsPaymentListener.java | 5 +- 5 files changed, 426 insertions(+), 432 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index bfcc9c01..e4bb8d94 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -116,7 +116,6 @@ import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Locale.LC; -import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.Version.Version; diff --git a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java index 4d420364..fe56cf8a 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java @@ -16,7 +16,6 @@ import com.gamingmesh.jobs.container.DBAction; import net.Zrips.CMILib.Container.CMIBlock; import net.Zrips.CMILib.Container.CMIBlock.Bisect; import net.Zrips.CMILib.Items.CMIMaterial; -import net.Zrips.CMILib.Logs.CMIDebug; public class BlockProtectionManager { @@ -80,7 +79,7 @@ public class BlockProtectionManager { public BlockProtection addP(Location loc, Long time, boolean paid, boolean cache) { - if (time == 0) + if (time == null || time == 0) return null; String v = loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ(); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 94fbb087..12383444 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -98,78 +98,79 @@ public class JobsListener implements Listener { private final Map interactDelay = new HashMap<>(); public JobsListener(Jobs plugin) { - this.plugin = plugin; + this.plugin = plugin; } private boolean isInteractOk(Player player) { - Long delay = interactDelay.get(player.getUniqueId()); - if (delay == null) { - interactDelay.put(player.getUniqueId(), System.currentTimeMillis()); - return true; - } + Long delay = interactDelay.get(player.getUniqueId()); + if (delay == null) { + interactDelay.put(player.getUniqueId(), System.currentTimeMillis()); + return true; + } - long time = System.currentTimeMillis() - delay; - interactDelay.put(player.getUniqueId(), System.currentTimeMillis()); - return time > 100; + long time = System.currentTimeMillis() - delay; + interactDelay.put(player.getUniqueId(), System.currentTimeMillis()); + return time > 100; } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockFromToEvent(BlockFromToEvent event) { - if (!Jobs.getGCManager().useBlockProtection) - return; - if (!Jobs.getGCManager().ignoreOreGenerators) - return; - if (!Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld())) - return; - Jobs.getBpManager().remove(event.getToBlock()); + if (!Jobs.getGCManager().useBlockProtection) + return; + if (!Jobs.getGCManager().ignoreOreGenerators) + return; + if (!Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld())) + return; + Jobs.getBpManager().remove(event.getToBlock()); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onJoin(PlayerJoinEvent event) { - if (Jobs.getGCManager().isShowNewVersion() && event.getPlayer().hasPermission("jobs.versioncheck")) - Jobs.getVersionCheckManager().VersionCheck(event.getPlayer()); + if (Jobs.getGCManager().isShowNewVersion() && event.getPlayer().hasPermission("jobs.versioncheck")) + Jobs.getVersionCheckManager().VersionCheck(event.getPlayer()); } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onSelection(PlayerInteractEvent event) { - if (event.getClickedBlock() == null || event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; + if (event.getClickedBlock() == null || event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; - Player player = event.getPlayer(); - if (CMIItemStack.getItemInMainHand(player).getType() != CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getMaterial()) - return; + Player player = event.getPlayer(); + + if (CMIItemStack.getItemInMainHand(player).getType() != CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getMaterial()) + return; - if (!Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()) || !player.hasPermission("jobs.area.select")) - return; + if (!Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()) || !player.hasPermission("jobs.area.select")) + return; - if (player.getGameMode() == GameMode.CREATIVE) - event.setCancelled(true); + if (player.getGameMode() == GameMode.CREATIVE) + event.setCancelled(true); - Location loc = event.getClickedBlock().getLocation(); + Location loc = event.getClickedBlock().getLocation(); - if (event.getAction() == Action.LEFT_CLICK_BLOCK) { - Jobs.getSelectionManager().placeLoc1(player, loc); - player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected1", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ())); - event.setCancelled(true); - } else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { - Jobs.getSelectionManager().placeLoc2(player, loc); - player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected2", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ())); - event.setCancelled(true); - } + if (event.getAction() == Action.LEFT_CLICK_BLOCK) { + Jobs.getSelectionManager().placeLoc1(player, loc); + player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected1", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ())); + event.setCancelled(true); + } else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { + Jobs.getSelectionManager().placeLoc2(player, loc); + player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected2", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ())); + event.setCancelled(true); + } - if (Jobs.getSelectionManager().hasPlacedBoth(player)) { - plugin.getServer().getPluginManager().callEvent(new JobsAreaSelectionEvent(player, Jobs.getSelectionManager().getSelectionCuboid(player))); - } + if (Jobs.getSelectionManager().hasPlacedBoth(player)) { + plugin.getServer().getPluginManager().callEvent(new JobsAreaSelectionEvent(player, Jobs.getSelectionManager().getSelectionCuboid(player))); + } } @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJoin(final PlayerJoinEvent event) { - if (!Jobs.getGCManager().MultiServerCompatability()) - Jobs.getPlayerManager().playerJoin(event.getPlayer()); - else { - plugin.getServer().getScheduler().runTaskLater(plugin, () -> Jobs.getPlayerManager().playerJoin(event.getPlayer()), 40L); - } + if (!Jobs.getGCManager().MultiServerCompatability()) + Jobs.getPlayerManager().playerJoin(event.getPlayer()); + else { + plugin.getServer().getScheduler().runTaskLater(plugin, () -> Jobs.getPlayerManager().playerJoin(event.getPlayer()), 40L); + } } // @EventHandler(priority = EventPriority.MONITOR) @@ -186,539 +187,539 @@ public class JobsListener implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onPlayerQuit(PlayerQuitEvent event) { - Jobs.getPlayerManager().playerQuit(event.getPlayer()); + Jobs.getPlayerManager().playerQuit(event.getPlayer()); } @EventHandler(priority = EventPriority.MONITOR) public void onPlayerWorldChange(PlayerChangedWorldEvent event) { - Jobs.getPermissionHandler().recalculatePermissions(Jobs.getPlayerManager().getJobsPlayer(event.getPlayer())); + Jobs.getPermissionHandler().recalculatePermissions(Jobs.getPlayerManager().getJobsPlayer(event.getPlayer())); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onSignInteract(PlayerInteractEvent event) { - if (!Jobs.getGCManager().SignsEnabled || event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; + if (!Jobs.getGCManager().SignsEnabled || event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; - Block block = event.getClickedBlock(); - if (block == null || !(block.getState() instanceof Sign)) - return; + Block block = event.getClickedBlock(); + if (block == null || !(block.getState() instanceof Sign)) + return; - Player player = event.getPlayer(); - if (!isInteractOk(player)) - return; + Player player = event.getPlayer(); + if (!isInteractOk(player)) + return; - Sign sign = (Sign) block.getState(); + Sign sign = (Sign) block.getState(); - if (!CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 0)).equalsIgnoreCase( - CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline")))) - return; + if (!CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 0)).equalsIgnoreCase( + CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline")))) + return; - String command = CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 1)); - for (String key : Jobs.getLanguageManager().signKeys) { - if (command.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.secondline." + key)))) { - command = key; - break; - } - } + String command = CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 1)); + for (String key : Jobs.getLanguageManager().signKeys) { + if (command.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.secondline." + key)))) { + command = key; + break; + } + } - player.performCommand("jobs " + command + " " + CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 2)) - + " " + CMIChatColor.stripColor(plugin.getComplement() - .getLine(sign, 3)).replace(" ", "")); // Replace trailing spaces at 3rd line to parse command + player.performCommand("jobs " + command + " " + CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 2)) + + " " + CMIChatColor.stripColor(plugin.getComplement() + .getLine(sign, 3)).replace(" ", "")); // Replace trailing spaces at 3rd line to parse command } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onSignDestroy(BlockBreakEvent event) { - if (!Jobs.getGCManager().SignsEnabled) - return; + if (!Jobs.getGCManager().SignsEnabled) + return; - Block block = event.getBlock(); - if (!(block.getState() instanceof Sign)) - return; + Block block = event.getBlock(); + if (!(block.getState() instanceof Sign)) + return; - Player player = event.getPlayer(); - if (plugin.getComplement().getLine((Sign) block.getState(), 0).contains(Jobs.getLanguage().getMessage("signs.topline")) - && !player.hasPermission("jobs.command.signs")) { - event.setCancelled(true); - player.sendMessage(Jobs.getLanguage().getMessage("signs.cantdestroy")); - return; - } + Player player = event.getPlayer(); + if (plugin.getComplement().getLine((Sign) block.getState(), 0).contains(Jobs.getLanguage().getMessage("signs.topline")) + && !player.hasPermission("jobs.command.signs")) { + event.setCancelled(true); + player.sendMessage(Jobs.getLanguage().getMessage("signs.cantdestroy")); + return; + } - if (Jobs.getSignUtil().getSign(block.getLocation()) == null) - return; + if (Jobs.getSignUtil().getSign(block.getLocation()) == null) + return; - if (!player.hasPermission("jobs.command.signs")) { - event.setCancelled(true); - player.sendMessage(Jobs.getLanguage().getMessage("signs.cantdestroy")); - return; - } + if (!player.hasPermission("jobs.command.signs")) { + event.setCancelled(true); + player.sendMessage(Jobs.getLanguage().getMessage("signs.cantdestroy")); + return; + } - if (Jobs.getSignUtil().removeSign(block.getLocation())) - Jobs.getSignUtil().saveSigns(); + if (Jobs.getSignUtil().removeSign(block.getLocation())) + Jobs.getSignUtil().saveSigns(); } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onSignTopListCreate(SignChangeEvent event) { - if (!Jobs.getGCManager().SignsEnabled) - return; + if (!Jobs.getGCManager().SignsEnabled) + return; - Block block = event.getBlock(); - if (!(block.getState() instanceof Sign)) - return; + Block block = event.getBlock(); + if (!(block.getState() instanceof Sign)) + return; - if (!CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)).equalsIgnoreCase("[Jobs]")) - return; + if (!CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)).equalsIgnoreCase("[Jobs]")) + return; - final SignTopType type = SignTopType.getType(CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1))); - if (type == null) - return; + final SignTopType type = SignTopType.getType(CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1))); + if (type == null) + return; - Player player = event.getPlayer(); - if (!player.hasPermission("jobs.command.signs")) { - event.setCancelled(true); - player.sendMessage(Jobs.getLanguage().getMessage("signs.cantcreate")); - return; - } + Player player = event.getPlayer(); + if (!player.hasPermission("jobs.command.signs")) { + event.setCancelled(true); + player.sendMessage(Jobs.getLanguage().getMessage("signs.cantcreate")); + return; + } - final Job job = Jobs.getJob(CMIChatColor.stripColor(plugin.getComplement().getLine(event, 2)).toLowerCase()); - if (type == SignTopType.toplist && job == null) { - player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob")); - return; - } + final Job job = Jobs.getJob(CMIChatColor.stripColor(plugin.getComplement().getLine(event, 2)).toLowerCase()); + if (type == SignTopType.toplist && job == null) { + player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob")); + return; + } - boolean special = false; - String numberString = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 3)).toLowerCase(); - if (numberString.contains("s")) { - numberString = numberString.replace("s", ""); - special = true; - } + boolean special = false; + String numberString = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 3)).toLowerCase(); + if (numberString.contains("s")) { + numberString = numberString.replace("s", ""); + special = true; + } - int number = 0; - try { - number = Integer.parseInt(numberString); - } catch (NumberFormatException e) { - CMIMessages.sendMessage(player, LC.info_UseInteger); - return; - } + int number = 0; + try { + number = Integer.parseInt(numberString); + } catch (NumberFormatException e) { + CMIMessages.sendMessage(player, LC.info_UseInteger); + return; + } - jobsSign signInfo = new jobsSign(); + jobsSign signInfo = new jobsSign(); - signInfo.setLoc(block.getLocation()); - signInfo.setNumber(number); - if (job != null) - signInfo.setJobName(job.getName()); - signInfo.setType(type); - signInfo.setSpecial(special); + signInfo.setLoc(block.getLocation()); + signInfo.setNumber(number); + if (job != null) + signInfo.setJobName(job.getName()); + signInfo.setType(type); + signInfo.setSpecial(special); - final SignUtil signUtil = Jobs.getSignUtil(); - signUtil.addSign(signInfo); - signUtil.saveSigns(); + final SignUtil signUtil = Jobs.getSignUtil(); + signUtil.addSign(signInfo); + signUtil.saveSigns(); - event.setCancelled(true); + event.setCancelled(true); - plugin.getServer().getScheduler().runTaskLater(plugin, () -> signUtil.signUpdate(job, type), 1L); + plugin.getServer().getScheduler().runTaskLater(plugin, () -> signUtil.signUpdate(job, type), 1L); } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onSignChange(SignChangeEvent event) { - if (!Jobs.getGCManager().SignsEnabled) - return; + if (!Jobs.getGCManager().SignsEnabled) + return; - String line1 = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1)); + String line1 = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1)); - if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)) - .equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase("toplist")) - event.setLine(0, convert(Jobs.getLanguage().getMessage("signs.topline"))); - else - return; + if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)) + .equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase("toplist")) + event.setLine(0, convert(Jobs.getLanguage().getMessage("signs.topline"))); + else + return; - if (!event.getPlayer().hasPermission("jobs.command.signs")) { - event.setCancelled(true); - event.getPlayer().sendMessage(Jobs.getLanguage().getMessage("signs.cantcreate")); - return; - } + if (!event.getPlayer().hasPermission("jobs.command.signs")) { + event.setCancelled(true); + event.getPlayer().sendMessage(Jobs.getLanguage().getMessage("signs.cantcreate")); + return; + } - for (String key : Jobs.getLanguageManager().signKeys) { - String secondLine = Jobs.getLanguage().getMessage("signs.secondline." + key); + for (String key : Jobs.getLanguageManager().signKeys) { + String secondLine = Jobs.getLanguage().getMessage("signs.secondline." + key); - if (line1.equalsIgnoreCase(CMIChatColor.stripColor(secondLine))) { - event.setLine(1, convert(secondLine)); - break; - } - } + if (line1.equalsIgnoreCase(CMIChatColor.stripColor(secondLine))) { + event.setLine(1, convert(secondLine)); + break; + } + } - Job job = Jobs.getJob(CMIChatColor.stripColor(plugin.getComplement().getLine(event, 2))); - if (job == null) - return; + Job job = Jobs.getJob(CMIChatColor.stripColor(plugin.getComplement().getLine(event, 2))); + if (job == null) + return; - String color = Jobs.getGCManager().SignsColorizeJobName ? job.getChatColor().toString() : ""; - event.setLine(2, convert(color + job.getDisplayName())); + String color = Jobs.getGCManager().SignsColorizeJobName ? job.getChatColor().toString() : ""; + event.setLine(2, convert(color + job.getDisplayName())); } private final Pattern pattern = Pattern.compile("&([0-9a-fk-or])"); private String convert(String line) { - return pattern.matcher(CMIChatColor.translate(line)).replaceAll("\u00a7$1"); + return pattern.matcher(CMIChatColor.translate(line)).replaceAll("\u00a7$1"); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onWorldLoad(WorldLoadEvent event) { - PluginManager pm = plugin.getServer().getPluginManager(); - String name = event.getWorld().getName().toLowerCase(); - if (pm.getPermission("jobs.world." + name) == null && !PermissionHandler.worldsRegistered.contains(name)) { - pm.addPermission(new Permission("jobs.world." + name, PermissionDefault.TRUE)); - PermissionHandler.worldsRegistered.add(name); - } + PluginManager pm = plugin.getServer().getPluginManager(); + String name = event.getWorld().getName().toLowerCase(); + if (pm.getPermission("jobs.world." + name) == null && !PermissionHandler.worldsRegistered.contains(name)) { + pm.addPermission(new Permission("jobs.world." + name, PermissionDefault.TRUE)); + PermissionHandler.worldsRegistered.add(name); + } } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onCropGrown(final BlockGrowEvent event) { - if (Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld())) { - plugin.getServer().getScheduler().runTaskLater(plugin, () -> Jobs.getBpManager().remove(event.getBlock()), 1L); - } + if (Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld())) { + plugin.getServer().getScheduler().runTaskLater(plugin, () -> Jobs.getBpManager().remove(event.getBlock()), 1L); + } } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onTreeGrown(final StructureGrowEvent event) { - if (!event.getBlocks().isEmpty() && Jobs.getGCManager().canPerformActionInWorld(event.getBlocks().get(0).getWorld())) { - plugin.getServer().getScheduler().runTaskLater(plugin, () -> event.getBlocks().forEach(blockState -> Jobs.getBpManager().remove(blockState.getBlock())), 1L); - } + if (!event.getBlocks().isEmpty() && Jobs.getGCManager().canPerformActionInWorld(event.getBlocks().get(0).getWorld())) { + plugin.getServer().getScheduler().runTaskLater(plugin, () -> event.getBlocks().forEach(blockState -> Jobs.getBpManager().remove(blockState.getBlock())), 1L); + } } private static boolean usingLimitedItem(ItemStack iih, JobsPlayer jPlayer) { - CMINBT nbt = new CMINBT(iih); - Integer i = nbt.getInt("JobsLimited"); + CMINBT nbt = new CMINBT(iih); + Integer i = nbt.getInt("JobsLimited"); - if (i == null) - return false; + if (i == null) + return false; - Job job = Jobs.getJob(i); - if (job == null) - return false; + Job job = Jobs.getJob(i); + if (job == null) + return false; - JobProgression prog = jPlayer.getJobProgression(job); - if (prog == null) - return false; + JobProgression prog = jPlayer.getJobProgression(job); + if (prog == null) + return false; - String node = nbt.getString("JobsLimitedNode"); - if (node == null) - return false; + String node = nbt.getString("JobsLimitedNode"); + if (node == null) + return false; - for (JobLimitedItems oneItem : job.getLimitedItems().values()) { - if (prog.getLevel() >= oneItem.getLevel() || !oneItem.getNode().equalsIgnoreCase(node)) - continue; + for (JobLimitedItems oneItem : job.getLimitedItems().values()) { + if (prog.getLevel() >= oneItem.getLevel() || !oneItem.getNode().equalsIgnoreCase(node)) + continue; - CMIActionBar.send(jPlayer.getPlayer(), Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", job.getDisplayName())); - return true; - } + CMIActionBar.send(jPlayer.getPlayer(), Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", job.getDisplayName())); + return true; + } - return false; + return false; } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onLimitedItemInteract(PlayerInteractEvent event) { - if (!Jobs.hasLimitedItems()) { - return; - } + if (!Jobs.hasLimitedItems()) { + return; + } - Player player = event.getPlayer(); - ItemStack iih = null; - try { - if (Version.isCurrentHigher(Version.v1_8_R3) && event.getHand() != EquipmentSlot.HAND) { - iih = CMIItemStack.getItemInOffHand(player); - } else { - iih = CMIItemStack.getItemInMainHand(player); - } - } catch (Exception e) { - iih = CMIItemStack.getItemInMainHand(player); - } + Player player = event.getPlayer(); + ItemStack iih = null; + try { + if (Version.isCurrentHigher(Version.v1_8_R3) && event.getHand() != EquipmentSlot.HAND) { + iih = CMIItemStack.getItemInOffHand(player); + } else { + iih = CMIItemStack.getItemInMainHand(player); + } + } catch (Exception e) { + iih = CMIItemStack.getItemInMainHand(player); + } - if (iih == null || iih.getType() == Material.AIR) - return; + if (iih == null || iih.getType() == Material.AIR) + return; - if (event.getClickedBlock() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getClickedBlock().getWorld())) - return; + if (event.getClickedBlock() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getClickedBlock().getWorld())) + return; - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - if (jPlayer == null) - return; + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); + if (jPlayer == null) + return; - Map enchants = new HashMap<>(iih.getEnchantments()); - if (enchants.isEmpty()) { - return; - } + Map enchants = new HashMap<>(iih.getEnchantments()); + if (enchants.isEmpty()) { + return; + } - if (usingLimitedItem(iih, jPlayer)) { - event.setCancelled(true); - } + if (usingLimitedItem(iih, jPlayer)) { + event.setCancelled(true); + } - String name = null; - List lore = new ArrayList<>(); + String name = null; + List lore = new ArrayList<>(); - if (iih.hasItemMeta()) { - ItemMeta meta = iih.getItemMeta(); - if (meta.hasDisplayName()) - name = meta.getDisplayName(); - if (meta.hasLore()) - lore = meta.getLore(); - } + if (iih.hasItemMeta()) { + ItemMeta meta = iih.getItemMeta(); + if (meta.hasDisplayName()) + name = meta.getDisplayName(); + if (meta.hasLore()) + lore = meta.getLore(); + } - String meinOk = null; - String itemNode = null; - CMIMaterial mat = CMIMaterial.get(iih); + String meinOk = null; + String itemNode = null; + CMIMaterial mat = CMIMaterial.get(iih); - Integer jobId = null; - mein: for (JobProgression one : jPlayer.getJobProgression()) { - for (JobLimitedItems oneItem : one.getJob().getLimitedItems().values()) { - if (one.getLevel() >= oneItem.getLevel() || !isThisItem(oneItem, mat, name, lore, enchants)) - continue; - jobId = one.getJob().getId(); - meinOk = one.getJob().getDisplayName(); - itemNode = oneItem.getNode(); - break mein; - } - } + Integer jobId = null; + mein: for (JobProgression one : jPlayer.getJobProgression()) { + for (JobLimitedItems oneItem : one.getJob().getLimitedItems().values()) { + if (one.getLevel() >= oneItem.getLevel() || !isThisItem(oneItem, mat, name, lore, enchants)) + continue; + jobId = one.getJob().getId(); + meinOk = one.getJob().getDisplayName(); + itemNode = oneItem.getNode(); + break mein; + } + } - if (meinOk != null) { - event.setCancelled(true); - CMIActionBar.send(player, Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", meinOk)); + if (meinOk != null) { + event.setCancelled(true); + CMIActionBar.send(player, Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", meinOk)); - CMINBT nbt = new CMINBT(iih); - nbt.setInt("JobsLimited", jobId); - iih = (ItemStack) nbt.setString("JobsLimitedNode", itemNode); - try { - if (Version.isCurrentHigher(Version.v1_8_R3) && event.getHand() != EquipmentSlot.HAND) { - CMIItemStack.setItemInOffHand(player, iih); - } else { - CMIItemStack.setItemInMainHand(player, iih); - } - } catch (Exception e) { - CMIItemStack.setItemInMainHand(player, iih); - } - } + CMINBT nbt = new CMINBT(iih); + nbt.setInt("JobsLimited", jobId); + iih = (ItemStack) nbt.setString("JobsLimitedNode", itemNode); + try { + if (Version.isCurrentHigher(Version.v1_8_R3) && event.getHand() != EquipmentSlot.HAND) { + CMIItemStack.setItemInOffHand(player, iih); + } else { + CMIItemStack.setItemInMainHand(player, iih); + } + } catch (Exception e) { + CMIItemStack.setItemInMainHand(player, iih); + } + } } private static boolean isThisItem(JobLimitedItems oneItem, CMIMaterial mat, String name, List lore, Map enchants) { - if (oneItem.getType() != mat) - return false; + if (oneItem.getType() != mat) + return false; - if (oneItem.getName() != null && !CMIChatColor.translate(oneItem.getName()).equalsIgnoreCase(name)) { - return false; - } + if (oneItem.getName() != null && !CMIChatColor.translate(oneItem.getName()).equalsIgnoreCase(name)) { + return false; + } - for (String onelore : oneItem.getLore()) { - if (!lore.contains(onelore)) { - return false; - } - } + for (String onelore : oneItem.getLore()) { + if (!lore.contains(onelore)) { + return false; + } + } - for (Entry oneE : enchants.entrySet()) { - Integer value = oneItem.getEnchants().get(oneE.getKey()); + for (Entry oneE : enchants.entrySet()) { + Integer value = oneItem.getEnchants().get(oneE.getKey()); - if (value != null && value <= oneE.getValue()) { - return true; - } - } + if (value != null && value <= oneE.getValue()) { + return true; + } + } - return false; + return false; } @EventHandler(ignoreCancelled = true) public void onChunkChangeMove(PlayerMoveEvent event) { - if (!event.getPlayer().isOnline() || !Jobs.getGCManager().canPerformActionInWorld(event.getTo().getWorld())) - return; + if (!event.getPlayer().isOnline() || !Jobs.getGCManager().canPerformActionInWorld(event.getTo().getWorld())) + return; - Chunk from = event.getFrom().getChunk(); - Chunk to = event.getTo().getChunk(); - if (from != to) { - plugin.getServer().getPluginManager().callEvent(new JobsChunkChangeEvent(event.getPlayer(), from, to)); - } + Chunk from = event.getFrom().getChunk(); + Chunk to = event.getTo().getChunk(); + if (from != to) { + plugin.getServer().getPluginManager().callEvent(new JobsChunkChangeEvent(event.getPlayer(), from, to)); + } } @EventHandler(ignoreCancelled = true) public void onInventoryClick(InventoryClickEvent event) { - boolean shift = false, numberkey = false; + boolean shift = false, numberkey = false; - if (event.getClick() == ClickType.SHIFT_LEFT || event.getClick() == ClickType.SHIFT_RIGHT) - shift = true; + if (event.getClick() == ClickType.SHIFT_LEFT || event.getClick() == ClickType.SHIFT_RIGHT) + shift = true; - if (event.getClick() == ClickType.NUMBER_KEY) - numberkey = true; + if (event.getClick() == ClickType.NUMBER_KEY) + numberkey = true; - SlotType slotType = event.getSlotType(); + SlotType slotType = event.getSlotType(); - if ((slotType != SlotType.ARMOR || slotType != SlotType.QUICKBAR) && event.getInventory().getType() != InventoryType.CRAFTING) - return; + if ((slotType != SlotType.ARMOR || slotType != SlotType.QUICKBAR) && event.getInventory().getType() != InventoryType.CRAFTING) + return; - if (!(event.getWhoClicked() instanceof Player) || event.getCurrentItem() == null) - return; + if (!(event.getWhoClicked() instanceof Player) || event.getCurrentItem() == null) + return; - ArmorTypes newArmorType = ArmorTypes.matchType(shift ? event.getCurrentItem() : event.getCursor()); - if (!shift && newArmorType != null && event.getRawSlot() != newArmorType.getSlot()) - return; + ArmorTypes newArmorType = ArmorTypes.matchType(shift ? event.getCurrentItem() : event.getCursor()); + if (!shift && newArmorType != null && event.getRawSlot() != newArmorType.getSlot()) + return; - if (shift) { - newArmorType = ArmorTypes.matchType(event.getCurrentItem()); - if (newArmorType == null) - return; + if (shift) { + newArmorType = ArmorTypes.matchType(event.getCurrentItem()); + if (newArmorType == null) + return; - boolean equipping = true; - if (event.getRawSlot() == newArmorType.getSlot()) - equipping = false; + boolean equipping = true; + if (event.getRawSlot() == newArmorType.getSlot()) + equipping = false; - Player player = (Player) event.getWhoClicked(); - PlayerInventory inv = player.getInventory(); + Player player = (Player) event.getWhoClicked(); + PlayerInventory inv = player.getInventory(); - if (newArmorType == ArmorTypes.HELMET && - (equipping ? inv.getHelmet() == null : inv.getHelmet() != null) || - (newArmorType == ArmorTypes.CHESTPLATE || newArmorType == ArmorTypes.ELYTRA) && - (equipping ? inv.getChestplate() == null : inv.getChestplate() != null) || - newArmorType == ArmorTypes.LEGGINGS && - (equipping ? inv.getLeggings() == null : inv.getLeggings() != null) || - newArmorType == ArmorTypes.BOOTS && - (equipping ? inv.getBoots() == null : inv.getBoots() != null)) { - JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent(player, EquipMethod.SHIFT_CLICK, newArmorType, equipping ? null : event - .getCurrentItem(), equipping ? event.getCurrentItem() : null); - plugin.getServer().getPluginManager().callEvent(armorEquipEvent); - if (armorEquipEvent.isCancelled()) { - event.setCancelled(true); - } - } - } else { - ItemStack newArmorPiece = event.getCursor(); - ItemStack oldArmorPiece = event.getCurrentItem(); - if (numberkey) { - org.bukkit.inventory.Inventory clicked = Version.isCurrentHigher(Version.v1_8_R1) ? event.getInventory() : event.getClickedInventory(); - if (clicked != null && clicked.getType() == InventoryType.PLAYER) { - ItemStack hotbarItem = clicked.getItem(event.getHotbarButton()); - if (hotbarItem != null) { - newArmorType = ArmorTypes.matchType(hotbarItem); - newArmorPiece = hotbarItem; - oldArmorPiece = clicked.getItem(event.getSlot()); - } else - newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor()); - } - } else - newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor()); + if (newArmorType == ArmorTypes.HELMET && + (equipping ? inv.getHelmet() == null : inv.getHelmet() != null) || + (newArmorType == ArmorTypes.CHESTPLATE || newArmorType == ArmorTypes.ELYTRA) && + (equipping ? inv.getChestplate() == null : inv.getChestplate() != null) || + newArmorType == ArmorTypes.LEGGINGS && + (equipping ? inv.getLeggings() == null : inv.getLeggings() != null) || + newArmorType == ArmorTypes.BOOTS && + (equipping ? inv.getBoots() == null : inv.getBoots() != null)) { + JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent(player, EquipMethod.SHIFT_CLICK, newArmorType, equipping ? null : event + .getCurrentItem(), equipping ? event.getCurrentItem() : null); + plugin.getServer().getPluginManager().callEvent(armorEquipEvent); + if (armorEquipEvent.isCancelled()) { + event.setCancelled(true); + } + } + } else { + ItemStack newArmorPiece = event.getCursor(); + ItemStack oldArmorPiece = event.getCurrentItem(); + if (numberkey) { + org.bukkit.inventory.Inventory clicked = Version.isCurrentHigher(Version.v1_8_R1) ? event.getInventory() : event.getClickedInventory(); + if (clicked != null && clicked.getType() == InventoryType.PLAYER) { + ItemStack hotbarItem = clicked.getItem(event.getHotbarButton()); + if (hotbarItem != null) { + newArmorType = ArmorTypes.matchType(hotbarItem); + newArmorPiece = hotbarItem; + oldArmorPiece = clicked.getItem(event.getSlot()); + } else + newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor()); + } + } else + newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor()); - if (newArmorType != null && event.getRawSlot() == newArmorType.getSlot()) { - EquipMethod method = EquipMethod.DRAG; - if (event.getAction() == InventoryAction.HOTBAR_SWAP || numberkey) - method = EquipMethod.HOTBAR_SWAP; - JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent((Player) event.getWhoClicked(), method, newArmorType, oldArmorPiece, newArmorPiece); - plugin.getServer().getPluginManager().callEvent(armorEquipEvent); - if (armorEquipEvent.isCancelled()) - event.setCancelled(true); - } - } + if (newArmorType != null && event.getRawSlot() == newArmorType.getSlot()) { + EquipMethod method = EquipMethod.DRAG; + if (event.getAction() == InventoryAction.HOTBAR_SWAP || numberkey) + method = EquipMethod.HOTBAR_SWAP; + JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent((Player) event.getWhoClicked(), method, newArmorType, oldArmorPiece, newArmorPiece); + plugin.getServer().getPluginManager().callEvent(armorEquipEvent); + if (armorEquipEvent.isCancelled()) + event.setCancelled(true); + } + } } @EventHandler public void playerInteractEvent(PlayerInteractEvent event) { - if (event.getAction() == Action.PHYSICAL) - return; + if (event.getAction() == Action.PHYSICAL) + return; - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; - ArmorTypes newArmorType = ArmorTypes.matchType(event.getItem()); - if (newArmorType == null) - return; + ArmorTypes newArmorType = ArmorTypes.matchType(event.getItem()); + if (newArmorType == null) + return; - PlayerInventory inv = event.getPlayer().getInventory(); + PlayerInventory inv = event.getPlayer().getInventory(); - if (newArmorType == ArmorTypes.HELMET && - inv.getHelmet() == null || - (newArmorType == ArmorTypes.CHESTPLATE || newArmorType == ArmorTypes.ELYTRA) && - inv.getChestplate() == null || - newArmorType == ArmorTypes.LEGGINGS && - inv.getLeggings() == null || - newArmorType == ArmorTypes.BOOTS && - inv.getBoots() == null) { - JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent(event.getPlayer(), EquipMethod.HOTBAR, ArmorTypes.matchType(event.getItem()), null, event - .getItem()); - plugin.getServer().getPluginManager().callEvent(armorEquipEvent); - if (armorEquipEvent.isCancelled()) { - event.setCancelled(true); - event.getPlayer().updateInventory(); - } - } + if (newArmorType == ArmorTypes.HELMET && + inv.getHelmet() == null || + (newArmorType == ArmorTypes.CHESTPLATE || newArmorType == ArmorTypes.ELYTRA) && + inv.getChestplate() == null || + newArmorType == ArmorTypes.LEGGINGS && + inv.getLeggings() == null || + newArmorType == ArmorTypes.BOOTS && + inv.getBoots() == null) { + JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent(event.getPlayer(), EquipMethod.HOTBAR, ArmorTypes.matchType(event.getItem()), null, event + .getItem()); + plugin.getServer().getPluginManager().callEvent(armorEquipEvent); + if (armorEquipEvent.isCancelled()) { + event.setCancelled(true); + event.getPlayer().updateInventory(); + } + } } @EventHandler(ignoreCancelled = true) public void dispenserFireEvent(BlockDispenseEvent event) { - ItemStack item = event.getItem(); - ArmorTypes type = ArmorTypes.matchType(item); - if (type == null) - return; + ItemStack item = event.getItem(); + ArmorTypes type = ArmorTypes.matchType(item); + if (type == null) + return; - Location loc = event.getBlock().getLocation(); - for (Player p : loc.getWorld().getPlayers()) { - Location ploc = p.getLocation(); - if (loc.getBlockY() - ploc.getBlockY() >= -1 && loc.getBlockY() - ploc.getBlockY() <= 1) { + Location loc = event.getBlock().getLocation(); + for (Player p : loc.getWorld().getPlayers()) { + Location ploc = p.getLocation(); + if (loc.getBlockY() - ploc.getBlockY() >= -1 && loc.getBlockY() - ploc.getBlockY() <= 1) { - if (p.getInventory().getHelmet() == null && type == ArmorTypes.HELMET || - p.getInventory().getChestplate() == null && (type == ArmorTypes.CHESTPLATE || type == ArmorTypes.ELYTRA) || - p.getInventory().getLeggings() == null && type == ArmorTypes.LEGGINGS || - p.getInventory().getBoots() == null && type == ArmorTypes.BOOTS) { + if (p.getInventory().getHelmet() == null && type == ArmorTypes.HELMET || + p.getInventory().getChestplate() == null && (type == ArmorTypes.CHESTPLATE || type == ArmorTypes.ELYTRA) || + p.getInventory().getLeggings() == null && type == ArmorTypes.LEGGINGS || + p.getInventory().getBoots() == null && type == ArmorTypes.BOOTS) { - if (!(event.getBlock().getState() instanceof Dispenser)) - continue; + if (!(event.getBlock().getState() instanceof Dispenser)) + continue; - Dispenser dispenser = (Dispenser) event.getBlock().getState(); - BlockFace directionFacing = null; - if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) { - org.bukkit.material.Dispenser dis = (org.bukkit.material.Dispenser) dispenser.getData(); - directionFacing = dis.getFacing(); - } else { - org.bukkit.block.data.type.Dispenser dis = (org.bukkit.block.data.type.Dispenser) dispenser.getBlockData(); - directionFacing = dis.getFacing(); - } + Dispenser dispenser = (Dispenser) event.getBlock().getState(); + BlockFace directionFacing = null; + if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) { + org.bukkit.material.Dispenser dis = (org.bukkit.material.Dispenser) dispenser.getData(); + directionFacing = dis.getFacing(); + } else { + org.bukkit.block.data.type.Dispenser dis = (org.bukkit.block.data.type.Dispenser) dispenser.getBlockData(); + directionFacing = dis.getFacing(); + } - if (directionFacing == BlockFace.EAST && - ploc.getBlockX() != loc.getBlockX() && - ploc.getX() <= loc.getX() + 2.3 && - ploc.getX() >= loc.getX() || - directionFacing == BlockFace.WEST && - ploc.getX() >= loc.getX() - 1.3 && - ploc.getX() <= loc.getX() || - directionFacing == BlockFace.SOUTH && - ploc.getBlockZ() != loc.getBlockZ() && - ploc.getZ() <= loc.getZ() + 2.3 && - ploc.getZ() >= loc.getZ() || - directionFacing == BlockFace.NORTH && - ploc.getZ() >= loc.getZ() - 1.3 && - ploc.getZ() <= loc.getZ()) { + if (directionFacing == BlockFace.EAST && + ploc.getBlockX() != loc.getBlockX() && + ploc.getX() <= loc.getX() + 2.3 && + ploc.getX() >= loc.getX() || + directionFacing == BlockFace.WEST && + ploc.getX() >= loc.getX() - 1.3 && + ploc.getX() <= loc.getX() || + directionFacing == BlockFace.SOUTH && + ploc.getBlockZ() != loc.getBlockZ() && + ploc.getZ() <= loc.getZ() + 2.3 && + ploc.getZ() >= loc.getZ() || + directionFacing == BlockFace.NORTH && + ploc.getZ() >= loc.getZ() - 1.3 && + ploc.getZ() <= loc.getZ()) { - JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent(p, EquipMethod.DISPENSER, type, null, item); - plugin.getServer().getPluginManager().callEvent(armorEquipEvent); - if (armorEquipEvent.isCancelled()) { - event.setCancelled(true); - return; - } - } - } - } - } + JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent(p, EquipMethod.DISPENSER, type, null, item); + plugin.getServer().getPluginManager().callEvent(armorEquipEvent); + if (armorEquipEvent.isCancelled()) { + event.setCancelled(true); + return; + } + } + } + } + } } @EventHandler public void jobsArmorChangeEvent(JobsArmorChangeEvent event) { - Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId()); + Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId()); } @EventHandler public void playerItemHeldEvent(PlayerItemHeldEvent event) { - Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId()); + Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId()); } @EventHandler public void playerItemBreakEvent(PlayerItemBreakEvent event) { - Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId()); + Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId()); } @EventHandler public void playerItemBreakEvent(InventoryClickEvent event) { - Jobs.getPlayerManager().resetItemBonusCache(((Player) event.getWhoClicked()).getUniqueId()); + Jobs.getPlayerManager().resetItemBonusCache(((Player) event.getWhoClicked()).getUniqueId()); } } diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment14Listener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment14Listener.java index 9ecff662..9e2729ed 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment14Listener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPayment14Listener.java @@ -24,8 +24,6 @@ import com.gamingmesh.jobs.actions.ItemActionInfo; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.PlayerCamp; -import net.Zrips.CMILib.Logs.CMIDebug; - public final class JobsPayment14Listener implements Listener { // BlockCookEvent does not have "cooking owner" diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 8eb06e19..28fac998 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -26,7 +26,6 @@ import java.util.Map.Entry; import java.util.UUID; import java.util.concurrent.TimeUnit; -import com.gamingmesh.jobs.config.GeneralConfigManager; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -72,8 +71,8 @@ import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.inventory.PrepareAnvilEvent; import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.inventory.PrepareAnvilEvent; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -90,7 +89,6 @@ import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.permissions.PermissionAttachmentInfo; -import org.checkerframework.checker.nullness.qual.Nullable; import com.bgsoftware.wildstacker.api.enums.StackSplit; import com.gamingmesh.jobs.ItemBoostManager; @@ -132,7 +130,6 @@ import net.Zrips.CMILib.Entities.CMIEntityType; import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Locale.LC; -import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Version.Version;