From c7ac8040aea586bde2446b1e4d644780c4d95e8f Mon Sep 17 00:00:00 2001 From: mcchampions <1309635304@qq.com> Date: Sat, 30 Nov 2024 20:58:05 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BlockDataController.java | 8 ++++---- .../core/commands/SlimefunTabCompleter.java | 18 +++++++++--------- .../commands/subcommands/BlockDataCommand.java | 4 ++-- .../commands/subcommands/ClearDataCommand.java | 10 +++++----- .../commands/subcommands/ResearchCommand.java | 4 ++-- .../core/services/PermissionsService.java | 4 ++-- .../slimefun4/implementation/Slimefun.java | 2 +- .../items/cargo/AbstractFilterNode.java | 2 +- .../items/magical/KnowledgeTome.java | 2 +- .../items/tools/ExplosiveTool.java | 6 +++--- .../listeners/AncientAltarListener.java | 11 ++++++----- .../listeners/BlockListener.java | 3 ++- .../listeners/SlimefunBootsListener.java | 2 +- .../implementation/setup/PostSetup.java | 2 +- .../slimefun4/utils/ChargeUtils.java | 4 ++-- .../slimefun4/utils/SlimefunUtils.java | 4 ++-- .../me/qscbm/slimefun4/helper/ItemHelper.java | 2 +- .../listeners/AsyncTabCompleteListener.java | 4 ++-- .../HighVersionEventsConstructor.java | 2 +- 19 files changed, 48 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java index a3882afb03..f53b5ee0b3 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java @@ -326,7 +326,7 @@ public void removeBlock(Location l) { } if (Slimefun.getRegistry().getTickerBlocks().contains(removed.getSfId())) { - if (removed.getSfId().equalsIgnoreCase("CARGO_MANAGER")) { + if ("CARGO_MANAGER".equalsIgnoreCase(removed.getSfId())) { Slimefun.instance().getCargoTickerTask().enableTicker(l); } else { Slimefun.getTickerTask().enableTicker(l); @@ -550,7 +550,7 @@ public void setBlockDataLocation(SlimefunBlockData blockData, Location target) { var hasTicker = false; if (blockData.isDataLoaded() && Slimefun.getRegistry().getTickerBlocks().contains(blockData.getSfId())) { - if (blockData.getSfId().equalsIgnoreCase("CARGO_MANAGER")) { + if ("CARGO_MANAGER".equalsIgnoreCase(blockData.getSfId())) { Slimefun.instance().getCargoTickerTask().disableTicker(blockData.getLocation()); } else { Slimefun.getTickerTask().disableTicker(blockData.getLocation()); @@ -611,7 +611,7 @@ public void setBlockDataLocation(SlimefunBlockData blockData, Location target) { scheduleWriteTask(scopeKey, key, data, true); if (hasTicker) { - if (blockData.getSfId().equalsIgnoreCase("CARGO_MANAGER")) { + if ("CARGO_MANAGER".equalsIgnoreCase(blockData.getSfId())) { Slimefun.instance().getCargoTickerTask().enableTicker(target); } else { Slimefun.getTickerTask().enableTicker(target); @@ -1280,7 +1280,7 @@ private void deleteChunkAndBlockDataDirectly(String cKey) { private void clearBlockCacheAndTasks(SlimefunBlockData blockData) { var l = blockData.getLocation(); if (blockData.isDataLoaded() && Slimefun.getRegistry().getTickerBlocks().contains(blockData.getSfId())) { - if (blockData.getSfId().equalsIgnoreCase("CARGO_MANAGER")) { + if ("CARGO_MANAGER".equalsIgnoreCase(blockData.getSfId())) { Slimefun.instance().getCargoTickerTask().disableTicker(blockData.getLocation()); } else { Slimefun.getTickerTask().disableTicker(blockData.getLocation()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java index 68bc8b6493..8f19bde197 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java @@ -25,31 +25,31 @@ public static List onTabComplete(List args) { } case 2 -> { String param = args.get(0); - if (param.equalsIgnoreCase("banitem")) { + if ("banitem".equalsIgnoreCase(param)) { return createReturnList(getSlimefunItems(), args.get(1)); } - if (param.equalsIgnoreCase("unbanitem")) { + if ("unbanitem".equalsIgnoreCase(param)) { Set set = Slimefun.getRegistry().getDisabledSlimefunItemsToSet().stream() .map(SlimefunItem::getItemNormalName) .collect(Collectors.toSet()); return createReturnList(set, args.get(1)); } - if (param.equalsIgnoreCase("cleardata")) { + if ("cleardata".equalsIgnoreCase(param)) { Set set = Bukkit.getWorlds().stream().map(WorldInfo::getName).collect(Collectors.toSet()); set.add("*"); return createReturnList(set, args.get(1)); } - if (param.equalsIgnoreCase("calc")) { + if ("calc".equalsIgnoreCase(param)) { return createReturnList(getSlimefunItems(), args.get(1)); } return getPlayerList(args.get(1)); } case 3 -> { String param = args.get(0); - if (param.equalsIgnoreCase("give")) { + if ("give".equalsIgnoreCase(param)) { return createReturnList(getSlimefunItems(), args.get(2)); } - if (param.equalsIgnoreCase("research")) { + if ("research".equalsIgnoreCase(param)) { List researches = Slimefun.getRegistry().getResearches(); Set suggestions = new HashSet<>(); @@ -62,17 +62,17 @@ public static List onTabComplete(List args) { return createReturnList(suggestions, args.get(2)); } - if (param.equalsIgnoreCase("cleardata")) { + if ("cleardata".equalsIgnoreCase(param)) { return createReturnList(Arrays.asList("block", "oil", "*"), args.get(2)); } - if (param.equalsIgnoreCase("calc")) { + if ("calc".equalsIgnoreCase(param)) { return createReturnList(COUNT_LIST, args.get(2)); } return Collections.emptyList(); } case 4 -> { - if (args.get(0).equalsIgnoreCase("give")) { + if ("give".equalsIgnoreCase(args.get(0))) { return createReturnList(COUNT_LIST, args.get(3)); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BlockDataCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BlockDataCommand.java index 47300a85db..d80cb3837e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BlockDataCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BlockDataCommand.java @@ -75,7 +75,7 @@ public void onExecute(CommandSender sender, String[] args) { return; } - if (key.equalsIgnoreCase("id")) { + if ("id".equalsIgnoreCase(key)) { ChatUtils.sendMessage(player, "&c你不能修改方块的 ID!"); return; } @@ -87,7 +87,7 @@ public void onExecute(CommandSender sender, String[] args) { .replace("%value%", value)); } case "remove" -> { - if (key.equalsIgnoreCase("id")) { + if ("id".equalsIgnoreCase(key)) { ChatUtils.sendMessage(player, "&c你不能修改方块的 ID!"); return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java index 1c62a3f0b8..c5f0344e13 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java @@ -30,7 +30,7 @@ public void onExecute(CommandSender sender, String[] args) { Slimefun.getLocalization().sendMessage(sender, "commands.cleardata.confirm", true); return; } - if (args.length < 3 || !args[3].equalsIgnoreCase("confirm")) { + if (args.length < 3 || !"confirm".equalsIgnoreCase(args[3])) { Slimefun.getLocalization() .sendMessage( sender, @@ -44,7 +44,7 @@ public void onExecute(CommandSender sender, String[] args) { String block = Slimefun.getLocalization().getMessage("commands.cleardata.block"); String oil = Slimefun.getLocalization().getMessage("commands.cleardata.oil"); BlockDataController controller = Slimefun.getDatabaseManager().getBlockDataController(); - if (args[1].equals("*")) { + if ("*".equals(args[1])) { worlds.addAll(Bukkit.getWorlds()); } else { World toAdd = Bukkit.getWorld(args[1]); @@ -54,7 +54,7 @@ public void onExecute(CommandSender sender, String[] args) { } } - if (args[2].equals("*")) { + if ("*".equals(args[2])) { clearTypes.addAll(ValidClearTypes); } else if (ValidClearTypes.contains(args[2])) { clearTypes.add(args[2]); @@ -62,7 +62,7 @@ public void onExecute(CommandSender sender, String[] args) { for (World world : worlds) { for (String cleartype : clearTypes) { - if (cleartype.equals("block")) { + if ("block".equals(cleartype)) { controller.removeAllDataInWorldAsync( world, () -> Slimefun.runSync(() -> Slimefun.getLocalization() @@ -71,7 +71,7 @@ public void onExecute(CommandSender sender, String[] args) { .replace("{1}", block)))); continue; } - if (cleartype.equals("oil")) { + if ("oil".equals(cleartype)) { GEOResource oilresource = null; for (GEOResource resource : Slimefun.getRegistry().getGEOResources().values()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java index ee8e52e99c..74e0cdb228 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java @@ -63,11 +63,11 @@ public void onExecute(CommandSender sender, String[] args) { // Getting the PlayerProfile async PlayerProfile.get(p, profile -> { - if (args[2].equalsIgnoreCase("all")) { + if ("all".equalsIgnoreCase(args[2])) { researchAll(sender, profile, p); return; } - if (args[2].equalsIgnoreCase("reset")) { + if ("reset".equalsIgnoreCase(args[2])) { reset(profile, p); return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java index ef364fddf2..abdcd56c0f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java @@ -92,7 +92,7 @@ public boolean hasPermission(Permissible p, SlimefunItem item) { } String permission = permissions.get(item.getId()); - return permission == null || permission.equals("none") || p.hasPermission(permission); + return permission == null || "none".equals(permission) || p.hasPermission(permission); } /** @@ -109,7 +109,7 @@ public boolean hasPermission(Permissible p, SlimefunItem item) { public Optional getPermission(SlimefunItem item) { String permission = permissions.get(item.getId()); - if (permission == null || permission.equals("none")) { + if (permission == null || "none".equals(permission)) { return Optional.empty(); } else { return Optional.of(permission); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java index 647af805ed..366fdc4976 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java @@ -246,7 +246,7 @@ private void onPluginStart() { config.getBoolean("networks.enable-visualizer"), config.getBoolean("networks.delete-excess-items")); // load language cache - LanguageService.get().load(); + LanguageService.load(); // Registering all GEO Resources logger.log(Level.INFO, "加载矿物资源..."); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractFilterNode.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractFilterNode.java index 8bd1bfd41a..4a3dd42752 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractFilterNode.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractFilterNode.java @@ -95,7 +95,7 @@ protected void updateBlockMenu(BlockMenu menu, Block b) { SlimefunBlockData blockData = StorageCacheUtils.getBlock(b.getLocation()); String filterType = blockData.getData(FILTER_TYPE); - if (filterType == null || filterType.equals("whitelist")) { + if (filterType == null || "whitelist".equals(filterType)) { menu.replaceExistingItem(15, new CustomItemStack(Material.WHITE_WOOL, "&7模式: &r白名单", "", "&e> 单击切换至黑名单")); menu.addMenuClickHandler(15, (p, slot, item, action) -> { StorageCacheUtils.setData(b.getLocation(), FILTER_TYPE, "blacklist"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/KnowledgeTome.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/KnowledgeTome.java index 608b9f979c..17e64f315f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/KnowledgeTome.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/KnowledgeTome.java @@ -50,7 +50,7 @@ public ItemUseHandler getItemHandler() { if (!(fc instanceof TextComponent firstComponent)) return; List list = firstComponent.children(); - if (list.size() >= 2 && ((TextComponent) list.get(1)).content().equals("None")) { + if (list.size() >= 2 && "None".equals(((TextComponent) list.get(1)).content())) { lore.set(0, new QsTextComponentImpl("主人: ").color(NamedTextColor.GRAY) .append(new QsTextComponentImpl(p.getName()).color(NamedTextColor.GRAY))); lore.set(1, new QsTextComponentImpl(p.getUniqueId().toString()).color(NamedTextColor.BLACK)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java index 359ef7fe97..3748aa0250 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java @@ -91,8 +91,8 @@ private void breakBlocks( */ if (Bukkit.getPluginManager().isPluginEnabled("ExoticGarden")) { blocksToDestroy.sort((block1, block2) -> Boolean.compare( - block2.getType().equals(Material.PLAYER_HEAD), - block1.getType().equals(Material.PLAYER_HEAD))); + block2.getType() == Material.PLAYER_HEAD, + block1.getType() == Material.PLAYER_HEAD)); } if (!event.isCancelled()) { @@ -174,7 +174,7 @@ private void breakBlock(BlockBreakEvent event, Player player, ItemStack item, Bl * 若为叶子则尝试获取该处的 SlimefunItem,若能获取得到则此处应为异域花园植物,将叶子处直接设置为 AIR 并移除该处 Slimefun 方块数据。 */ if (Bukkit.getPluginManager().isPluginEnabled("ExoticGarden") - && block.getType().equals(Material.PLAYER_HEAD)) { + && block.getType() == Material.PLAYER_HEAD) { Location leavesLocation = blockLocation.clone(); leavesLocation.setY(leavesLocation.getY() - 1); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index f1544b5151..2a2466f320 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -12,6 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AltarRecipe; import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar; import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal; +import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.AbstractMonsterSpawner; import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.RepairedSpawner; import io.github.thebusybiscuit.slimefun4.implementation.tasks.AncientAltarTask; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; @@ -119,7 +120,7 @@ private void usePedestal(Block pedestal, Player p) { } // getting the currently placed item - Optional stack = pedestalItem.getPlacedItem(pedestal); + Optional stack = AncientPedestal.getPlacedItem(pedestal); if (stack.isEmpty()) { // Check if the Item in hand is valid @@ -149,7 +150,7 @@ private void usePedestal(Block pedestal, Player p) { * no stack space left else add remaining items from the returned map value */ Map remainingItemMap = - p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); + p.getInventory().addItem(AncientPedestal.getOriginalItemStack(entity)); for (ItemStack item : remainingItemMap.values()) { p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), item.clone()); @@ -204,9 +205,9 @@ private void startRitual(Player p, Block b, List pedestals, ItemStack cat List input = new ArrayList<>(); for (Block pedestal : pedestals) { - Optional stack = pedestalItem.getPlacedItem(pedestal); + Optional stack = AncientPedestal.getPlacedItem(pedestal); - stack.ifPresent(item -> input.add(pedestalItem.getOriginalItemStack(item))); + stack.ifPresent(item -> input.add(AncientPedestal.getOriginalItemStack(item))); } Optional result = getRecipeOutput(catalyst, input); @@ -315,7 +316,7 @@ public Optional getRecipeOutput(ItemStack catalyst, List i RepairedSpawner spawner = (RepairedSpawner) SlimefunItems.REPAIRED_SPAWNER.getItem(); return Optional.of( - spawner.getItemForEntityType(spawner.getEntityType(wrapper).orElse(EntityType.PIG))); + spawner.getItemForEntityType(AbstractMonsterSpawner.getEntityType(wrapper).orElse(EntityType.PIG))); } return checkRecipe(wrapper, items); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index 235b6e38ad..46054df525 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -15,6 +15,7 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler; import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler; import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler; +import io.github.thebusybiscuit.slimefun4.core.services.BlockDataService; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; @@ -135,7 +136,7 @@ public void onBlockPlace(BlockPlaceEvent e) { if (placeEvent.isCancelled()) { e.setCancelled(true); } else { - if (Slimefun.getBlockDataService().isTileEntity(block.getType())) { + if (BlockDataService.isTileEntity(block.getType())) { Slimefun.getBlockDataService().setBlockData(block, sfItem.getId()); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java index 456548589d..33e518b8ea 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java @@ -65,7 +65,7 @@ private void onFallDamage(EntityDamageEvent e) { if (boots instanceof StomperBoots stomperBoots) { e.setCancelled(true); - stomperBoots.stomp(e); + StomperBoots.stomp(e); } else if (boots instanceof LongFallBoots longFallBoots) { e.setCancelled(true); longFallBoots.getSoundEffect().playAt(p.getLocation(), SoundCategory.PLAYERS); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java index 20918aab5e..186ca285da 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java @@ -172,7 +172,7 @@ private static void loadSmelteryRecipes() { for (SlimefunItem item : Slimefun.getRegistry().getEnabledSlimefunItems()) { if (item instanceof AContainer machine) { - if (machine.getMachineIdentifier().equals("ELECTRIC_SMELTERY")) { + if ("ELECTRIC_SMELTERY".equals(machine.getMachineIdentifier())) { List recipes = machine.getMachineRecipes(); recipes.sort(Comparator.comparingInt(recipe -> recipe == null ? 0 : -recipe.getInput().length)); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChargeUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChargeUtils.java index bc435db580..7924ba3beb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChargeUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChargeUtils.java @@ -53,7 +53,7 @@ public static void setCharge(ItemMeta meta, float charge, float capacity) { for (int i = 0; i < lore.size(); i++) { Component line = lore.get(i); if (line instanceof TextComponent c) { - if (c.content().equals("\u21E8")) { + if ("\u21E8".equals(c.content())) { List children = c.children(); if (children.size() < 2) { continue; @@ -73,7 +73,7 @@ public static void setCharge(ItemMeta meta, float charge, float capacity) { } TextComponent fc = (TextComponent) children.get(0); - if (fc.content().equals("\u21E8 ")) { + if ("\u21E8 ".equals(fc.content())) { TextComponent tc = (TextComponent) children.get(2); String content = tc.content(); if (REGEX_NEW.matcher(content).matches()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java index c97bdcc4a7..27c32e55c9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java @@ -419,9 +419,9 @@ private static boolean equalsItemMeta(ItemMeta itemMeta, ItemMeta sfitemMeta, bo //noinspection ConstantValue return potionMeta.getBasePotionType() != null && sfPotionMeta.getBasePotionType() != null - && potionMeta.getBasePotionType().equals(sfPotionMeta.getBasePotionType()); + && potionMeta.getBasePotionType() == sfPotionMeta.getBasePotionType(); } else if (SlimefunExtended.getMinecraftVersion().isAtLeast(1, 20, 2)) { - return potionMeta.getBasePotionType().equals(sfPotionMeta.getBasePotionType()); + return potionMeta.getBasePotionType() == sfPotionMeta.getBasePotionType(); } else { //noinspection deprecation return potionMeta.getBasePotionData().equals(sfPotionMeta.getBasePotionData()); diff --git a/src/main/java/me/qscbm/slimefun4/helper/ItemHelper.java b/src/main/java/me/qscbm/slimefun4/helper/ItemHelper.java index 2119802cc9..10de9679ea 100644 --- a/src/main/java/me/qscbm/slimefun4/helper/ItemHelper.java +++ b/src/main/java/me/qscbm/slimefun4/helper/ItemHelper.java @@ -38,7 +38,7 @@ public static String getItemName(ItemStack stack) { } String type = wrapper.getType().name().toLowerCase(Locale.ROOT); - if (type.contains("potion") || type.equals("tipped_arrow")) { + if (type.contains("potion") || "tipped_arrow".equals(type)) { //noinspection deprecation String potion = ((PotionMeta) (meta == null ? stack.getItemMeta() : meta)) .getBasePotionData().getType().toString().toLowerCase(); diff --git a/src/main/java/me/qscbm/slimefun4/listeners/AsyncTabCompleteListener.java b/src/main/java/me/qscbm/slimefun4/listeners/AsyncTabCompleteListener.java index f05f5c4207..6c310a5a76 100644 --- a/src/main/java/me/qscbm/slimefun4/listeners/AsyncTabCompleteListener.java +++ b/src/main/java/me/qscbm/slimefun4/listeners/AsyncTabCompleteListener.java @@ -31,12 +31,12 @@ public static void onAsyncTabCompleteEvent(AsyncTabCompleteEvent e) { String commandLabel = buffer.substring(0, firstPlace).toLowerCase(); String[] parts = commandLabel.split(":"); if (parts.length > 1) { - if (!parts[0].equals("slimefun")) { + if (!"slimefun".equals(parts[0])) { return; } commandLabel = parts[1]; } - if (!SlimefunCommand.COMMAND_ALIASES.contains(commandLabel) && !commandLabel.equals("slimefun")) { + if (!SlimefunCommand.COMMAND_ALIASES.contains(commandLabel) && !"slimefun".equals(commandLabel)) { return; } List args = new QuotedStringTokenizer(buffer.substring(firstPlace + 1)).tokenize(false); diff --git a/src/main/java/me/qscbm/slimefun4/utils/compatibillty/HighVersionEventsConstructor.java b/src/main/java/me/qscbm/slimefun4/utils/compatibillty/HighVersionEventsConstructor.java index fbd6ada1d4..888bccfaa1 100644 --- a/src/main/java/me/qscbm/slimefun4/utils/compatibillty/HighVersionEventsConstructor.java +++ b/src/main/java/me/qscbm/slimefun4/utils/compatibillty/HighVersionEventsConstructor.java @@ -32,7 +32,7 @@ public HighVersionEventsConstructor() { Enum[] enums = explosionResultClass.getEnumConstants(); for (Enum field : enums) { - if (field.name().equalsIgnoreCase("destroy")) { + if ("destroy".equalsIgnoreCase(field.name())) { destroyEnum = field; break; }