From 94c4979780e63bb017411702842e0c507ca52d78 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 20 Dec 2025 09:52:29 +0000 Subject: [PATCH] Changes to improve code per IntelliJ --- build.gradle.kts | 18 ++++----- .../java/world/bentobox/bentobox/BStats.java | 2 +- .../world/bentobox/bentobox/BentoBox.java | 20 ++-------- .../bentobox/api/addons/AddonClassLoader.java | 2 +- .../bentobox/api/addons/package-info.java | 6 +-- .../api/commands/island/IslandGoCommand.java | 2 +- .../island/team/IslandTeamPromoteCommand.java | 2 +- .../bentobox/api/commands/package-info.java | 4 +- .../api/configuration/ConfigObject.java | 5 --- .../bentobox/api/events/package-info.java | 4 +- .../bentobox/bentobox/api/package-info.java | 2 +- .../api/panels/reader/ItemTemplateRecord.java | 40 +++++++++---------- .../blueprints/BlueprintClipboard.java | 16 +++----- .../bentobox/blueprints/BlueprintPaster.java | 28 ++++++------- .../bentobox/blueprints/DisplayListener.java | 5 +-- .../commands/BentoBoxRankCommand.java | 2 +- .../bentobox/bentobox/database/Database.java | 2 +- .../bentobox/database/objects/Island.java | 2 +- .../bentobox/hooks/ZNPCsPlusHook.java | 4 +- .../bentobox/listeners/JoinLeaveListener.java | 2 +- .../teleports/AbstractTeleportListener.java | 4 +- .../bentobox/managers/AddonsManager.java | 2 +- .../world/bentobox/bentobox/package-info.java | 4 +- .../world/bentobox/bentobox/util/Util.java | 4 +- .../bentobox/util/heads/HeadGetter.java | 1 - .../bentobox/bentobox/util/package-info.java | 2 +- 26 files changed, 79 insertions(+), 106 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3d40ac8db..86c4ec80d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -283,15 +283,15 @@ tasks.processResources { // This allows version info to be read at runtime by the plugin filesMatching(listOf("plugin.yml", "config.yml")) { filter { line -> - line.replace("\${mysql.version}", mysqlVersion) - .replace("\${mariadb.version}", mariadbVersion) - .replace("\${postgresql.version}", postgresqlVersion) - .replace("\${mongodb.version}", mongodbVersion) - .replace("\${hikaricp.version}", hikaricpVersion) - .replace("\${build.number}", finalBuildNumber) - .replace("\${project.version}", project.version.toString()) - .replace("\${project.description}", project.description ?: "") - .replace("\${revision}", project.version.toString()) + line.replace($$"${mysql.version}", mysqlVersion) + .replace($$"${mariadb.version}", mariadbVersion) + .replace($$"${postgresql.version}", postgresqlVersion) + .replace($$"${mongodb.version}", mongodbVersion) + .replace($$"${hikaricp.version}", hikaricpVersion) + .replace($$"${build.number}", finalBuildNumber) + .replace($$"${project.version}", project.version.toString()) + .replace($$"${project.description}", project.description ?: "") + .replace($$"${revision}", project.version.toString()) } } diff --git a/src/main/java/world/bentobox/bentobox/BStats.java b/src/main/java/world/bentobox/bentobox/BStats.java index 12efe7865..86523e50b 100644 --- a/src/main/java/world/bentobox/bentobox/BStats.java +++ b/src/main/java/world/bentobox/bentobox/BStats.java @@ -157,7 +157,7 @@ private void registerPlayersPerServerChart() { int players = this.connectedPlayerSet.size(); this.connectedPlayerSet.clear(); - if (players <= 0) return "0"; + if (players == 0) return "0"; else if (players <= 10) return "1-10"; else if (players <= 30) return "11-30"; else if (players <= 50) return "31-50"; diff --git a/src/main/java/world/bentobox/bentobox/BentoBox.java b/src/main/java/world/bentobox/bentobox/BentoBox.java index e43fc26f0..0c93ef513 100644 --- a/src/main/java/world/bentobox/bentobox/BentoBox.java +++ b/src/main/java/world/bentobox/bentobox/BentoBox.java @@ -9,9 +9,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils; import org.bukkit.Bukkit; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -151,7 +149,7 @@ public void onEnable(){ saveConfig(); // Set up click timeout - lastClick = new ExpiringMap, Boolean>(getSettings().getClickCooldownMs(), TimeUnit.MILLISECONDS); + lastClick = new ExpiringMap<>(getSettings().getClickCooldownMs(), TimeUnit.MILLISECONDS); // Start Database managers playersManager = new PlayersManager(this); @@ -376,18 +374,6 @@ public void onDisable() { } - @EventHandler - public void onServerStop(ServerCommandEvent e) { - /* This is no longer needed as with https://github.com/Multiverse/Multiverse-Core/releases/tag/4.3.12 (or maybe earlier) the issue - * is fixed where the generator was not remembered across reboots. - */ - /* - if (islandWorldManager != null && (e.getCommand().equalsIgnoreCase("stop") || e.getCommand().equalsIgnoreCase("restart"))) { - // Unregister any MV worlds if () { - //islandWorldManager.registerWorldsToMultiverse(false); - }*/ - } - /** * Returns the player manager * @return the player manager @@ -675,11 +661,11 @@ public boolean isShutdown() { * @return false if they can click and the timeout is started, otherwise true. */ public boolean onTimeout(User user, Panel panel) { - if (lastClick.containsKey(new Pair(user.getUniqueId(), panel.getName()))) { + if (lastClick.containsKey(new Pair<>(user.getUniqueId(), panel.getName()))) { user.notify("general.errors.slow-down"); return true; } - lastClick.put(new Pair(user.getUniqueId(), panel.getName()), true); + lastClick.put(new Pair<>(user.getUniqueId(), panel.getName()), true); return false; } } diff --git a/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java b/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java index bb9c1d665..33121fa31 100644 --- a/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java +++ b/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java @@ -31,7 +31,7 @@ * Each addon is loaded with its own {@link AddonClassLoader}, which allows for * class isolation and management. This loader also facilitates inter-addon * class sharing by coordinating with the {@link AddonsManager}. - * + *

* This approach is now rarely used as most addons are now Plugin-based and so are loaded by the server as plugins. * * @author tastybento, ComminQ diff --git a/src/main/java/world/bentobox/bentobox/api/addons/package-info.java b/src/main/java/world/bentobox/bentobox/api/addons/package-info.java index abf00000b..c0dade887 100644 --- a/src/main/java/world/bentobox/bentobox/api/addons/package-info.java +++ b/src/main/java/world/bentobox/bentobox/api/addons/package-info.java @@ -1,15 +1,15 @@ /** * This package contains classes and interfaces related to BentoBox addons. - * + *

* Addons are modular extensions that enhance BentoBox functionality. Game-specific * addons (e.g., BSkyBlock, AcidIsland) as well as generic addons (e.g., Challenges, Warps) * are supported by this system. Developers can create custom addons to introduce * new features or gamemodes. - * + *

* Since BentoBox was created, server tech has changed and code remapping is done and that * is usually only applied when a Plugin is loaded, so developers should use Pladdons * which are a wrapper for Addons in a Plugin. - * + *

* Key components: * - AddonLoader: Manages the lifecycle of addons. * - AddonConfig: Handles addon-specific configurations. diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java index 7345dd0cb..0c01cbfc8 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java @@ -154,7 +154,7 @@ private boolean checkReserved(User user, List islands) { @Override public Optional> tabComplete(User user, String alias, List args) { - String lastArg = !args.isEmpty() ? args.get(args.size()-1) : ""; + String lastArg = !args.isEmpty() ? args.getLast() : ""; return Optional.of(Util.tabLimit(new ArrayList<>(getNameIslandMap(user, getWorld()).keySet()), lastArg)); diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamPromoteCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamPromoteCommand.java index 79fb4452a..fe83ca8be 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamPromoteCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamPromoteCommand.java @@ -141,7 +141,7 @@ public boolean execute(User user, String label, List args) { * - Must be at least member rank * For demotion: * - Decreases rank but not below member - * + *

* Fires IslandEvent.Reason.RANK_CHANGE on success * * @param user command issuer diff --git a/src/main/java/world/bentobox/bentobox/api/commands/package-info.java b/src/main/java/world/bentobox/bentobox/api/commands/package-info.java index 2c2306515..5bc2cf3f6 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/package-info.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/package-info.java @@ -1,6 +1,6 @@ /** * This package contains classes and handlers for BentoBox commands. - * + *

* Commands allow players and administrators to interact with BentoBox, including * managing islands, settings, and other in-game features. This package ensures * smooth integration and execution of commands within the plugin. @@ -15,7 +15,7 @@ * their own custom help if required, but most of the time it is not. *

* @author tastybento - * + *

* Key features: * - Command registration and parsing. * - Support for custom addon-specific commands. diff --git a/src/main/java/world/bentobox/bentobox/api/configuration/ConfigObject.java b/src/main/java/world/bentobox/bentobox/api/configuration/ConfigObject.java index ecbc1ffe7..d010acad2 100644 --- a/src/main/java/world/bentobox/bentobox/api/configuration/ConfigObject.java +++ b/src/main/java/world/bentobox/bentobox/api/configuration/ConfigObject.java @@ -10,11 +10,6 @@ */ public interface ConfigObject extends DataObject { - @Override - default BentoBox getPlugin() { - return BentoBox.getInstance(); - } - /** * @return the uniqueId */ diff --git a/src/main/java/world/bentobox/bentobox/api/events/package-info.java b/src/main/java/world/bentobox/bentobox/api/events/package-info.java index 8709a133b..1f9360400 100644 --- a/src/main/java/world/bentobox/bentobox/api/events/package-info.java +++ b/src/main/java/world/bentobox/bentobox/api/events/package-info.java @@ -1,10 +1,10 @@ /** * This package defines events used within the BentoBox framework. - * + *

* Events are triggered during key gameplay actions, such as island creation, * deletion, or player interactions. Developers can use these events to customize * behaviors or respond to actions in their addons. - * + *

* Key features: * - Custom event classes (e.g., IslandCreateEvent, PlayerJoinEvent). * - Integration with Bukkit's event system. diff --git a/src/main/java/world/bentobox/bentobox/api/package-info.java b/src/main/java/world/bentobox/bentobox/api/package-info.java index 19f31387b..90630cf6c 100644 --- a/src/main/java/world/bentobox/bentobox/api/package-info.java +++ b/src/main/java/world/bentobox/bentobox/api/package-info.java @@ -1,6 +1,6 @@ /** * This package provides the core API for interacting with the BentoBox framework. - * + *

* It enables developers to integrate their custom plugins or addons with BentoBox, * offering simplified access to common functionalities like: * - Island management (creation, deletion, permissions). diff --git a/src/main/java/world/bentobox/bentobox/api/panels/reader/ItemTemplateRecord.java b/src/main/java/world/bentobox/bentobox/api/panels/reader/ItemTemplateRecord.java index 85b1ef2fd..6c5154377 100644 --- a/src/main/java/world/bentobox/bentobox/api/panels/reader/ItemTemplateRecord.java +++ b/src/main/java/world/bentobox/bentobox/api/panels/reader/ItemTemplateRecord.java @@ -28,28 +28,28 @@ * @since 1.17.3 */ public record ItemTemplateRecord( - /** - * ItemStack of the Item + /* + ItemStack of the Item */ @Nullable ItemStack icon, - /** - * Title of the item + /* + Title of the item */ @Nullable String title, - /** - * Lore message of the item + /* + Lore message of the item */ @Nullable String description, - /** - * List of Actions for a button + /* + List of Actions for a button */ @NonNull List actions, - /** - * DataMap that links additional objects for a button. + /* + DataMap that links additional objects for a button. */ @NonNull Map dataMap, - /** - * FallBack item if current one is not possible to generate. + /* + FallBack item if current one is not possible to generate. */ @Nullable ItemTemplateRecord fallback) { @@ -96,20 +96,20 @@ public void addAction(ActionRecords actionData) { * @param tooltip the tooltip of action */ public record ActionRecords( - /** - * the click type + /* + the click type */ ClickType clickType, - /** - * the string that represents action type + /* + the string that represents action type */ String actionType, - /** - * the content of the action + /* + the content of the action */ String content, - /** - * the tooltip of action + /* + the tooltip of action */ String tooltip) { } diff --git a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java index 4d7e093fc..c3f649476 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java @@ -71,9 +71,9 @@ public class BlueprintClipboard { private final Map bpAttachable = new LinkedHashMap<>(); private final Map bpBlocks = new LinkedHashMap<>(); private final BentoBox plugin = BentoBox.getInstance(); - private Optional mmh; - private Optional npc; - private Optional znpc; + private final Optional mmh; + private final Optional npc; + private final Optional znpc; /** @@ -148,14 +148,10 @@ private void copyAsync(World world, User user, List vectorsToCopy, int s boolean copyBiome, boolean noWater) { copying = false; // FancyNpcs - if (npc.isPresent()) { - // Add all the citizens for the area in one go. This is pretty fast. - bpEntities.putAll(npc.get().getNpcsInArea(world, vectorsToCopy, origin)); - } + // Add all the citizens for the area in one go. This is pretty fast. + npc.ifPresent(fancyNpcsHook -> bpEntities.putAll(fancyNpcsHook.getNpcsInArea(world, vectorsToCopy, origin))); // ZNPCsPlus NPCs - if (znpc.isPresent()) { - bpEntities.putAll(znpc.get().getNpcsInArea(world, vectorsToCopy, origin)); - } + znpc.ifPresent(znpCsPlusHook -> bpEntities.putAll(znpCsPlusHook.getNpcsInArea(world, vectorsToCopy, origin))); // Repeating copy task copyTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> { diff --git a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java index 3219838a1..85049bc0e 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java @@ -131,32 +131,32 @@ public BlueprintPaster(@NonNull BentoBox plugin, @NonNull Blueprint bp, World wo * Consists of blocks, attached blocks, entities, iterators for the blocks and a speed */ private record Bits( - /** - * Basic blocks to the pasted (not attached blocks) + /* + Basic blocks to the pasted (not attached blocks) */ Map blocks, - /** - * Attached blocks + /* + Attached blocks */ Map attached, - /** - * Entities to be pasted + /* + Entities to be pasted */ Map> entities, - /** - * Basic block pasting iterator + /* + Basic block pasting iterator */ Iterator> it, - /** - * Attached block pasting iterator + /* + Attached block pasting iterator */ Iterator> it2, - /** - * Entity pasting iterator + /* + Entity pasting iterator */ Iterator>> it3, - /** - * Paste speed + /* + Paste speed */ int pasteSpeed) {} diff --git a/src/main/java/world/bentobox/bentobox/blueprints/DisplayListener.java b/src/main/java/world/bentobox/bentobox/blueprints/DisplayListener.java index efa1dccf3..920b2957b 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/DisplayListener.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/DisplayListener.java @@ -16,14 +16,13 @@ /** * Provides a listener for the Display Objects pasted when a hologram is interacted with - * https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerInteractAtEntityEvent.html + * ... */ public class DisplayListener implements Listener { @EventHandler public void onPlayerInteractEntity(PlayerInteractAtEntityEvent event) { - if (event.getRightClicked() instanceof ArmorStand) { - ArmorStand armorStand = (ArmorStand) event.getRightClicked(); + if (event.getRightClicked() instanceof ArmorStand armorStand) { NamespacedKey key = new NamespacedKey(BentoBox.getInstance(), "associatedDisplayEntity"); if (armorStand.getPersistentDataContainer().has(key, PersistentDataType.STRING)) { diff --git a/src/main/java/world/bentobox/bentobox/commands/BentoBoxRankCommand.java b/src/main/java/world/bentobox/bentobox/commands/BentoBoxRankCommand.java index 128bed7fb..2919672e5 100644 --- a/src/main/java/world/bentobox/bentobox/commands/BentoBoxRankCommand.java +++ b/src/main/java/world/bentobox/bentobox/commands/BentoBoxRankCommand.java @@ -124,7 +124,7 @@ public Optional> tabComplete(User user, String alias, List return Optional.empty(); } firstElement = args.get(1); - if (args.size() <= 2) { + if (args.size() == 2) { return Optional.of(List.of("add", REMOVE, "list")); } if (args.size() > 1 && "add".equals(firstElement)) { diff --git a/src/main/java/world/bentobox/bentobox/database/Database.java b/src/main/java/world/bentobox/bentobox/database/Database.java index 40900fd95..5b133fa48 100644 --- a/src/main/java/world/bentobox/bentobox/database/Database.java +++ b/src/main/java/world/bentobox/bentobox/database/Database.java @@ -26,7 +26,7 @@ public class Database { private final AbstractDatabaseHandler handler; private final Logger logger; - private DatabaseSetup databaseSetup = DatabaseSetup.getDatabase(); + private DatabaseSetup databaseSetup = DatabaseSetup.getDatabase(); // Do not make this final due to tests private static final Set> dataObjects = new HashSet<>(); /** diff --git a/src/main/java/world/bentobox/bentobox/database/objects/Island.java b/src/main/java/world/bentobox/bentobox/database/objects/Island.java index 1238cd819..447a6807e 100644 --- a/src/main/java/world/bentobox/bentobox/database/objects/Island.java +++ b/src/main/java/world/bentobox/bentobox/database/objects/Island.java @@ -1210,7 +1210,7 @@ public void setPurgeProtected(boolean purgeProtected) { * {@link world.bentobox.bentobox.api.addons.GameModeAddon#isEnforceEqualRanges()} * to {@code false}, and also likely set {@link world.bentobox.bentobox.api.addons.GameModeAddon#isFixIslandCenter()} * to {@code false} too. - * + *

* The protection range can be set to be bigger than this, but will never report as being bigger than this. * * @param range the range to set diff --git a/src/main/java/world/bentobox/bentobox/hooks/ZNPCsPlusHook.java b/src/main/java/world/bentobox/bentobox/hooks/ZNPCsPlusHook.java index 9a538d7a5..233fc888e 100644 --- a/src/main/java/world/bentobox/bentobox/hooks/ZNPCsPlusHook.java +++ b/src/main/java/world/bentobox/bentobox/hooks/ZNPCsPlusHook.java @@ -23,7 +23,7 @@ import world.bentobox.bentobox.util.Util; /** - * Provides copy and pasting of ZNPCS Plus in blueprints https://github.com/Pyrbu/ZNPCsPlus + * Provides copy and pasting of ZNPCS Plus in blueprints ... * * @author tastybento * @since 3.2.0 @@ -120,7 +120,7 @@ public List getNPCsInChunk(Chunk chunk) { return NpcApiProvider.get().getNpcRegistry().getAll().stream() .filter(npc -> npc.getNpc().getWorld().equals(chunk.getWorld())) // Only NPCs in this world .filter(npc -> npc.getNpc().getLocation().toBukkitLocation(chunk.getWorld()).getChunk().equals(chunk)) // Only in this chunk - .map(npc -> npc.getId()) // IDs + .map(NpcEntry::getId) // IDs .toList(); } diff --git a/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java b/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java index 205033ba7..d05786a60 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java @@ -54,7 +54,7 @@ public void onPlayerJoin(final PlayerJoinEvent event) { return; } // Set the addon in the User object - required to have the right context for prefixes in translations - plugin.getIWM().getAddon(event.getPlayer().getWorld()).ifPresent(gm -> user.setAddon(gm)); + plugin.getIWM().getAddon(event.getPlayer().getWorld()).ifPresent(user::setAddon); // Get the UUID UUID playerUUID = event.getPlayer().getUniqueId(); diff --git a/src/main/java/world/bentobox/bentobox/listeners/teleports/AbstractTeleportListener.java b/src/main/java/world/bentobox/bentobox/listeners/teleports/AbstractTeleportListener.java index 5033d2581..5010afc66 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/teleports/AbstractTeleportListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/teleports/AbstractTeleportListener.java @@ -43,8 +43,8 @@ public abstract class AbstractTeleportListener AbstractTeleportListener(@NonNull BentoBox bentoBox) { this.plugin = bentoBox; - this.inPortal = new ExpiringSet(10, TimeUnit.SECONDS); - this.inTeleport = new ExpiringSet(10, TimeUnit.SECONDS); + this.inPortal = new ExpiringSet<>(10, TimeUnit.SECONDS); + this.inTeleport = new ExpiringSet<>(10, TimeUnit.SECONDS); this.teleportOrigin = new HashMap<>(); } diff --git a/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java b/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java index f217d7368..c4789effd 100644 --- a/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java @@ -200,7 +200,7 @@ private PladdonData loadPladdon(YamlConfiguration data, @NonNull File f) throws Addon addon; try { Plugin pladdon = Bukkit.getPluginManager().loadPlugin(f); - if (pladdon != null && pladdon instanceof Pladdon pl) { + if (pladdon instanceof Pladdon pl) { addon = pl.getAddon(); addon.setDescription(AddonClassLoader.asDescription(data)); // Mark pladdon as enabled. diff --git a/src/main/java/world/bentobox/bentobox/package-info.java b/src/main/java/world/bentobox/bentobox/package-info.java index 128bc2f0f..87d906167 100644 --- a/src/main/java/world/bentobox/bentobox/package-info.java +++ b/src/main/java/world/bentobox/bentobox/package-info.java @@ -1,11 +1,11 @@ /** * The core package for the BentoBox plugin. - * + *

* This package provides the foundational framework for island-based games like SkyBlock, * AcidIsland, and others. It manages core plugin features such as the addon system, * configuration, and APIs used by developers to create custom addons or extend * the functionality of BentoBox. - * + *

* Key features: * - A modular addon system to mix and match features and game modes. * - Comprehensive APIs for island protection, GUIs, team management, and more. diff --git a/src/main/java/world/bentobox/bentobox/util/Util.java b/src/main/java/world/bentobox/bentobox/util/Util.java index e0ce4d93c..7f6acd9ff 100644 --- a/src/main/java/world/bentobox/bentobox/util/Util.java +++ b/src/main/java/world/bentobox/bentobox/util/Util.java @@ -130,7 +130,7 @@ public static Location getClosestIsland(Location location) { * @return Location */ public static Location getLocationString(final String s) { - if (s == null || s.trim().equals("")) { + if (s == null || s.trim().isEmpty()) { return null; } final String[] parts = s.split(":"); @@ -839,8 +839,6 @@ public static String sanitizeInput(String input) * @param values an array of string values which are potential matches for the enum constants * @param the type parameter of the enum * @return the first matching enum constant if a match is found; otherwise, returns null - * @throws IOException - * @throws NullPointerException if either {@code enumClass} or {@code values} are null */ public static > T findFirstMatchingEnum(Class enumClass, String... values) { if (enumClass == null || values == null) { diff --git a/src/main/java/world/bentobox/bentobox/util/heads/HeadGetter.java b/src/main/java/world/bentobox/bentobox/util/heads/HeadGetter.java index 7d8877484..dc221d46b 100644 --- a/src/main/java/world/bentobox/bentobox/util/heads/HeadGetter.java +++ b/src/main/java/world/bentobox/bentobox/util/heads/HeadGetter.java @@ -351,7 +351,6 @@ private static String getURLContent(String requestedUrl) { return returnValue; } - @SuppressWarnings("deprecation") private static URL getSkinURLFromBase64(String base64) { /* * Base64 encoded string is in format: { "timestamp": 0, "profileId": "UUID", diff --git a/src/main/java/world/bentobox/bentobox/util/package-info.java b/src/main/java/world/bentobox/bentobox/util/package-info.java index 787a062db..3a4c3cdef 100644 --- a/src/main/java/world/bentobox/bentobox/util/package-info.java +++ b/src/main/java/world/bentobox/bentobox/util/package-info.java @@ -7,7 +7,7 @@ *

* * This package provides utility classes and helpers for common tasks within BentoBox. - * + *

* These utilities simplify repetitive tasks like file handling, configuration management, * and mathematical calculations. They are used throughout the framework and can be * leveraged by addon developers.