From 0106a4222db290ab5a1b8779e890d3eb7777cd27 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 1 May 2021 18:33:02 +0200 Subject: [PATCH] Address a few deprecations --- .../com/plotsquared/bukkit/BukkitCommand.java | 2 +- .../bukkit/listener/ForceFieldListener.java | 20 +++++++-------- .../bukkit/util/BukkitInventoryUtil.java | 2 +- .../plotsquared/bukkit/util/BukkitUtil.java | 2 +- .../core/backup/BackupManager.java | 4 +-- .../core/backup/NullBackupManager.java | 2 +- .../core/backup/SimpleBackupManager.java | 2 +- .../com/plotsquared/core/command/Add.java | 2 +- .../com/plotsquared/core/command/Alias.java | 4 +-- .../com/plotsquared/core/command/Auto.java | 2 +- .../com/plotsquared/core/command/Biome.java | 2 +- .../com/plotsquared/core/command/Cluster.java | 4 +-- .../com/plotsquared/core/command/Command.java | 8 +++--- .../com/plotsquared/core/command/Comment.java | 2 +- .../core/command/DatabaseCommand.java | 2 +- .../plotsquared/core/command/DebugExec.java | 2 +- .../core/command/DebugRoadRegen.java | 4 +-- .../com/plotsquared/core/command/Deny.java | 6 ++--- .../com/plotsquared/core/command/Desc.java | 2 +- .../com/plotsquared/core/command/Done.java | 2 +- .../com/plotsquared/core/command/Help.java | 4 +-- .../plotsquared/core/command/HomeCommand.java | 2 +- .../com/plotsquared/core/command/Kick.java | 2 +- .../com/plotsquared/core/command/ListCmd.java | 2 +- .../plotsquared/core/command/MainCommand.java | 2 +- .../com/plotsquared/core/command/Merge.java | 2 +- .../com/plotsquared/core/command/Owner.java | 2 +- .../com/plotsquared/core/command/Remove.java | 2 +- .../com/plotsquared/core/command/Set.java | 6 ++--- .../plotsquared/core/command/SetCommand.java | 2 +- .../com/plotsquared/core/command/SetHome.java | 2 +- .../com/plotsquared/core/command/Setup.java | 2 +- .../com/plotsquared/core/command/Trust.java | 2 +- .../com/plotsquared/core/command/Visit.java | 4 +-- .../core/configuration/Config.java | 25 +++++++++---------- .../core/configuration/ConfigurationNode.java | 8 +++--- .../core/events/PlayerClaimPlotEvent.java | 2 +- .../core/events/PlayerEnterPlotEvent.java | 2 +- .../core/events/PlayerLeavePlotEvent.java | 2 +- .../core/events/PlayerPlotDeniedEvent.java | 6 ++--- .../core/events/PlayerPlotHelperEvent.java | 6 ++--- .../core/events/PlayerPlotTrustedEvent.java | 6 ++--- .../events/PlayerTeleportToPlotEvent.java | 2 +- .../core/events/PlotChangeOwnerEvent.java | 10 ++++---- .../core/events/PlotMergeEvent.java | 4 +-- .../core/events/PlotPlayerEvent.java | 6 ++--- .../core/events/PlotRateEvent.java | 6 ++--- .../core/listener/PlotListener.java | 4 +-- .../plotsquared/core/player/MetaDataKey.java | 4 +-- .../java/com/plotsquared/core/plot/Plot.java | 3 ++- .../com/plotsquared/core/plot/PlotArea.java | 6 ++--- .../plotsquared/core/plot/PlotManager.java | 5 ++++ .../implementations/DenyTeleportFlag.java | 2 +- .../core/queue/ChunkQueueCoordinator.java | 2 +- ...ocationOffsetDelegateQueueCoordinator.java | 2 +- .../core/queue/QueueCoordinator.java | 2 ++ .../plotsquared/core/util/ChunkManager.java | 2 +- .../plotsquared/core/util/InventoryUtil.java | 2 +- .../plotsquared/core/util/PatternUtil.java | 8 +++--- .../core/util/ReflectionUtils.java | 10 ++++---- .../com/plotsquared/core/util/StringMan.java | 2 +- .../core/util/helpmenu/HelpMenu.java | 4 +-- .../core/util/helpmenu/HelpPage.java | 2 +- .../core/util/query/PlotQuery.java | 2 +- 64 files changed, 133 insertions(+), 126 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java index 2c2017346..e1c55d9c5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitCommand.java @@ -69,7 +69,7 @@ public class BukkitCommand implements CommandExecutor, TabCompleter { if (!(commandSender instanceof Player)) { return null; } - PlotPlayer player = BukkitUtil.adapt((Player) commandSender); + PlotPlayer player = BukkitUtil.adapt((Player) commandSender); if (args.length == 0) { return Collections.singletonList("plots"); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java index b1b8af763..be95082ec 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ForceFieldListener.java @@ -44,11 +44,11 @@ import java.util.UUID; @SuppressWarnings("unused") public class ForceFieldListener { - private static Set getNearbyPlayers(Player player, Plot plot) { - Set players = new HashSet<>(); + private static Set> getNearbyPlayers(Player player, Plot plot) { + Set> players = new HashSet<>(); for (Player nearPlayer : Iterables .filter(player.getNearbyEntities(5d, 5d, 5d), Player.class)) { - PlotPlayer plotPlayer; + PlotPlayer plotPlayer; if ((plotPlayer = BukkitUtil.adapt(nearPlayer)) == null || !plot .equals(plotPlayer.getCurrentPlot())) { continue; @@ -60,10 +60,10 @@ public class ForceFieldListener { return players; } - private static PlotPlayer hasNearbyPermitted(Player player, Plot plot) { + private static PlotPlayer hasNearbyPermitted(Player player, Plot plot) { for (Player nearPlayer : Iterables .filter(player.getNearbyEntities(5d, 5d, 5d), Player.class)) { - PlotPlayer plotPlayer; + PlotPlayer plotPlayer; if ((plotPlayer = BukkitUtil.adapt(nearPlayer)) == null || !plot .equals(plotPlayer.getCurrentPlot())) { continue; @@ -75,7 +75,7 @@ public class ForceFieldListener { return null; } - private static Vector calculateVelocity(PlotPlayer player, PlotPlayer e) { + private static Vector calculateVelocity(PlotPlayer player, PlotPlayer e) { Location playerLocation = player.getLocationFull(); Location oPlayerLocation = e.getLocation(); double playerX = playerLocation.getX(); @@ -105,12 +105,12 @@ public class ForceFieldListener { return new Vector(x, y, z); } - public static void handleForcefield(Player player, PlotPlayer plotPlayer, Plot plot) { + public static void handleForcefield(Player player, PlotPlayer plotPlayer, Plot plot) { if (plot.getFlag(ForcefieldFlag.class)) { UUID uuid = plotPlayer.getUUID(); if (plot.isAdded(uuid)) { - Set players = getNearbyPlayers(player, plot); - for (PlotPlayer oPlayer : players) { + Set> players = getNearbyPlayers(player, plot); + for (PlotPlayer oPlayer : players) { if (!Permissions .hasPermission(oPlayer, Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) { ((BukkitPlayer) oPlayer).player @@ -118,7 +118,7 @@ public class ForceFieldListener { } } } else { - PlotPlayer oPlayer = hasNearbyPermitted(player, plot); + PlotPlayer oPlayer = hasNearbyPermitted(player, plot); if (oPlayer == null) { return; } 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 128ada1ef..732982578 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -138,7 +138,7 @@ public class BukkitInventoryUtil extends InventoryUtil { } @Override - public PlotItemStack[] getItems(PlotPlayer player) { + public PlotItemStack[] getItems(PlotPlayer player) { BukkitPlayer bp = (BukkitPlayer) player; PlayerInventory inv = bp.player.getInventory(); return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i))) 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 e72046fa5..9934e21b8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -430,7 +430,7 @@ public class BukkitUtil extends WorldUtil { @Override @NonNegative - public double getHealth(final @NonNull PlotPlayer player) { + public double getHealth(final @NonNull PlotPlayer player) { return Objects.requireNonNull(Bukkit.getPlayer(player.getUUID())).getHealth(); } diff --git a/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java index 5e8249924..f08b17657 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java @@ -45,7 +45,7 @@ public interface BackupManager { * @param plot Plot to perform the automatic backup on * @param whenDone Action that runs when the automatic backup has been completed */ - static void backup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone) { + static void backup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone) { Objects.requireNonNull(PlotSquared.platform()).backupManager().automaticBackup(player, plot, whenDone); } @@ -67,7 +67,7 @@ public interface BackupManager { * @param plot Plot to perform the automatic backup on * @param whenDone Action that runs when the automatic backup has been completed */ - void automaticBackup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone); + void automaticBackup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone); /** * Get the directory in which backups are stored diff --git a/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java index 428daddb5..b270dcf5d 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java @@ -48,7 +48,7 @@ public class NullBackupManager implements BackupManager { @Override public void automaticBackup( - @Nullable PlotPlayer plotPlayer, + @Nullable PlotPlayer plotPlayer, @NonNull Plot plot, @NonNull Runnable whenDone ) { whenDone.run(); diff --git a/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java index 6c602122e..30c3e2e90 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java @@ -99,7 +99,7 @@ public class SimpleBackupManager implements BackupManager { } @Override - public void automaticBackup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone) { + public void automaticBackup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone) { final BackupProfile profile; if (!this.shouldAutomaticallyBackup() || (profile = getProfile(plot)) instanceof NullBackupProfile) { whenDone.run(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Add.java b/Core/src/main/java/com/plotsquared/core/command/Add.java index 0a45795df..4cb2953c4 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Add.java +++ b/Core/src/main/java/com/plotsquared/core/command/Add.java @@ -164,7 +164,7 @@ public class Add extends Command { } @Override - public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { + public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList()); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Alias.java b/Core/src/main/java/com/plotsquared/core/command/Alias.java index 096558611..1e99da8c3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Alias.java +++ b/Core/src/main/java/com/plotsquared/core/command/Alias.java @@ -130,7 +130,7 @@ public class Alias extends SubCommand { } @Override - public Collection tab(PlotPlayer player, String[] args, boolean space) { + public Collection tab(PlotPlayer player, String[] args, boolean space) { final List commands = new ArrayList<>(2); if (args.length == 1) { if ("set".startsWith(args[0])) { @@ -144,7 +144,7 @@ public class Alias extends SubCommand { return Collections.emptySet(); } - private void setAlias(PlotPlayer player, Plot plot, String alias) { + private void setAlias(PlotPlayer player, Plot plot, String alias) { if (alias.isEmpty()) { sendUsage(player); } else if (alias.length() >= 50) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Auto.java b/Core/src/main/java/com/plotsquared/core/command/Auto.java index ccba82249..d81eba3e3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Auto.java +++ b/Core/src/main/java/com/plotsquared/core/command/Auto.java @@ -96,7 +96,7 @@ public class Auto extends SubCommand { } public static boolean checkAllowedPlots( - PlotPlayer player, PlotArea plotarea, + PlotPlayer player, PlotArea plotarea, @Nullable Integer allowedPlots, int sizeX, int sizeZ ) { if (allowedPlots == null) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Biome.java b/Core/src/main/java/com/plotsquared/core/command/Biome.java index 3740e6e4b..4f9baf096 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Biome.java +++ b/Core/src/main/java/com/plotsquared/core/command/Biome.java @@ -47,7 +47,7 @@ import java.util.stream.Collectors; public class Biome extends SetCommand { @Override - public boolean set(final PlotPlayer player, final Plot plot, final String value) { + public boolean set(final PlotPlayer player, final Plot plot, final String value) { BiomeType biome = null; try { biome = BiomeTypes.get(value.toLowerCase()); diff --git a/Core/src/main/java/com/plotsquared/core/command/Cluster.java b/Core/src/main/java/com/plotsquared/core/command/Cluster.java index 5ec809915..5070ce663 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Cluster.java +++ b/Core/src/main/java/com/plotsquared/core/command/Cluster.java @@ -462,7 +462,7 @@ public class Cluster extends SubCommand { // add the user if not added cluster.invited.add(uuid); DBFunc.setInvited(cluster, uuid); - final PlotPlayer otherPlayer = + final PlotPlayer otherPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); if (otherPlayer != null) { player.sendMessage( @@ -538,7 +538,7 @@ public class Cluster extends SubCommand { cluster.invited.remove(uuid); DBFunc.removeInvited(cluster, uuid); - final PlotPlayer player2 = + final PlotPlayer player2 = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); if (player2 != null) { player.sendMessage( diff --git a/Core/src/main/java/com/plotsquared/core/command/Command.java b/Core/src/main/java/com/plotsquared/core/command/Command.java index dc7148493..e1c283f7a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Command.java +++ b/Core/src/main/java/com/plotsquared/core/command/Command.java @@ -75,7 +75,7 @@ public abstract class Command { private String permission; private boolean confirmation; private CommandCategory category; - private Argument[] arguments; + private Argument[] arguments; public Command( Command parent, boolean isStatic, String id, String permission, @@ -183,11 +183,11 @@ public abstract class Command { return this.required; } - public Argument[] getRequiredArguments() { + public Argument[] getRequiredArguments() { return this.arguments; } - public void setRequiredArguments(Argument[] arguments) { + public void setRequiredArguments(Argument[] arguments) { this.arguments = arguments; } @@ -460,7 +460,7 @@ public abstract class Command { return cmd; } - public Command getCommand(Class clazz) { + public Command getCommand(Class clazz) { for (Command cmd : this.allCommands) { if (cmd.getClass() == clazz) { return cmd; diff --git a/Core/src/main/java/com/plotsquared/core/command/Comment.java b/Core/src/main/java/com/plotsquared/core/command/Comment.java index 7b8747b83..63505b283 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Comment.java +++ b/Core/src/main/java/com/plotsquared/core/command/Comment.java @@ -110,7 +110,7 @@ public class Comment extends SubCommand { return false; } - for (final PlotPlayer pp : PlotSquared.platform().playerManager().getPlayers()) { + for (final PlotPlayer pp : PlotSquared.platform().playerManager().getPlayers()) { if (pp.getAttribute("chatspy")) { pp.sendMessage(StaticCaption.of("/plot comment " + StringMan.join(args, " "))); } diff --git a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java index 7408de850..15b3f000c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java @@ -86,7 +86,7 @@ public class DatabaseCommand extends SubCommand { public static void insertPlots( final SQLManager manager, final List plots, - final PlotPlayer player + final PlotPlayer player ) { TaskManager.runTaskAsync(() -> { try { diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java index bd59fa6a3..d7f1a4ef6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -108,7 +108,7 @@ public class DebugExec extends SubCommand { return true; } player.sendMessage(TranslatableCaption.of("debugexec.starting_task")); - this.hybridUtils.analyzePlot(plot, new RunnableVal() { + this.hybridUtils.analyzePlot(plot, new RunnableVal<>() { @Override public void run(PlotAnalysis value) { player.sendMessage( diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java index 7e7798817..328978b41 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java @@ -89,7 +89,7 @@ public class DebugRoadRegen extends SubCommand { } } - public boolean regenPlot(PlotPlayer player) { + public boolean regenPlot(PlotPlayer player) { Location location = player.getLocation(); PlotArea area = location.getPlotArea(); if (area == null) { @@ -122,7 +122,7 @@ public class DebugRoadRegen extends SubCommand { return true; } - public boolean regenRegion(PlotPlayer player, String[] args) { + public boolean regenRegion(PlotPlayer player, String[] args) { int height = 0; if (args.length == 1) { try { diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index 04f10ab1f..551101139 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -138,7 +138,7 @@ public class Deny extends SubCommand { if (!uuid.equals(DBFunc.EVERYONE)) { handleKick(PlotSquared.platform().playerManager().getPlayerIfExists(uuid), plot); } else { - for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) { + for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) { // Ignore plot-owners if (plot.isAdded(plotPlayer.getUUID())) { continue; @@ -156,11 +156,11 @@ public class Deny extends SubCommand { } @Override - public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { + public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList()); } - private void handleKick(PlotPlayer player, Plot plot) { + private void handleKick(PlotPlayer player, Plot plot) { if (player == null) { return; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Desc.java b/Core/src/main/java/com/plotsquared/core/command/Desc.java index 3ef364c6b..b42f68e5a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Desc.java +++ b/Core/src/main/java/com/plotsquared/core/command/Desc.java @@ -53,7 +53,7 @@ public class Desc extends SetCommand { } @Override - public boolean set(PlotPlayer player, Plot plot, String desc) { + public boolean set(PlotPlayer player, Plot plot, String desc) { if (desc.isEmpty()) { PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plot .getFlagContainer() diff --git a/Core/src/main/java/com/plotsquared/core/command/Done.java b/Core/src/main/java/com/plotsquared/core/command/Done.java index 4a3347e9f..f40e28f51 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Done.java +++ b/Core/src/main/java/com/plotsquared/core/command/Done.java @@ -115,7 +115,7 @@ public class Done extends SubCommand { return true; } - private void finish(Plot plot, PlotPlayer player, boolean success) { + private void finish(Plot plot, PlotPlayer player, boolean success) { if (!success) { player.sendMessage(TranslatableCaption.of("done.done_insufficient_complexity")); return; diff --git a/Core/src/main/java/com/plotsquared/core/command/Help.java b/Core/src/main/java/com/plotsquared/core/command/Help.java index 928dea944..63bbd0341 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Help.java +++ b/Core/src/main/java/com/plotsquared/core/command/Help.java @@ -51,7 +51,7 @@ public class Help extends Command { } @Override - public boolean canExecute(PlotPlayer player, boolean message) { + public boolean canExecute(PlotPlayer player, boolean message) { return true; } @@ -90,7 +90,7 @@ public class Help extends Command { } public CompletableFuture displayHelp( - final PlotPlayer player, final String catRaw, + final PlotPlayer player, final String catRaw, final int page ) { return CompletableFuture.supplyAsync(() -> { diff --git a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java index 29d727983..b106ccbd6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java @@ -223,7 +223,7 @@ public class HomeCommand extends Command { } @Override - public Collection tab(PlotPlayer player, String[] args, boolean space) { + public Collection tab(PlotPlayer player, String[] args, boolean space) { final List completions = new ArrayList<>(); switch (args.length - 1) { case 0: diff --git a/Core/src/main/java/com/plotsquared/core/command/Kick.java b/Core/src/main/java/com/plotsquared/core/command/Kick.java index ff9f40acc..312546066 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Kick.java +++ b/Core/src/main/java/com/plotsquared/core/command/Kick.java @@ -153,7 +153,7 @@ public class Kick extends SubCommand { } @Override - public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { + public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { Location location = player.getLocation(); Plot plot = location.getPlotAbs(); if (plot == null) { diff --git a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java index a2f158509..4e9d3d404 100644 --- a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java @@ -86,7 +86,7 @@ public class ListCmd extends SubCommand { this.econHandler = econHandler; } - private String[] getArgumentList(PlotPlayer player) { + private String[] getArgumentList(PlotPlayer player) { List args = new ArrayList<>(); if (this.econHandler != null && Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) { args.add("forsale"); diff --git a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java index ca7640721..a256e2192 100644 --- a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java @@ -348,7 +348,7 @@ public class MainCommand extends Command { } @Override - public boolean canExecute(PlotPlayer player, boolean message) { + public boolean canExecute(PlotPlayer player, boolean message) { return true; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Merge.java b/Core/src/main/java/com/plotsquared/core/command/Merge.java index b76b56995..9fdc6088d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Merge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Merge.java @@ -260,7 +260,7 @@ public class Merge extends SubCommand { java.util.Set uuids = adjacent.getOwners(); boolean isOnline = false; for (final UUID owner : uuids) { - final PlotPlayer accepter = PlotSquared.platform().playerManager().getPlayerIfExists(owner); + final PlotPlayer accepter = PlotSquared.platform().playerManager().getPlayerIfExists(owner); if (!force && accepter == null) { continue; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Owner.java b/Core/src/main/java/com/plotsquared/core/command/Owner.java index 0afc6c288..24cd1e435 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Owner.java +++ b/Core/src/main/java/com/plotsquared/core/command/Owner.java @@ -68,7 +68,7 @@ public class Owner extends SetCommand { } @Override - public boolean set(final PlotPlayer player, final Plot plot, String value) { + public boolean set(final PlotPlayer player, final Plot plot, String value) { if (value == null || value.isEmpty()) { player.sendMessage(TranslatableCaption.of("owner.set_owner_missing_player")); player.sendMessage( diff --git a/Core/src/main/java/com/plotsquared/core/command/Remove.java b/Core/src/main/java/com/plotsquared/core/command/Remove.java index 6cb580d68..0f1fa54a9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Remove.java +++ b/Core/src/main/java/com/plotsquared/core/command/Remove.java @@ -136,7 +136,7 @@ public class Remove extends SubCommand { } @Override - public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { + public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { Location location = player.getLocation(); Plot plot = location.getPlotAbs(); if (plot == null) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Set.java b/Core/src/main/java/com/plotsquared/core/command/Set.java index 47086f8c2..1b4abb6f9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Set.java +++ b/Core/src/main/java/com/plotsquared/core/command/Set.java @@ -83,7 +83,7 @@ public class Set extends SubCommand { } @Override - public boolean set(PlotPlayer player, final Plot plot, String value) { + public boolean set(PlotPlayer player, final Plot plot, String value) { final PlotArea plotArea = player.getLocation().getPlotArea(); if (plotArea == null) { return false; @@ -190,7 +190,7 @@ public class Set extends SubCommand { @Override public Collection tab( - final PlotPlayer player, final String[] args, + final PlotPlayer player, final String[] args, final boolean space ) { return TabCompletions.completePatterns(StringMan.join(args, ",")); @@ -198,7 +198,7 @@ public class Set extends SubCommand { }; } - public boolean noArgs(PlotPlayer player) { + public boolean noArgs(PlotPlayer player) { ArrayList newValues = new ArrayList<>(Arrays.asList("biome", "alias", "home")); Plot plot = player.getCurrentPlot(); if (plot != null) { diff --git a/Core/src/main/java/com/plotsquared/core/command/SetCommand.java b/Core/src/main/java/com/plotsquared/core/command/SetCommand.java index df2e9f120..3ea7868ce 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SetCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/SetCommand.java @@ -70,6 +70,6 @@ public abstract class SetCommand extends SubCommand { return set(player, plot, StringMan.join(args, " ")); } - public abstract boolean set(PlotPlayer player, Plot plot, String value); + public abstract boolean set(PlotPlayer player, Plot plot, String value); } diff --git a/Core/src/main/java/com/plotsquared/core/command/SetHome.java b/Core/src/main/java/com/plotsquared/core/command/SetHome.java index 9fd3d37b9..abfce7fc7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SetHome.java +++ b/Core/src/main/java/com/plotsquared/core/command/SetHome.java @@ -41,7 +41,7 @@ import net.kyori.adventure.text.minimessage.Template; public class SetHome extends SetCommand { @Override - public boolean set(PlotPlayer player, Plot plot, String value) { + public boolean set(PlotPlayer player, Plot plot, String value) { switch (value.toLowerCase()) { case "unset": case "reset": diff --git a/Core/src/main/java/com/plotsquared/core/command/Setup.java b/Core/src/main/java/com/plotsquared/core/command/Setup.java index d00ab9f82..d6473725e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Setup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Setup.java @@ -118,7 +118,7 @@ public class Setup extends SubCommand { } @Override - public Collection tab(PlotPlayer player, String[] args, boolean space) { + public Collection tab(PlotPlayer player, String[] args, boolean space) { SetupProcess process; try (final MetaDataAccess metaDataAccess = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SETUP)) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Trust.java b/Core/src/main/java/com/plotsquared/core/command/Trust.java index d7263c38e..c8685d110 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trust.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trust.java @@ -166,7 +166,7 @@ public class Trust extends Command { } @Override - public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { + public Collection tab(final PlotPlayer player, final String[] args, final boolean space) { return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList()); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Visit.java b/Core/src/main/java/com/plotsquared/core/command/Visit.java index b2e668d2e..8193b0cff 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Visit.java +++ b/Core/src/main/java/com/plotsquared/core/command/Visit.java @@ -73,7 +73,7 @@ public class Visit extends Command { } private void visit( - final @NonNull PlotPlayer player, final @NonNull PlotQuery query, final PlotArea sortByArea, + final @NonNull PlotPlayer player, final @NonNull PlotQuery query, final PlotArea sortByArea, final RunnableVal3 confirm, final RunnableVal2 whenDone, int page ) { // We get the query once, @@ -311,7 +311,7 @@ public class Visit extends Command { } @Override - public Collection tab(PlotPlayer player, String[] args, boolean space) { + public Collection tab(PlotPlayer player, String[] args, boolean space) { final List completions = new ArrayList<>(); switch (args.length - 1) { case 0: diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Config.java b/Core/src/main/java/com/plotsquared/core/configuration/Config.java index 3d333f919..f5b43eff8 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Config.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Config.java @@ -134,7 +134,7 @@ public class Config { file.createNewFile(); } try (PrintWriter writer = new PrintWriter(file)) { - Object instance = root.newInstance(); + Object instance = root.getDeclaredConstructor().newInstance(); save(writer, root, instance, 0); } } catch (Throwable e) { @@ -184,7 +184,7 @@ public class Config { return value != null ? value.toString() : "null"; } - private static void save(PrintWriter writer, Class clazz, Object instance, int indent) { + private static void save(PrintWriter writer, Class clazz, Object instance, int indent) { try { String lineSeparator = System.lineSeparator(); String spacing = StringMan.repeat(" ", indent); @@ -204,9 +204,9 @@ public class Config { if (value == null && field.getType() != ConfigBlock.class) { setAccessible(field); Class[] classes = clazz.getDeclaredClasses(); - for (Class current : classes) { + for (Class current : classes) { if (StringMan.isEqual(current.getSimpleName(), field.getName())) { - field.set(instance, current.newInstance()); + field.set(instance, current.getDeclaredConstructor().newInstance()); break; } } @@ -235,12 +235,12 @@ public class Config { Field instanceField = clazz.getDeclaredField(toFieldName(current.getSimpleName())); setAccessible(instanceField); - ConfigBlock value = (ConfigBlock) instanceField.get(instance); + ConfigBlock value = (ConfigBlock) instanceField.get(instance); if (value == null) { value = new ConfigBlock(); instanceField.set(instance, value); for (String blockName : blockNames.value()) { - value.put(blockName, current.newInstance()); + value.put(blockName, current.getDeclaredConstructor().newInstance()); } } // Save each instance @@ -250,9 +250,8 @@ public class Config { writer.write(spacing + " " + toNodeName(key) + ":" + lineSeparator); save(writer, current, entry.getValue(), indent + 4); } - continue; } else { - save(writer, current, current.newInstance(), indent + 2); + save(writer, current, current.getDeclaredConstructor().newInstance(), indent + 2); } } } catch (Throwable e) { @@ -307,7 +306,7 @@ public class Config { private static Object getInstance(String[] split, Class root) { try { Class clazz = root == null ? MethodHandles.lookup().lookupClass() : root; - Object instance = clazz.newInstance(); + Object instance = clazz.getDeclaredConstructor().newInstance(); while (split.length > 0) { if (split.length == 1) { return instance; @@ -326,7 +325,7 @@ public class Config { if (instanceField.getType() != ConfigBlock.class) { Object value = instanceField.get(instance); if (value == null) { - value = found.newInstance(); + value = found.getDeclaredConstructor().newInstance(); instanceField.set(instance, value); } clazz = found; @@ -334,14 +333,14 @@ public class Config { split = Arrays.copyOfRange(split, 1, split.length); continue; } - ConfigBlock value = (ConfigBlock) instanceField.get(instance); + ConfigBlock value = (ConfigBlock) instanceField.get(instance); if (value == null) { value = new ConfigBlock(); instanceField.set(instance, value); } instance = value.get(split[1]); if (instance == null) { - instance = found.newInstance(); + instance = found.getDeclaredConstructor().newInstance(); value.put(split[1], instance); } clazz = found; @@ -352,7 +351,7 @@ public class Config { if (found != null) { split = Arrays.copyOfRange(split, 1, split.length); clazz = found; - instance = clazz.newInstance(); + instance = clazz.getDeclaredConstructor().newInstance(); continue; } return null; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationNode.java b/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationNode.java index 9e0e5a9d3..3c884bb23 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationNode.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationNode.java @@ -42,20 +42,20 @@ public class ConfigurationNode { private final String constant; private final Object defaultValue; private final String description; - private final ConfigurationUtil.SettingValue type; + private final ConfigurationUtil.SettingValue type; private final Collection suggestions; private Object value; public ConfigurationNode( String constant, Object defaultValue, String description, - ConfigurationUtil.SettingValue type + ConfigurationUtil.SettingValue type ) { this(constant, defaultValue, description, type, new ArrayList<>()); } public ConfigurationNode( String constant, Object defaultValue, String description, - ConfigurationUtil.SettingValue type, Collection suggestions + ConfigurationUtil.SettingValue type, Collection suggestions ) { this.constant = constant; this.defaultValue = defaultValue; @@ -65,7 +65,7 @@ public class ConfigurationNode { this.suggestions = suggestions; } - public ConfigurationUtil.SettingValue getType() { + public ConfigurationUtil.SettingValue getType() { return this.type; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java index 58a39982e..5931b12ce 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerClaimPlotEvent.java @@ -42,7 +42,7 @@ public class PlayerClaimPlotEvent extends PlotPlayerEvent implements Cancellable * @param plot Plot that was claimed * @param schematic The schematic defined or null */ - public PlayerClaimPlotEvent(PlotPlayer player, Plot plot, @Nullable String schematic) { + public PlayerClaimPlotEvent(PlotPlayer player, Plot plot, @Nullable String schematic) { super(player, plot); this.schematic = schematic; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java index b792036d7..aaa4a8924 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerEnterPlotEvent.java @@ -36,7 +36,7 @@ public class PlayerEnterPlotEvent extends PlotPlayerEvent { * @param player Player that entered the plot * @param plot Plot that was entered */ - public PlayerEnterPlotEvent(PlotPlayer player, Plot plot) { + public PlayerEnterPlotEvent(PlotPlayer player, Plot plot) { super(player, plot); } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java index 20509c5d7..ef0d549ac 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerLeavePlotEvent.java @@ -39,7 +39,7 @@ public class PlayerLeavePlotEvent extends PlotPlayerEvent { * @param player Player that left the plot * @param plot Plot that was left */ - public PlayerLeavePlotEvent(PlotPlayer player, Plot plot) { + public PlayerLeavePlotEvent(PlotPlayer player, Plot plot) { super(player, plot); } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java index 2384fd034..1862c7a62 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotDeniedEvent.java @@ -32,7 +32,7 @@ import java.util.UUID; public class PlayerPlotDeniedEvent extends PlotEvent { - private final PlotPlayer initiator; + private final PlotPlayer initiator; private final boolean added; private final UUID player; @@ -44,7 +44,7 @@ public class PlayerPlotDeniedEvent extends PlotEvent { * @param player Player that was denied/un-denied * @param added true of add to deny list, false if removed */ - public PlayerPlotDeniedEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + public PlayerPlotDeniedEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) { super(plot); this.initiator = initiator; this.added = added; @@ -74,7 +74,7 @@ public class PlayerPlotDeniedEvent extends PlotEvent { * * @return PlotPlayer */ - public PlotPlayer getInitiator() { + public PlotPlayer getInitiator() { return this.initiator; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java index 92382b462..3ae1f14a3 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotHelperEvent.java @@ -35,7 +35,7 @@ import java.util.UUID; */ public class PlayerPlotHelperEvent extends PlotEvent { - private final PlotPlayer initiator; + private final PlotPlayer initiator; private final boolean added; private final UUID player; @@ -47,7 +47,7 @@ public class PlayerPlotHelperEvent extends PlotEvent { * @param player Player that was added/removed from the helper list * @param added true of the player was added, false if the player was removed */ - public PlayerPlotHelperEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + public PlayerPlotHelperEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) { super(plot); this.initiator = initiator; this.added = added; @@ -77,7 +77,7 @@ public class PlayerPlotHelperEvent extends PlotEvent { * * @return PlotPlayer */ - public PlotPlayer getInitiator() { + public PlotPlayer getInitiator() { return this.initiator; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java index ee4e789ae..b24d1c5d9 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerPlotTrustedEvent.java @@ -32,7 +32,7 @@ import java.util.UUID; public class PlayerPlotTrustedEvent extends PlotEvent { - private final PlotPlayer initiator; + private final PlotPlayer initiator; private final boolean added; private final UUID player; @@ -44,7 +44,7 @@ public class PlayerPlotTrustedEvent extends PlotEvent { * @param player Player that was added/removed from the trusted list * @param added true of the player was added, false if the player was removed */ - public PlayerPlotTrustedEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + public PlayerPlotTrustedEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) { super(plot); this.initiator = initiator; this.added = added; @@ -74,7 +74,7 @@ public class PlayerPlotTrustedEvent extends PlotEvent { * * @return PlotPlayer */ - public PlotPlayer getInitiator() { + public PlotPlayer getInitiator() { return this.initiator; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java index f98079bd2..b6ae7123b 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java @@ -44,7 +44,7 @@ public class PlayerTeleportToPlotEvent extends PlotPlayerEvent implements Cancel * @param from Start location * @param plot Plot to which the player was teleported */ - public PlayerTeleportToPlotEvent(PlotPlayer player, Location from, Plot plot) { + public PlayerTeleportToPlotEvent(PlotPlayer player, Location from, Plot plot) { super(player, plot); this.from = from; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java index 44fac8d54..e8c92f4b2 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java @@ -34,12 +34,12 @@ import java.util.UUID; public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEvent { - private final PlotPlayer initiator; + private final PlotPlayer initiator; @Nullable private final UUID oldOwner; @Nullable private UUID newOwner; - private boolean hasOldOwner; + private final boolean hasOldOwner; private Result eventResult; /** @@ -52,7 +52,7 @@ public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEv * @param hasOldOwner If the plot has an old owner */ public PlotChangeOwnerEvent( - PlotPlayer initiator, Plot plot, @Nullable UUID oldOwner, + PlotPlayer initiator, Plot plot, @Nullable UUID oldOwner, @Nullable UUID newOwner, boolean hasOldOwner ) { super(plot); @@ -81,11 +81,11 @@ public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEv } /** - * Get the change-owner initator + * Get the change-owner initiator * * @return Player */ - public PlotPlayer getInitiator() { + public PlotPlayer getInitiator() { return this.initiator; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java index 04c2e8c85..00c2252f1 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java @@ -40,7 +40,7 @@ public final class PlotMergeEvent extends PlotPlayerEvent implements Cancellable private Direction dir; private int max; private Result eventResult; - private PlotPlayer player; + private final PlotPlayer player; /** * PlotMergeEvent: Called when plots are merged @@ -93,7 +93,7 @@ public final class PlotMergeEvent extends PlotPlayerEvent implements Cancellable this.max = max; } - public PlotPlayer getPlayer() { + public PlotPlayer getPlayer() { return this.player; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java index 3f14313e2..0255f8776 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotPlayerEvent.java @@ -30,14 +30,14 @@ import com.plotsquared.core.plot.Plot; public abstract class PlotPlayerEvent extends PlotEvent { - private final PlotPlayer plotPlayer; + private final PlotPlayer plotPlayer; - public PlotPlayerEvent(PlotPlayer plotPlayer, Plot plot) { + public PlotPlayerEvent(PlotPlayer plotPlayer, Plot plot) { super(plot); this.plotPlayer = plotPlayer; } - public PlotPlayer getPlotPlayer() { + public PlotPlayer getPlotPlayer() { return this.plotPlayer; } diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java index 9ba033b21..a35cf02f8 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java @@ -32,7 +32,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; public class PlotRateEvent extends PlotEvent implements CancellablePlotEvent { - private final PlotPlayer rater; + private final PlotPlayer rater; @Nullable private Rating rating; private Result eventResult; @@ -44,13 +44,13 @@ public class PlotRateEvent extends PlotEvent implements CancellablePlotEvent { * @param rating The rating being given * @param plot The plot being rated */ - public PlotRateEvent(PlotPlayer rater, @Nullable Rating rating, Plot plot) { + public PlotRateEvent(PlotPlayer rater, @Nullable Rating rating, Plot plot) { super(plot); this.rater = rater; this.rating = rating; } - public PlotPlayer getRater() { + public PlotPlayer getRater() { return this.rater; } diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index 9b377081f..2c6e0f2f2 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -173,7 +173,7 @@ public class PlotListener { if (plot.getFlag(NotifyEnterFlag.class)) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { for (UUID uuid : plot.getOwners()) { - final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); + final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { player.sendMessage( TranslatableCaption.of("notification.notify_enter"), @@ -381,7 +381,7 @@ public class PlotListener { if (plot.getFlag(NotifyLeaveFlag.class)) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { for (UUID uuid : plot.getOwners()) { - final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); + final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { player.sendMessage( TranslatableCaption.of("notification.notify_leave"), diff --git a/Core/src/main/java/com/plotsquared/core/player/MetaDataKey.java b/Core/src/main/java/com/plotsquared/core/player/MetaDataKey.java index be014393e..3a98a8ece 100644 --- a/Core/src/main/java/com/plotsquared/core/player/MetaDataKey.java +++ b/Core/src/main/java/com/plotsquared/core/player/MetaDataKey.java @@ -41,7 +41,7 @@ import java.util.Map; */ public final class MetaDataKey { - private static final Map keyMap = new HashMap<>(); + private static final Map> keyMap = new HashMap<>(); private static final Object keyMetaData = new Object(); private final String key; @@ -82,7 +82,7 @@ public final class MetaDataKey { if (o == null || getClass() != o.getClass()) { return false; } - final MetaDataKey lockKey = (MetaDataKey) o; + final MetaDataKey lockKey = (MetaDataKey) o; return Objects.equal(this.key, lockKey.key); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 5e8d0ce40..979699261 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -121,6 +121,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; */ public class Plot { + public static final int MAX_HEIGHT = 256; private static final Logger logger = LoggerFactory.getLogger("P2/" + Plot.class.getSimpleName()); @@ -2134,7 +2135,7 @@ public class Plot { * @param player the claiming player * @return if the given player can claim the plot */ - public boolean canClaim(@NonNull PlotPlayer player) { + public boolean canClaim(@NonNull PlotPlayer player) { PlotCluster cluster = this.getCluster(); if (cluster != null) { if (!cluster.isAdded(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.claim")) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java index 1e0039d38..b9ef1b7c7 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -716,7 +716,7 @@ public abstract class PlotArea { * @deprecated Use {@link #getPlots(UUID)} */ @Deprecated - public Set getPlots(final @NonNull PlotPlayer player) { + public Set getPlots(final @NonNull PlotPlayer player) { return getPlots(player.getUUID()); } @@ -872,7 +872,7 @@ public abstract class PlotArea { return this.plots.put(plot.getId(), plot) == null; } - public Plot getNextFreePlot(final PlotPlayer player, @Nullable PlotId start) { + public Plot getNextFreePlot(final PlotPlayer player, @Nullable PlotId start) { int plots; PlotId center; PlotId min = getMin(); @@ -968,7 +968,7 @@ public abstract class PlotArea { } public @Nullable List canClaim( - final @Nullable PlotPlayer player, final @NonNull PlotId pos1, + final @Nullable PlotPlayer player, final @NonNull PlotId pos1, final @NonNull PlotId pos2 ) { if (pos1.getX() == pos2.getX() && pos1.getY() == pos2.getY()) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java b/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java index 7fe0df4a0..2f4a9a112 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotManager.java @@ -210,6 +210,11 @@ public abstract class PlotManager { Template.zipAll(plotArea.getWorldName(), files); } + /** + * @return the world height + * @deprecated In favor of custom world heights within 1.17 and therefore scheduled for removal without replacement + */ + @Deprecated public int getWorldHeight() { return 255; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java index 1bb0953a3..c5ba0004d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java @@ -55,7 +55,7 @@ public class DenyTeleportFlag extends PlotFlag player, Plot plot) { final DeniedGroup value = plot.getFlag(DenyTeleportFlag.class); if (value == DeniedGroup.NONE) { return true; diff --git a/Core/src/main/java/com/plotsquared/core/queue/ChunkQueueCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/ChunkQueueCoordinator.java index d992899a8..ccc7b4adf 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/ChunkQueueCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/ChunkQueueCoordinator.java @@ -89,7 +89,7 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator { @Override public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) { - this.storeCache(x, y, z, pattern.apply(BlockVector3.at(x, y, z)).toImmutableState()); + this.storeCache(x, y, z, pattern.applyBlock(BlockVector3.at(x, y, z)).toImmutableState()); return true; } diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateQueueCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateQueueCoordinator.java index af4d80f62..f94d20205 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateQueueCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateQueueCoordinator.java @@ -82,7 +82,7 @@ public class LocationOffsetDelegateQueueCoordinator extends DelegateQueueCoordin @Override public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) { final BlockVector3 blockVector3 = BlockVector3.at(x + blockX, y, z + blockZ); - return this.setBlock(x, y, z, pattern.apply(blockVector3)); + return this.setBlock(x, y, z, pattern.applyBlock(blockVector3)); } @Override diff --git a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java index 25e206b2a..5ea18e611 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java @@ -199,6 +199,8 @@ public abstract class QueueCoordinator { * @param z z coordinate * @param biome biome * @return success or not + * + * @deprecated Biomes now take XYZ, see {@code setBiome int x, int y, int z} */ @Deprecated public abstract boolean setBiome(int x, int z, @NonNull BiomeType biome); diff --git a/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java b/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java index 4d1795e4b..22b8fe2ca 100644 --- a/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/ChunkManager.java @@ -101,6 +101,6 @@ public abstract class ChunkManager { } @Deprecated - public abstract CompletableFuture loadChunk(String world, BlockVector2 loc, boolean force); + public abstract CompletableFuture loadChunk(String world, BlockVector2 loc, boolean force); } diff --git a/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java b/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java index dd5bf5716..c4448f910 100644 --- a/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/InventoryUtil.java @@ -43,7 +43,7 @@ public abstract class InventoryUtil { final PlotItemStack item ); - public abstract PlotItemStack[] getItems(final PlotPlayer player); + public abstract PlotItemStack[] getItems(final PlotPlayer player); public abstract boolean isOpen(final PlotInventory plotInventory); diff --git a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java index 0801ffd57..0321ee164 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java @@ -54,12 +54,12 @@ public class PatternUtil { if (pattern instanceof BlockPattern || pattern instanceof RandomPattern || pattern instanceof BlockState || pattern instanceof BlockType || pattern instanceof BaseBlock) { - return pattern.apply(BlockVector3.ZERO); + return pattern.applyBlock(BlockVector3.ZERO); } - return pattern.apply(BlockVector3.at(x, y, z)); + return pattern.applyBlock(BlockVector3.at(x, y, z)); } - public static Pattern parse(PlotPlayer plotPlayer, String input) { + public static Pattern parse(PlotPlayer plotPlayer, String input) { return parse(plotPlayer, input, true); } @@ -71,7 +71,7 @@ public class PatternUtil { return new ArrayList<>(); } - public static Pattern parse(PlotPlayer plotPlayer, String input, boolean allowLegacy) { + public static Pattern parse(PlotPlayer plotPlayer, String input, boolean allowLegacy) { ParserContext context = new ParserContext(); if (plotPlayer != null) { Actor actor = plotPlayer.toActor(); diff --git a/Core/src/main/java/com/plotsquared/core/util/ReflectionUtils.java b/Core/src/main/java/com/plotsquared/core/util/ReflectionUtils.java index d1cd690a3..7eb24d413 100644 --- a/Core/src/main/java/com/plotsquared/core/util/ReflectionUtils.java +++ b/Core/src/main/java/com/plotsquared/core/util/ReflectionUtils.java @@ -100,7 +100,7 @@ public class ReflectionUtils { * @param clazz class * @return RefClass based on passed class */ - public static RefClass getRefClass(Class clazz) { + public static RefClass getRefClass(Class clazz) { return new RefClass(clazz); } @@ -133,11 +133,11 @@ public class ReflectionUtils { * @throws NoSuchMethodException if method not found */ public RefMethod getMethod(String name, Object... types) throws NoSuchMethodException { - Class[] classes = new Class[types.length]; + Class[] classes = new Class[types.length]; int i = 0; for (Object e : types) { if (e instanceof Class) { - classes[i++] = (Class) e; + classes[i++] = (Class) e; } else if (e instanceof RefClass) { classes[i++] = ((RefClass) e).getRealClass(); } else { @@ -232,9 +232,9 @@ public class ReflectionUtils { */ public static class RefConstructor { - private final Constructor constructor; + private final Constructor constructor; - private RefConstructor(Constructor constructor) { + private RefConstructor(Constructor constructor) { this.constructor = constructor; constructor.setAccessible(true); } diff --git a/Core/src/main/java/com/plotsquared/core/util/StringMan.java b/Core/src/main/java/com/plotsquared/core/util/StringMan.java index f61e6418e..ee7a614b8 100644 --- a/Core/src/main/java/com/plotsquared/core/util/StringMan.java +++ b/Core/src/main/java/com/plotsquared/core/util/StringMan.java @@ -312,7 +312,7 @@ public class StringMan { return null; } startsWith = startsWith.toLowerCase(); - Iterator iterator = col.iterator(); + Iterator iterator = col.iterator(); while (iterator.hasNext()) { Object item = iterator.next(); if (item == null || !item.toString().toLowerCase().startsWith(startsWith)) { diff --git a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpMenu.java b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpMenu.java index c536b39cb..79b0c00df 100644 --- a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpMenu.java +++ b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpMenu.java @@ -36,13 +36,13 @@ public class HelpMenu { private static final int PER_PAGE = 5; - private final PlotPlayer commandCaller; + private final PlotPlayer commandCaller; private HelpPage page = new HelpPage(CommandCategory.INFO, 0, 0); private int maxPage; private CommandCategory commandCategory; private List commands; - public HelpMenu(PlotPlayer commandCaller) { + public HelpMenu(PlotPlayer commandCaller) { this.commandCaller = commandCaller; } diff --git a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java index 50122a4a3..309e29ab8 100644 --- a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java +++ b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java @@ -51,7 +51,7 @@ public class HelpPage { this.maxTemplate = Template.of("max", String.valueOf(maxPages + 1)); } - public void render(PlotPlayer player) { + public void render(PlotPlayer player) { if (this.helpObjects.size() < 1) { player.sendMessage(TranslatableCaption.of("invalid.not_valid_number"), Template.of("value", "(0)")); } else { diff --git a/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java b/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java index 24343e58d..e31c7c861 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java @@ -197,7 +197,7 @@ public final class PlotQuery implements Iterable { * @param owner Owner * @return The query instance */ - public @NonNull PlotQuery ownedBy(final @NonNull PlotPlayer owner) { + public @NonNull PlotQuery ownedBy(final @NonNull PlotPlayer owner) { Preconditions.checkNotNull(owner, "Owner may not be null"); return this.addFilter(new OwnerFilter(owner.getUUID())); }