From 4a2da595056abb1c09decaa43b51bf177518b158 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 19 Jan 2022 23:41:23 +0100 Subject: [PATCH] chore: Address false positive code style issues --- .../main/java/com/plotsquared/bukkit/BukkitPlatform.java | 8 ++++---- .../bukkit/entity/ReplicatingEntityWrapper.java | 1 + .../plotsquared/bukkit/generator/BukkitPlotGenerator.java | 3 +++ .../bukkit/generator/DelegatePlotGenerator.java | 1 + .../java/com/plotsquared/bukkit/inject/BukkitModule.java | 2 ++ .../com/plotsquared/bukkit/inject/PermissionModule.java | 1 + .../plotsquared/bukkit/listener/BlockEventListener.java | 3 +++ .../bukkit/listener/BlockEventListener117.java | 1 + .../com/plotsquared/bukkit/listener/ChunkListener.java | 1 + .../plotsquared/bukkit/listener/EntitySpawnListener.java | 1 + .../com/plotsquared/bukkit/listener/PaperListener.java | 2 ++ .../plotsquared/bukkit/listener/PlayerEventListener.java | 2 ++ .../plotsquared/bukkit/listener/SingleWorldListener.java | 3 ++- .../plotsquared/bukkit/managers/BukkitWorldManager.java | 1 + .../java/com/plotsquared/bukkit/player/BukkitPlayer.java | 5 ++++- .../plotsquared/bukkit/queue/BukkitChunkCoordinator.java | 1 + .../plotsquared/bukkit/queue/BukkitQueueCoordinator.java | 4 ++-- .../com/plotsquared/bukkit/schematic/StateWrapper.java | 1 + .../com/plotsquared/bukkit/util/BukkitInventoryUtil.java | 1 + .../com/plotsquared/bukkit/util/BukkitSetupUtils.java | 1 + .../main/java/com/plotsquared/bukkit/util/BukkitUtil.java | 2 ++ .../java/com/plotsquared/bukkit/util/UpdateUtility.java | 2 +- .../plotsquared/bukkit/uuid/EssentialsUUIDService.java | 1 + .../com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java | 2 ++ .../plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java | 1 + .../com/plotsquared/bukkit/uuid/SQLiteUUIDService.java | 5 +++++ .../plotsquared/bukkit/uuid/SquirrelIdUUIDService.java | 2 ++ 27 files changed, 49 insertions(+), 9 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index a3350e8e7..bdb539961 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -218,6 +218,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl private PlatformWorldManager worldManager; private Locale serverLocale; + @SuppressWarnings("StringSplitter") @Override public int @NonNull [] serverVersion() { if (this.version == null) { @@ -242,6 +243,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl return Bukkit.getVersion(); } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public void onEnable() { this.pluginName = getDescription().getName(); @@ -746,7 +748,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl return Bukkit.getWorldContainer(); } - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "CatchAndPrintStacktrace"}) private void runEntityTask() { TaskManager.runTaskRepeat(() -> this.plotAreaManager.forEachPlotArea(plotArea -> { final World world = Bukkit.getWorld(plotArea.getWorldName()); @@ -970,7 +972,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl } iterator.remove(); entity.remove(); - continue; } } } else { @@ -982,7 +983,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl } iterator.remove(); entity.remove(); - continue; } } } @@ -1223,7 +1223,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl @Override @NonNull - @SuppressWarnings("ALL") + @SuppressWarnings("unchecked") public PlayerManager, ? extends Player> playerManager() { return (PlayerManager) injector().getInstance(PlayerManager.class); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java index cdc4da49c..db6aac27e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java @@ -461,6 +461,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { this.tamed.tamed = tamed.isTamed(); } + @SuppressWarnings("EmptyCatch") @Override public Entity spawn(World world, int xOffset, int zOffset) { Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index f5406ef9a..c53f1f849 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -108,6 +108,7 @@ public class BukkitPlotGenerator extends ChunkGenerator return this.platformGenerator; } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public @NonNull List getDefaultPopulators(@NonNull World world) { try { @@ -153,6 +154,7 @@ public class BukkitPlotGenerator extends ChunkGenerator return toAdd; } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public @NonNull ChunkData generateChunkData( @NonNull World world, @NonNull Random random, int x, int z, @@ -195,6 +197,7 @@ public class BukkitPlotGenerator extends ChunkGenerator return result.getChunkData(); } + @SuppressWarnings("CatchAndPrintStackTrace") private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) { // Load if improperly loaded if (!this.loaded) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java index 93d60997b..0dceeb0b1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -66,6 +66,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator { return PlotSquared.platform().defaultGenerator().getNewPlotArea(world, id, min, max); } + @SuppressWarnings("EmptyCatch") @Override public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) { World world = BukkitUtil.getWorld(this.world); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java index 8a1e917c6..11408c275 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java @@ -89,6 +89,7 @@ public class BukkitModule extends AbstractModule { this.bukkitPlatform = bukkitPlatform; } + @SuppressWarnings("CatchAndPrintStackTrace") @Override protected void configure() { bind(PlayerManager.class).to(BukkitPlayerManager.class); @@ -132,6 +133,7 @@ public class BukkitModule extends AbstractModule { install(new FactoryModuleBuilder().build(ChunkCoordinatorBuilderFactory.class)); } + @SuppressWarnings("EmptyCatch") @Provides @Singleton @NonNull EconHandler provideEconHandler() { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/PermissionModule.java b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/PermissionModule.java index 2419fd227..0f7d527bf 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/PermissionModule.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/PermissionModule.java @@ -35,6 +35,7 @@ import org.bukkit.Bukkit; public class PermissionModule extends AbstractModule { + @SuppressWarnings("EmptyCatch") @Provides @Singleton PermissionHandler providePermissionHandler() { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java index 66d92c502..64c03d12f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -203,6 +203,7 @@ public class BlockEventListener implements Listener { } } + @SuppressWarnings("MissingCasesInEnumSwitch") @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPhysicsEvent(BlockPhysicsEvent event) { Block block = event.getBlock(); @@ -529,6 +530,7 @@ public class BlockEventListener implements Listener { } } + @SuppressWarnings("MissingCasesInEnumSwitch") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockForm(BlockFormEvent event) { if (event instanceof EntityBlockFormEvent) { @@ -684,6 +686,7 @@ public class BlockEventListener implements Listener { event.setCancelled(true); } + @SuppressWarnings("MissingCaseInEnumSwitch") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onFade(BlockFadeEvent event) { Block block = event.getBlock(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener117.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener117.java index 301984b9c..e1b517ed9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener117.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener117.java @@ -139,6 +139,7 @@ public class BlockEventListener117 implements Listener { } } + @SuppressWarnings("MissingCasesInEnumSwitch") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockForm(BlockFormEvent event) { Block block = event.getBlock(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java index 95e35a076..3bf35c57f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java @@ -88,6 +88,7 @@ public class ChunkListener implements Listener { private boolean ignoreUnload = false; private boolean isTrueForNotSave = true; + @SuppressWarnings({"StaticAssignmentInConstructor", "CatchAndPrintStackTrace"}) @Inject public ChunkListener(final @NonNull PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java index 37a5c8e95..346a108fc 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -121,6 +121,7 @@ public class EntitySpawnListener implements Listener { } } + @SuppressWarnings("MissingCaseInEnumSwitch") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void creatureSpawnEvent(EntitySpawnEvent event) { Entity entity = event.getEntity(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java index 012fee6ff..2945a138d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -159,6 +159,7 @@ public class PaperListener implements Listener { event.setCancelled(true); } + @SuppressWarnings("MissingCasesInEnumSwitch") @EventHandler public void onPreCreatureSpawnEvent(PreCreatureSpawnEvent event) { if (!Settings.Paper_Components.CREATURE_SPAWN) { @@ -363,6 +364,7 @@ public class PaperListener implements Listener { } } + @SuppressWarnings("EmptyCatch") @EventHandler public void onAsyncTabCompletion(final AsyncTabCompleteEvent event) { if (!Settings.Paper_Components.ASYNC_TAB_COMPLETION) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index d45df0e97..f75cefdf8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -224,6 +224,7 @@ public class PlayerEventListener extends PlotListener implements Listener { } } + @SuppressWarnings("StringSplitter") @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void playerCommand(PlayerCommandPreprocessEvent event) { String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim(); @@ -1667,6 +1668,7 @@ public class PlayerEventListener extends PlotListener implements Listener { } } + @SuppressWarnings("deprecation") // #getLocate is needed for Spigot compatibility @EventHandler public void onLocaleChange(final PlayerLocaleChangeEvent event) { // The event is fired before the player is deemed online upon login diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java index 6121351cd..96c6cc5d2 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/SingleWorldListener.java @@ -43,12 +43,12 @@ import java.lang.reflect.Method; import static com.plotsquared.core.util.ReflectionUtils.getRefClass; -@SuppressWarnings("unused") public class SingleWorldListener implements Listener { private final Method methodGetHandleChunk; private Field shouldSave; + @SuppressWarnings("CatchAndPrintStackTrace") public SingleWorldListener() throws Exception { ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk"); this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod(); @@ -69,6 +69,7 @@ public class SingleWorldListener implements Listener { } } + @SuppressWarnings("CatchAndPrintStackTrace") public void markChunkAsClean(Chunk chunk) { try { Object nmsChunk = methodGetHandleChunk.invoke(chunk); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java index fc73f54f4..d81cd03da 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java @@ -64,6 +64,7 @@ public class BukkitWorldManager implements PlatformWorldManager { return Bukkit.createWorld(wc); } + @SuppressWarnings("CatchAndPrintStackTrace") protected void setGenerator(final @Nullable String worldName, final @Nullable String generator) { if (generator == null) { return; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index e9cd3cb43..acf712a78 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -148,6 +148,7 @@ public class BukkitPlayer extends PlotPlayer { return true; } + @SuppressWarnings("CatchAndPrintStackTrace") private void callEvent(final @NonNull Event event) { final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (final RegisteredListener listener : listeners) { @@ -162,6 +163,7 @@ public class BukkitPlayer extends PlotPlayer { } } + @SuppressWarnings("StringSplitter") @Override @NonNegative public int hasPermissionRange( @@ -319,7 +321,7 @@ public class BukkitPlayer extends PlotPlayer { if (id == ItemTypes.AIR) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()) - .filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) { + .filter(sound -> sound.name().contains("DISC")).toList()) { player.stopSound(sound); } // this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR); @@ -331,6 +333,7 @@ public class BukkitPlayer extends PlotPlayer { } } + @SuppressWarnings("deprecation") // Needed for Spigot compatibility @Override public void kick(final String message) { this.player.kickPlayer(message); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java index e8416fab1..cd7ed4036 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java @@ -193,6 +193,7 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator { /** * Requests a batch of chunks to be loaded */ + @SuppressWarnings("FutureReturnValueIgnored") private void requestBatch() { BlockVector2 chunk; for (int i = 0; i < this.batchSize && (chunk = this.requestedChunks.poll()) != null; i++) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java index 1e1f10a25..6973dc5d1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java @@ -199,7 +199,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { } } if (localChunk.getTiles().size() > 0) { - localChunk.getTiles().forEach(((blockVector3, tag) -> { + localChunk.getTiles().forEach((blockVector3, tag) -> { try { BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag); getWorld().setBlock(blockVector3, block, noSideEffectSet); @@ -207,7 +207,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { StateWrapper sw = new StateWrapper(tag); sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ()); } - })); + }); } if (localChunk.getEntities().size() > 0) { localChunk.getEntities().forEach((location, entity) -> getWorld().createEntity(location, entity)); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/StateWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/StateWrapper.java index fcd4a85d4..84f8efb4a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/StateWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/StateWrapper.java @@ -166,6 +166,7 @@ public class StateWrapper { return str; } + @SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility public boolean restoreTag(String worldName, int x, int y, int z) { if (this.tag == null) { return false; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java index 89970ae33..376cd88b5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -145,6 +145,7 @@ public class BukkitInventoryUtil extends InventoryUtil { .toArray(PlotItemStack[]::new); } + @SuppressWarnings("deprecation") // Need #getTitle for Spigot compatibility @Override public boolean isOpen(PlotInventory plotInventory) { if (!plotInventory.isOpen()) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java index 1efd58a5c..d5c2d9f74 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -126,6 +126,7 @@ public class BukkitSetupUtils extends SetupUtils { }); } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public String setupWorld(PlotAreaBuilder builder) { this.updateGenerators(false); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index 3a46fbb7d..8d4d1c8f1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -291,6 +291,7 @@ public class BukkitUtil extends WorldUtil { return bukkitWorld.getMaxHeight() - 1; } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public @NonNull String[] getSignSynchronous(final @NonNull Location location) { Block block = Objects.requireNonNull(getWorld(location.getWorldName())).getBlockAt( @@ -570,6 +571,7 @@ public class BukkitUtil extends WorldUtil { getChunkAt(chunk.getBlockX(), chunk.getBlockZ()).getTileEntities().length; } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public Set getChunkChunks(String world) { Set chunks = super.getChunkChunks(world); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java index 08d7a8190..ec06eb854 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java @@ -68,7 +68,7 @@ public class UpdateUtility implements Listener { "https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506") .openConnection(); connection.setRequestMethod("GET"); - JsonObject result = (new JsonParser()) + JsonObject result = new JsonParser() .parse(new JsonReader(new InputStreamReader(connection.getInputStream()))) .getAsJsonObject(); spigotVersion = result.get("current_version").getAsString(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java index ac26c0f4a..bdcb27fd1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java @@ -52,6 +52,7 @@ public class EssentialsUUIDService implements UUIDService { return Collections.emptyList(); } + @SuppressWarnings("EmptyCatch") @Override public @NonNull List getUUIDs(final @NonNull List usernames) { final List mappings = new ArrayList<>(usernames.size()); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java index 21919002b..04b870883 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java @@ -53,6 +53,7 @@ public class LuckPermsUUIDService implements UUIDService { } } + @SuppressWarnings("EmptyCatch") @Override public @NonNull List getNames(final @NonNull List uuids) { final List mappings = new ArrayList<>(uuids.size()); @@ -69,6 +70,7 @@ public class LuckPermsUUIDService implements UUIDService { return mappings; } + @SuppressWarnings("EmptyCatch") @Override public @NonNull List getUUIDs(final @NonNull List usernames) { final List mappings = new ArrayList<>(usernames.size()); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java index 9014e145c..f75ebc7bd 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java @@ -43,6 +43,7 @@ import java.util.UUID; */ public class OfflinePlayerUUIDService implements UUIDService { + @SuppressWarnings("EmptyCatch") @Override public @NonNull List getNames(final @NonNull List uuids) { if (Settings.UUID.FORCE_LOWERCASE || Bukkit.getWorlds().isEmpty()) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java index 3d56585ef..9981ab130 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java @@ -49,6 +49,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer getNames(final @NonNull List uuids) { final List mappings = new ArrayList<>(uuids.size()); @@ -91,6 +93,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer getUUIDs(@NonNull List usernames) { final List mappings = new ArrayList<>(usernames.size()); @@ -113,6 +116,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer uuidWrappers) { try (final PreparedStatement statement = getConnection() @@ -132,6 +136,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer getAll() { final List mappings = new LinkedList<>(); try (final PreparedStatement statement = getConnection().prepareStatement("SELECT * FROM `usercache`")) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java index e3a2e8c60..e366b980c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java @@ -67,6 +67,7 @@ public class SquirrelIdUUIDService implements UUIDService { this.rateLimiter = RateLimiter.create(rateLimit / 600.0D); } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public @NonNull List getNames(final @NonNull List uuids) { final List results = new ArrayList<>(uuids.size()); @@ -102,6 +103,7 @@ public class SquirrelIdUUIDService implements UUIDService { return results; } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public @NonNull List getUUIDs(final @NonNull List usernames) { final List results = new ArrayList<>(usernames.size());