diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java index ff85f806c..0a94a293b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java @@ -63,6 +63,7 @@ public class BukkitCommand implements CommandExecutor, TabCompleter { return false; } + @SuppressWarnings("MixedMutabilityReturnType") @Override public List onTabComplete( CommandSender commandSender, Command command, String label, diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index bdb539961..2b8670d5b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -563,6 +563,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl ServerLib.checkUnsafeForks(); } + @SuppressWarnings("CatchAndPrintStackTrace") private void unload() { if (!this.methodUnloadSetup) { this.methodUnloadSetup = true; @@ -648,6 +649,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl } } + @SuppressWarnings("FutureReturnValueIgnored") private void startUuidCaching( final @NonNull SQLiteUUIDService sqLiteUUIDService, final @NonNull CacheUUIDService cacheUUIDService 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 db6aac27e..10aa20fbb 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java @@ -461,7 +461,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { this.tamed.tamed = tamed.isTamed(); } - @SuppressWarnings("EmptyCatch") + @SuppressWarnings({"EmptyCatch", "deprecation"}) // Paper deprecation @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 c53f1f849..b5387fcbb 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -261,6 +261,7 @@ public class BukkitPlotGenerator extends ChunkGenerator } } + @SuppressWarnings({"EqualsHashCode", "EqualsGetClass"}) // Valid comparison @Override public boolean equals(final Object obj) { if (obj == null) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java index 9d5aa50fb..06bf11013 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java @@ -36,6 +36,7 @@ import org.bukkit.World; public class WorldManagerModule extends AbstractModule { + @SuppressWarnings("removal") // Internal use only @Provides @Singleton PlatformWorldManager provideWorldManager() { 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 64c03d12f..b9d65add9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -426,6 +426,7 @@ public class BlockEventListener implements Listener { event.setCancelled(true); } + @SuppressWarnings("FallThrough") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { Block block = event.getBlock(); @@ -686,7 +687,7 @@ public class BlockEventListener implements Listener { event.setCancelled(true); } - @SuppressWarnings("MissingCaseInEnumSwitch") + @SuppressWarnings("MissingCaseesInEnumSwitch") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onFade(BlockFadeEvent event) { Block block = event.getBlock(); @@ -1075,6 +1076,7 @@ public class BlockEventListener implements Listener { } + @SuppressWarnings("OperatorPrecedence") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { Player player = event.getPlayer(); 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 3bf35c57f..adce8c1b3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java @@ -258,6 +258,7 @@ public class ChunkListener implements Listener { processChunk(event.getChunk(), false); } + @SuppressWarnings("FutureReturnValueIgnored") @EventHandler(priority = EventPriority.LOWEST) public void onItemSpawn(ItemSpawnEvent event) { Item entity = event.getEntity(); @@ -288,6 +289,7 @@ public class ChunkListener implements Listener { } } + @SuppressWarnings("FutureReturnValueIgnored") @EventHandler(priority = EventPriority.LOWEST) public void onEntitySpawn(CreatureSpawnEvent event) { LivingEntity entity = event.getEntity(); 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 346a108fc..466772a63 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -85,6 +85,7 @@ public class EntitySpawnListener implements Listener { test(entity); } + @SuppressWarnings("FutureReturnValueIgnored") public static void test(Entity entity) { @NonNull World world = entity.getWorld(); List meta = entity.getMetadata(KEY); @@ -121,7 +122,7 @@ public class EntitySpawnListener implements Listener { } } - @SuppressWarnings("MissingCaseInEnumSwitch") + @SuppressWarnings({"MissingCaseesInEnumSwitch", "FallThrough"}) @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 2945a138d..06ab36ff7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -83,6 +83,7 @@ public class PaperListener implements Listener { this.plotAreaManager = plotAreaManager; } + @SuppressWarnings("ReferenceEquality") @EventHandler public void onEntityPathfind(EntityPathfindEvent event) { if (!Settings.Paper_Components.ENTITY_PATHING) { @@ -117,6 +118,7 @@ public class PaperListener implements Listener { event.setCancelled(true); } + @SuppressWarnings("ReferenceEquality") @EventHandler public void onEntityPathfind(SlimePathfindEvent event) { if (!Settings.Paper_Components.ENTITY_PATHING) { @@ -159,7 +161,7 @@ public class PaperListener implements Listener { event.setCancelled(true); } - @SuppressWarnings("MissingCasesInEnumSwitch") + @SuppressWarnings({"MissingCasesInEnumSwitch", "FallThrough"}) @EventHandler public void onPreCreatureSpawnEvent(PreCreatureSpawnEvent event) { if (!Settings.Paper_Components.CREATURE_SPAWN) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java index 027ded716..bb3177b1b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java @@ -36,7 +36,6 @@ import com.plotsquared.core.plot.world.PlotAreaManager; import net.kyori.adventure.text.minimessage.Template; import org.bukkit.block.Banner; import org.bukkit.block.Beacon; -import org.bukkit.block.Bed; import org.bukkit.block.BlockState; import org.bukkit.block.CommandBlock; import org.bukkit.block.Comparator; @@ -51,6 +50,7 @@ import org.bukkit.block.Jukebox; import org.bukkit.block.Sign; import org.bukkit.block.Skull; import org.bukkit.block.Structure; +import org.bukkit.block.data.type.Bed; import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockPlaceEvent; import org.checkerframework.checker.nullness.qual.NonNull; 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 f75cefdf8..762031c9b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -380,6 +380,7 @@ public class PlayerEventListener extends PlotListener implements Listener { this.eventDispatcher.doRespawnTask(pp); } + @SuppressWarnings("deprecation") // We explicitly want #getHomeSynchronous here @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onTeleport(PlayerTeleportEvent event) { Player player = event.getPlayer(); @@ -429,6 +430,7 @@ public class PlayerEventListener extends PlotListener implements Listener { playerMove(event); } + @SuppressWarnings("FutureReturnValueIgnored") @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void vehicleMove(VehicleMoveEvent event) throws IllegalAccessException { @@ -806,7 +808,7 @@ public class PlayerEventListener extends PlotListener implements Listener { } } - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "FallThrough"}) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onInventoryClick(InventoryClickEvent event) { /*if (!event.isLeftClick() || (event.getAction() != InventoryAction.PLACE_ALL) || event 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 acf712a78..645fc787e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -229,6 +229,7 @@ public class BukkitPlayer extends PlotPlayer { return max; } + @SuppressWarnings("FutureReturnValueIgnored") @Override public void teleport(final @NonNull Location location, final @NonNull TeleportCause cause) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { @@ -316,6 +317,7 @@ public class BukkitPlayer extends PlotPlayer { this.player.setAllowFlight(fly); } + @SuppressWarnings("ReferenceEquality") @Override public void playMusic(final @NonNull Location location, final @NonNull ItemType id) { if (id == ItemTypes.AIR) { @@ -339,6 +341,7 @@ public class BukkitPlayer extends PlotPlayer { this.player.kickPlayer(message); } + @SuppressWarnings("ReferenceEquality") @Override public void stopSpectating() { if (getGameMode() == SPECTATOR) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java index bc79f2926..f0c268771 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java @@ -337,6 +337,7 @@ public class BukkitEntityUtil { && !(victim instanceof Creature))); } + @SuppressWarnings("OperatorPrecedence") public static boolean checkEntity(Entity entity, Plot plot) { if (plot == null || !plot.hasOwner() || plot.getFlags().isEmpty() && plot.getArea() .getFlagContainer().getFlagMap().isEmpty()) { 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 376cd88b5..8a4e57e78 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -77,6 +77,7 @@ public class BukkitInventoryUtil extends InventoryUtil { return stack; } + @SuppressWarnings("deprecation") // Paper deprecation @Override public void open(PlotInventory inv) { BukkitPlayer bp = (BukkitPlayer) inv.getPlayer(); @@ -113,6 +114,7 @@ public class BukkitInventoryUtil extends InventoryUtil { bp.player.updateInventory(); } + @SuppressWarnings("deprecation") // Paper deprecation public PlotItemStack getItem(ItemStack item) { if (item == null) { return null; @@ -145,7 +147,7 @@ public class BukkitInventoryUtil extends InventoryUtil { .toArray(PlotItemStack[]::new); } - @SuppressWarnings("deprecation") // Need #getTitle for Spigot compatibility + @SuppressWarnings("deprecation") // #getTitle is needed for Spigot compatibility @Override public boolean isOpen(PlotInventory plotInventory) { if (!plotInventory.isOpen()) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java index 2e78b7508..cf9d398c1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java @@ -94,6 +94,7 @@ public class BukkitRegionManager extends RegionManager { return false; } + @SuppressWarnings({"FutureReturnValueIgnored", "OperatorPrecedence"}) @Override public int[] countEntities(@NonNull Plot plot) { int[] existing = (int[]) plot.getMeta("EntityCount"); 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 d5c2d9f74..5ea299d15 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -74,6 +74,7 @@ public class BukkitSetupUtils extends SetupUtils { this.worldFile = worldFile; } + @SuppressWarnings("CatchAndPrintStackTrace") @Override public void updateGenerators(final boolean force) { if (!SetupUtils.generators.isEmpty() && !force) { 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 8d4d1c8f1..c7a9fcc0b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -193,6 +193,7 @@ public class BukkitUtil extends WorldUtil { return Bukkit.getWorld(string); } + @SuppressWarnings("FutureReturnValueIgnored") private static void ensureLoaded( final @NonNull String world, final int x, @@ -203,6 +204,7 @@ public class BukkitUtil extends WorldUtil { .thenAccept(chunk -> ensureMainThread(chunkConsumer, chunk)); } + @SuppressWarnings("FutureReturnValueIgnored") private static void ensureLoaded(final @NonNull Location location, final @NonNull Consumer chunkConsumer) { PaperLib.getChunkAtAsync(adapt(location), true).thenAccept(chunk -> ensureMainThread(chunkConsumer, chunk)); } 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 ec06eb854..a6df438e1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java @@ -61,6 +61,7 @@ public class UpdateUtility implements Listener { internalVersion = PlotSquared.get().getVersion(); } + @SuppressWarnings({"deprecation", "DefaultCharset"}) // Suppress Json deprecation, we can't use features from gson 2.8.1 and newer yet public void updateChecker() { task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> { try { @@ -91,7 +92,7 @@ public class UpdateUtility implements Listener { notify = false; LOGGER.info("Congratulations! You are running the latest PlotSquared version"); } - }, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20); + }, 0L, (long) Settings.UpdateChecker.POLL_RATE * 60 * 20); } private void cancelTask() { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java index 3b9e984d7..26b1bb2c5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java @@ -75,6 +75,7 @@ public class FaweSchematicHandler extends SchematicHandler { return delegate.save(tag, path); } + @SuppressWarnings("removal") // Just the override @Override public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal whenDone) { delegate.upload(tag, uuid, file, whenDone); 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 f75ebc7bd..4b8917c17 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java @@ -43,7 +43,7 @@ import java.util.UUID; */ public class OfflinePlayerUUIDService implements UUIDService { - @SuppressWarnings("EmptyCatch") + @SuppressWarnings({"EmptyCatch", "MixedMutabilityReturnType"}) @Override public @NonNull List getNames(final @NonNull List uuids) { if (Settings.UUID.FORCE_LOWERCASE || Bukkit.getWorlds().isEmpty()) { diff --git a/Core/src/main/java/com/plotsquared/core/player/MetaDataAccess.java b/Core/src/main/java/com/plotsquared/core/player/MetaDataAccess.java index 98cc5790c..5552c2c9a 100644 --- a/Core/src/main/java/com/plotsquared/core/player/MetaDataAccess.java +++ b/Core/src/main/java/com/plotsquared/core/player/MetaDataAccess.java @@ -53,7 +53,7 @@ public abstract class MetaDataAccess implements AutoCloseable { this.lockAccess = lockAccess; } - @SuppressWarnings("ALL") + @SuppressWarnings("unchecked") private static void sneakyThrow(final Throwable e) throws E { throw (E) e; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java index b59c055c5..1a4f95970 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java @@ -96,7 +96,7 @@ public class FlagContainer { } /** - * Cast a plot flag with wildcard parameters into a parametrisized + * Cast a plot flag with wildcard parameters into a parametrized * PlotFlag. This is an unsafe operation, and should only be performed * if the generic parameters are known beforehand. * @@ -105,7 +105,7 @@ public class FlagContainer { * @param Flag type * @return Casted flag */ - @SuppressWarnings("ALL") + @SuppressWarnings("unchecked") public static > T castUnsafe( final PlotFlag flag ) { @@ -181,6 +181,7 @@ public class FlagContainer { * @param flag value type * @return value of flag removed */ + @SuppressWarnings("unchecked") public > V removeFlag(final T flag) { final Object value = this.flagMap.remove(flag.getClass()); if (this.plotFlagUpdateHandler != null) { diff --git a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java index a15bf88fe..d547ccfc7 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java @@ -73,6 +73,7 @@ public class EntityUtil { return i; } + @SuppressWarnings("unchecked") public static boolean checkEntity(Plot plot, PlotFlag... flags) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { return true;