diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java index a10941d40..891ba8505 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java @@ -28,10 +28,10 @@ class TeleporterCommand extends SubCommand { } else if (args.length == 2) { @SuppressWarnings("deprecation") - OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(args[1]); + OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[1]); - if (offlinePlayer.getName() != null) { - Slimefun.getGPSNetwork().getTeleportationManager().openTeleporterGUI(player, offlinePlayer.getUniqueId(), player.getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999); + if (targetPlayer.getName() != null) { + Slimefun.getGPSNetwork().getTeleportationManager().openTeleporterGUI(player, targetPlayer.getUniqueId(), player.getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999); } else { Slimefun.getLocalization().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1])); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java index 29dd89602..c3ea0aba9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java @@ -70,6 +70,7 @@ final class CargoUtils { Material type = block.getType(); + // TODO: Add designated SlimefunTag return switch (type) { case CHEST, TRAPPED_CHEST, diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java index 216302973..2dd6774ce 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java @@ -137,6 +137,7 @@ public class BlockDataService implements Keyed { return false; } + // TODO: Add designated SlimefunTag return switch (type) { case PLAYER_HEAD, PLAYER_WALL_HEAD, diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java index c15b9e483..b5088ae59 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java @@ -202,6 +202,7 @@ public abstract class AbstractAutoCrafter extends SlimefunItem implements Energy protected boolean isValidInventory(@Nonnull Block block) { Material type = block.getType(); + // TODO: Add designated SlimefunTag return switch (type) { case CHEST, TRAPPED_CHEST, diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java index 6470df750..9fcfd9901 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java @@ -34,17 +34,17 @@ public class MagicWorkbench extends AbstractCraftingTable { @Override public void onInteract(Player p, Block b) { - Block dispenser = locateDispenser(b); + Block possibleDispener = locateDispenser(b); - if (dispenser == null) { + if (possibleDispener == null) { // How even... return; } - BlockState state = PaperLib.getBlockState(dispenser, false).getState(); + BlockState state = PaperLib.getBlockState(possibleDispener, false).getState(); - if (state instanceof Dispenser disp) { - Inventory inv = disp.getInventory(); + if (state instanceof Dispenser dispenser) { + Inventory inv = dispenser.getInventory(); List inputs = RecipeType.getRecipeInputList(this); for (int i = 0; i < inputs.size(); i++) { @@ -52,7 +52,7 @@ public class MagicWorkbench extends AbstractCraftingTable { ItemStack output = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone(); if (SlimefunUtils.canPlayerUseItem(p, output, true)) { - craft(inv, dispenser, p, b, output); + craft(inv, possibleDispener, p, b, output); } return; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java index 7825caf82..8a78b5195 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java @@ -20,9 +20,8 @@ class OreDictionary16 extends OreDictionary14 { @ParametersAreNonnullByDefault public @Nonnull ItemStack getDrops(Material material, Random random) { return switch (material) { - case NETHER_GOLD_ORE -> - // In 1.16, breaking nether gold ores should get gold nuggets - new ItemStack(Material.GOLD_NUGGET, 2 + random.nextInt(4)); + // In 1.16, breaking nether gold ores should get gold nuggets + case NETHER_GOLD_ORE -> new ItemStack(Material.GOLD_NUGGET, 2 + random.nextInt(4)); case ANCIENT_DEBRIS -> new ItemStack(Material.ANCIENT_DEBRIS); default -> super.getDrops(material, random); }; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java index 3059b17c8..16e28fdbe 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java @@ -28,13 +28,13 @@ public class AnvilListener implements SlimefunCraftingListener { @EventHandler(ignoreCancelled = true) public void onAnvil(InventoryClickEvent e) { - if (e.getRawSlot() == 2 && e.getInventory().getType() == InventoryType.ANVIL && e.getWhoClicked() instanceof Player) { + if (e.getRawSlot() == 2 && e.getInventory().getType() == InventoryType.ANVIL && e.getWhoClicked() instanceof Player player) { ItemStack item1 = e.getInventory().getContents()[0]; ItemStack item2 = e.getInventory().getContents()[1]; if (hasUnallowedItems(item1, item2)) { e.setResult(Result.DENY); - Slimefun.getLocalization().sendMessage(e.getWhoClicked(), "anvil.not-working", true); + Slimefun.getLocalization().sendMessage(player, "anvil.not-working", true); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/CartographyTableListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/CartographyTableListener.java index d1cb56ace..1eed58c93 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/CartographyTableListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/CartographyTableListener.java @@ -28,13 +28,13 @@ public class CartographyTableListener implements SlimefunCraftingListener { @EventHandler(ignoreCancelled = true) public void onCartographyTable(InventoryClickEvent e) { - if (e.getRawSlot() == 2 && e.getInventory().getType() == InventoryType.CARTOGRAPHY && e.getWhoClicked() instanceof Player) { + if (e.getRawSlot() == 2 && e.getInventory().getType() == InventoryType.CARTOGRAPHY && e.getWhoClicked() instanceof Player player) { ItemStack item1 = e.getInventory().getContents()[0]; ItemStack item2 = e.getInventory().getContents()[1]; if (hasUnallowedItems(item1, item2)) { e.setResult(Result.DENY); - Slimefun.getLocalization().sendMessage(e.getWhoClicked(), "cartography_table.not-working", true); + Slimefun.getLocalization().sendMessage(player, "cartography_table.not-working", true); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/WitherListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/WitherListener.java index 2cad17a85..4d6b31452 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/WitherListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/WitherListener.java @@ -36,9 +36,9 @@ public class WitherListener implements Listener { SlimefunItem item = BlockStorage.check(e.getBlock()); // Hardened Glass is excluded from here - if (item instanceof WitherProof witherProof && !item.getId().equals(SlimefunItems.HARDENED_GLASS.getItemId())) { + if (item instanceof WitherProof witherProofBlock && !item.getId().equals(SlimefunItems.HARDENED_GLASS.getItemId())) { e.setCancelled(true); - witherProof.onAttack(e.getBlock(), (Wither) e.getEntity()); + witherProofBlock.onAttack(e.getBlock(), (Wither) e.getEntity()); } } } diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java index 5822b8701..3483e5a6e 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/MenuListener.java @@ -50,8 +50,8 @@ public class MenuListener implements Listener { if (handler == null) { e.setCancelled(!menu.isEmptySlotsClickable() && (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)); - } else if (handler instanceof AdvancedMenuClickHandler advancedMenuClickHandler) { - e.setCancelled(!advancedMenuClickHandler.onClick(e, (Player) e.getWhoClicked(), e.getSlot(), e.getCursor(), new ClickAction(e.isRightClick(), e.isShiftClick()))); + } else if (handler instanceof AdvancedMenuClickHandler) { + e.setCancelled(!((AdvancedMenuClickHandler) handler).onClick(e, (Player) e.getWhoClicked(), e.getSlot(), e.getCursor(), new ClickAction(e.isRightClick(), e.isShiftClick()))); } else { e.setCancelled(!handler.onClick((Player) e.getWhoClicked(), e.getSlot(), e.getCurrentItem(), new ClickAction(e.isRightClick(), e.isShiftClick()))); }