diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java index 10a1694dc..4cbefc2d9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java @@ -124,8 +124,8 @@ public class RecipeType implements Keyed { } else { SlimefunItem slimefunItem = SlimefunItem.getById(this.machine); - if (slimefunItem instanceof MultiBlockMachine multiBlockMachine) { - multiBlockMachine.addRecipe(recipe, result); + if (slimefunItem instanceof MultiBlockMachine mbm) { + mbm.addRecipe(recipe, result); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java index d1580b93f..4b5717a7a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java @@ -80,8 +80,7 @@ public abstract class SubCommand { * * @return A possibly localized description of this {@link SubCommand} */ - @Nonnull - public String getDescription(@Nonnull CommandSender sender) { + public @Nonnull String getDescription(@Nonnull CommandSender sender) { if (sender instanceof Player player) { return Slimefun.getLocalization().getMessage(player, getDescription()); } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java index 32bd4136d..eb1ee277c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java @@ -103,10 +103,10 @@ public class EnergyNet extends Network implements HologramOwner { consumers.put(l, component); break; case GENERATOR: - if (component instanceof EnergyNetProvider energyNetProvider) { - generators.put(l, energyNetProvider); - } else if (component instanceof SlimefunItem slimefunItem) { - slimefunItem.warn("This Item is marked as a GENERATOR but does not implement the interface EnergyNetProvider!"); + if (component instanceof EnergyNetProvider provider) { + generators.put(l, provider); + } else if (component instanceof SlimefunItem item) { + item.warn("This Item is marked as a GENERATOR but does not implement the interface EnergyNetProvider!"); } break; default: @@ -272,8 +272,8 @@ public class EnergyNet extends Network implements HologramOwner { private static EnergyNetComponent getComponent(@Nonnull Location l) { SlimefunItem item = BlockStorage.check(l); - if (item instanceof EnergyNetComponent energyNetComponent) { - return energyNetComponent; + if (item instanceof EnergyNetComponent component) { + return component; } return null; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/AbstractMonsterSpawner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/AbstractMonsterSpawner.java index ee06f9ae3..d0c24310f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/AbstractMonsterSpawner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/AbstractMonsterSpawner.java @@ -86,8 +86,8 @@ public abstract class AbstractMonsterSpawner extends SlimefunItem { if (meta instanceof BlockStateMeta stateMeta) { BlockState state = stateMeta.getBlockState(); - if (state instanceof CreatureSpawner creatureSpawner) { - creatureSpawner.setSpawnedType(type); + if (state instanceof CreatureSpawner spawner) { + spawner.setSpawnedType(type); } stateMeta.setBlockState(state); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java index 37bbf2fc2..9cb402263 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java @@ -67,8 +67,8 @@ public class EnhancedCraftingTable extends AbstractCraftingTable { if (outputInv != null) { SlimefunItem sfItem = SlimefunItem.getByItem(output); - if (sfItem instanceof SlimefunBackpack slimefunBackpack) { - upgradeBackpack(p, inv, slimefunBackpack, output); + if (sfItem instanceof SlimefunBackpack backpack) { + upgradeBackpack(p, inv, backpack, output); } for (int j = 0; j < 9; j++) { 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 9fcfd9901..9a306b0c0 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 @@ -75,8 +75,8 @@ public class MagicWorkbench extends AbstractCraftingTable { if (outputInv != null) { SlimefunItem sfItem = SlimefunItem.getByItem(output); - if (sfItem instanceof SlimefunBackpack slimefunBackpack) { - upgradeBackpack(p, inv, slimefunBackpack, output); + if (sfItem instanceof SlimefunBackpack backpack) { + upgradeBackpack(p, inv, backpack, output); } for (int j = 0; j < 9; j++) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java index a6807f1ed..7260828b1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java @@ -64,7 +64,7 @@ public class TeleporterListener implements Listener { // Pressure plate was an elevator ElevatorPlate elevator = SlimefunItems.ELEVATOR_PLATE.getItem(ElevatorPlate.class); elevator.openInterface(p, b); - } else if (item instanceof AbstractTeleporterPlate abstractTeleporterPlate && abstractTeleporterPlate.hasAccess(p, b)) { + } else if (item instanceof AbstractTeleporterPlate teleporterPlate && teleporterPlate.hasAccess(p, b)) { // Pressure plate was a teleporter SlimefunItem teleporter = BlockStorage.check(b.getRelative(BlockFace.DOWN)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java index a15fdad7f..9091db07b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java @@ -132,8 +132,8 @@ public final class ItemStackWrapper extends ItemStack { public static @Nonnull ItemStackWrapper wrap(@Nonnull ItemStack itemStack) { Validate.notNull(itemStack, "The ItemStack cannot be null!"); - if (itemStack instanceof ItemStackWrapper itemStackWrapper) { - return itemStackWrapper; + if (itemStack instanceof ItemStackWrapper wrapper) { + return wrapper; } return new ItemStackWrapper(itemStack); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/TagParser.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/TagParser.java index fe8901812..76ef46364 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/TagParser.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/TagParser.java @@ -106,7 +106,7 @@ public class TagParser implements Keyed { JsonArray values = child.getAsJsonArray(); for (JsonElement element : values) { - if (element instanceof JsonPrimitive jsonPrimitive && jsonPrimitive.isString()) { + if (element instanceof JsonPrimitive primitive && primitive.isString()) { // Strings will be parsed directly parsePrimitiveValue(element.getAsString(), materials, tags, true); } else if (element instanceof JsonObject) {