From 2988ad6b119e3d55ccb4b7087f656183cdb69c0b Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 18 Aug 2021 11:58:18 +0200 Subject: [PATCH] Address style violations --- .github/workflows/build.yml | 4 +- .../plotsquared/bukkit/BukkitPlatform.java | 27 +++--- .../entity/ReplicatingEntityWrapper.java | 4 +- .../bukkit/listener/BlockEventListener.java | 1 + .../bukkit/listener/EntityEventListener.java | 3 +- .../bukkit/listener/PlayerEventListener.java | 7 +- .../managers/MultiverseWorldManager.java | 3 +- .../bukkit/player/BukkitOfflinePlayer.java | 6 +- .../plotsquared/bukkit/util/BukkitUtil.java | 89 ++++++++++--------- .../plotsquared/bukkit/util/ContentMap.java | 4 +- .../bukkit/util/UpdateUtility.java | 4 +- .../bukkit/uuid/SquirrelIdUUIDService.java | 2 +- .../java/com/plotsquared/core/PlotAPI.java | 5 +- .../com/plotsquared/core/PlotSquared.java | 8 +- .../core/backup/PlayerBackupProfile.java | 1 + .../com/plotsquared/core/command/Area.java | 28 +++--- .../com/plotsquared/core/command/Backup.java | 11 ++- .../com/plotsquared/core/command/Buy.java | 3 +- .../com/plotsquared/core/command/Caps.java | 4 +- .../com/plotsquared/core/command/Claim.java | 2 +- .../com/plotsquared/core/command/Cluster.java | 22 +++-- .../plotsquared/core/command/Condense.java | 4 +- .../com/plotsquared/core/command/Copy.java | 3 +- .../com/plotsquared/core/command/Debug.java | 2 +- .../plotsquared/core/command/DebugExec.java | 3 +- .../com/plotsquared/core/command/Dislike.java | 4 +- .../plotsquared/core/command/Download.java | 4 +- .../plotsquared/core/command/FlagCommand.java | 12 ++- .../com/plotsquared/core/command/Grant.java | 4 +- .../com/plotsquared/core/command/Help.java | 17 ++-- .../com/plotsquared/core/command/Inbox.java | 8 +- .../com/plotsquared/core/command/Info.java | 4 +- .../com/plotsquared/core/command/Like.java | 4 +- .../com/plotsquared/core/command/ListCmd.java | 4 +- .../com/plotsquared/core/command/Music.java | 14 ++- .../com/plotsquared/core/command/Owner.java | 3 +- .../com/plotsquared/core/command/Purge.java | 2 +- .../com/plotsquared/core/command/Rate.java | 4 +- .../core/command/SchematicCmd.java | 4 +- .../com/plotsquared/core/command/Set.java | 4 +- .../com/plotsquared/core/command/Swap.java | 3 +- .../plotsquared/core/command/Template.java | 4 +- .../com/plotsquared/core/command/Trim.java | 2 +- .../components/ComponentPresetManager.java | 12 ++- .../core/configuration/Settings.java | 1 + .../configuration/caption/CaptionUtility.java | 5 +- .../configuration/caption/ChatFormatter.java | 1 - .../caption/ClickStripTransform.java | 5 +- .../caption/NestedComponentTransform.java | 4 +- .../caption/load/CaptionLoader.java | 5 +- .../load/ClassLoaderCaptionProvider.java | 4 +- .../caption/load/DefaultCaptionProvider.java | 2 +- .../ConfigurationSerialization.java | 10 +-- .../plotsquared/core/database/SQLManager.java | 19 ++-- .../core/events/PlotChangeOwnerEvent.java | 2 +- .../core/events/PlotMergeEvent.java | 2 +- .../core/generator/ClassicPlotManager.java | 57 ++++++++---- .../core/generator/HybridPlotWorld.java | 6 +- .../core/generator/HybridUtils.java | 11 ++- .../core/generator/SquarePlotManager.java | 4 +- .../core/generator/SquarePlotWorld.java | 4 +- .../core/listener/ProcessedWEExtent.java | 5 +- .../core/permissions/Permission.java | 3 +- .../core/player/MetaDataAccess.java | 6 +- .../core/player/PlayerMetaDataKeys.java | 45 +++++++--- .../plotsquared/core/player/PlotPlayer.java | 26 +++--- .../plotsquared/core/plot/BlockBucket.java | 4 +- .../java/com/plotsquared/core/plot/Plot.java | 31 ++++--- .../com/plotsquared/core/plot/PlotArea.java | 10 +-- .../core/plot/PlotModificationManager.java | 12 +-- .../com/plotsquared/core/plot/PlotTitle.java | 1 + .../com/plotsquared/core/plot/PlotWorld.java | 9 +- .../core/plot/comment/CommentInbox.java | 4 +- .../core/plot/expiration/PlotAnalysis.java | 10 ++- .../core/plot/flag/FlagContainer.java | 2 +- .../plotsquared/core/plot/flag/PlotFlag.java | 3 +- .../flag/implementations/PlotTitleFlag.java | 6 +- .../plot/flag/types/BlockTypeWrapper.java | 4 +- .../core/plot/world/SinglePlotArea.java | 7 +- .../core/queue/BasicQueueCoordinator.java | 6 +- .../core/queue/ChunkCoordinatorBuilder.java | 3 +- .../core/queue/QueueCoordinator.java | 23 +++-- .../plotsquared/core/queue/QueueProvider.java | 2 +- .../subscriber/DefaultProgressSubscriber.java | 1 - .../core/setup/CommonSetupSteps.java | 4 +- .../com/plotsquared/core/util/BlockUtil.java | 8 +- .../core/util/LegacyConverter.java | 8 +- .../plotsquared/core/util/PlayerManager.java | 14 +-- .../plotsquared/core/util/PlotUploader.java | 4 +- .../core/util/SchematicHandler.java | 4 +- .../core/util/StringComparison.java | 2 +- .../com/plotsquared/core/util/WorldUtil.java | 21 +++-- .../core/util/placeholders/Placeholder.java | 6 +- .../placeholders/PlotSpecificPlaceholder.java | 6 +- .../core/util/query/SortingStrategy.java | 2 +- .../plotsquared/core/uuid/UUIDPipeline.java | 22 ++--- .../caption/ClickStripTransformTest.java | 4 +- .../com/plotsquared/core/plot/FlagTest.java | 4 +- .../core/plot/PlotVersionTest.java | 2 +- 99 files changed, 494 insertions(+), 345 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a70511997..c8e842bfa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,9 +9,9 @@ jobs: - name: "Checkout Repository" uses: "actions/checkout@v2.3.4" - name: "Setup JDK 16" - uses: "actions/setup-java@v2.1.0" + uses: "actions/setup-java@v2.2.0" with: - distribution: "adopt" + distribution: "temurin" java-version: "16" - name: "Clean Build" run: "./gradlew clean build" diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index b4d5ebc19..03b13ea02 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -120,6 +120,8 @@ import io.papermc.lib.PaperLib; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bstats.bukkit.Metrics; import org.bstats.charts.DrilldownPie; import org.bstats.charts.SimplePie; @@ -140,8 +142,6 @@ import org.bukkit.plugin.java.JavaPlugin; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.incendo.serverlib.ServerLib; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.File; import java.lang.reflect.Method; @@ -274,7 +274,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl // We create the injector after PlotSquared has been initialized, so that we have access // to generated instances and settings this.injector = Guice - .createInjector(Stage.PRODUCTION, + .createInjector( + Stage.PRODUCTION, new PermissionModule(), new WorldManagerModule(), new PlotSquaredModule(), @@ -853,7 +854,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl if (area != null) { PlotId currentPlotId = area.getPlotAbs(pLoc).getId(); if (!originalPlotId.equals(currentPlotId) && (currentPlotId == null || !area.getPlot( - originalPlotId) + originalPlotId) .equals(area.getPlot(currentPlotId)))) { if (entity.hasMetadata("ps-tmp-teleport")) { continue; @@ -991,10 +992,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl } @Override - public @Nullable final ChunkGenerator getDefaultWorldGenerator( + public @Nullable + final ChunkGenerator getDefaultWorldGenerator( final @NonNull String worldName, - final @Nullable String id) - { + final @Nullable String id + ) { final IndependentPlotGenerator result; if (id != null && id.equalsIgnoreCase("single")) { result = injector().getInstance(SingleWorldGenerator.class); @@ -1023,7 +1025,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl } return new BukkitPlotGenerator(world, gen, this.plotAreaManager); } else { - return new BukkitPlotGenerator(world, + return new BukkitPlotGenerator( + world, injector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)), this.plotAreaManager ); @@ -1088,11 +1091,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl String manager = worldConfig.getString("generator.plugin", pluginName()); PlotAreaBuilder builder = PlotAreaBuilder.newBuilder().plotManager(manager).generatorName(worldConfig.getString( - "generator.init", - manager - )) + "generator.init", + manager + )) .plotAreaType(ConfigurationUtil.getType(worldConfig)).terrainType(ConfigurationUtil.getTerrain( - worldConfig)) + worldConfig)) .settingsNodesWrapper(new SettingsNodesWrapper(new ConfigurationNode[0], null)).worldName(worldName); injector().getInstance(SetupUtils.class).setupWorld(builder); world = Bukkit.getWorld(worldName); 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 e966627a9..f0192fee7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java @@ -26,6 +26,8 @@ package com.plotsquared.bukkit.entity; import com.plotsquared.core.configuration.Settings; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bukkit.Art; import org.bukkit.DyeColor; import org.bukkit.Location; @@ -55,8 +57,6 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.util.EulerAngle; import org.bukkit.util.Vector; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.util.List; 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 cd2fec2b8..f3cd52005 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -1209,4 +1209,5 @@ public class BlockEventListener implements Listener { event.setCancelled(true); } } + } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java index 6d18d8a07..826aef2a2 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -349,7 +349,8 @@ public class EntityEventListener implements Listener { // trampling farmland BlockType blockType = BukkitAdapter.asBlockType(type); if (!this.eventDispatcher.checkPlayerBlockEvent(pp, - PlayerBlockEventType.TRIGGER_PHYSICAL, location, blockType, true)) { + PlayerBlockEventType.TRIGGER_PHYSICAL, location, blockType, true + )) { event.setCancelled(true); } return; 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 c8bc826bc..a6705d2a6 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -711,7 +711,8 @@ public class PlayerEventListener extends PlotListener implements Listener { // allowing colour. if (plotPlayer.hasPermission("plots.chat.color")) { msgTemplate = Template - .of("msg", + .of( + "msg", BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes( '&', message @@ -1116,7 +1117,9 @@ public class PlayerEventListener extends PlotListener implements Listener { // todo: when the code above is rearranged, it would be great to beautify this as well. // will code this as a temporary, specific bug fix (for dragon eggs) - if (blockType != Material.DRAGON_EGG) return; + if (blockType != Material.DRAGON_EGG) { + return; + } eventType = PlayerBlockEventType.INTERACT_BLOCK; blocktype1 = BukkitAdapter.asBlockType(block.getType()); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/MultiverseWorldManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/MultiverseWorldManager.java index 52e94c952..8f583de2e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/MultiverseWorldManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/MultiverseWorldManager.java @@ -34,8 +34,9 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** * Multiverse specific manager that informs Multiverse of * world creation by executing a console command + * * @deprecated Deprecated and scheduled for removal without replacement - * in favor of the build in setup wizard. + * in favor of the build in setup wizard. */ @Deprecated(forRemoval = true) @Singleton diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitOfflinePlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitOfflinePlayer.java index f758c19cb..53ef3a5e3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitOfflinePlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitOfflinePlayer.java @@ -88,8 +88,10 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer { final @NonNull String stub, final @NonNull String key ) { - return this.permissionProfile.hasPermission(world, stub + "." + key) || this.permissionProfile.hasPermission(world, - stub + ".*"); + return this.permissionProfile.hasPermission(world, stub + "." + key) || this.permissionProfile.hasPermission( + world, + stub + ".*" + ); } } 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 a25dfcfb9..9b292b54c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -55,6 +55,8 @@ import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Material; @@ -98,8 +100,6 @@ import org.bukkit.entity.WaterMob; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.util.Collection; import java.util.HashSet; @@ -140,7 +140,8 @@ public class BukkitUtil extends WorldUtil { */ public static @NonNull Location adapt(final org.bukkit.@NonNull Location location) { return Location - .at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), + .at( + com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()) @@ -156,7 +157,8 @@ public class BukkitUtil extends WorldUtil { */ public static @NonNull Location adaptComplete(final org.bukkit.@NonNull Location location) { return Location - .at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), + .at( + com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), @@ -516,45 +518,46 @@ public class BukkitUtil extends WorldUtil { tileEntityTypes.addAll(BlockCategories.FLOWER_POTS.getAll()); // Individual Types // Add these from strings - Stream.of("barrel", - "beacon", - "beehive", - "bee_nest", - "bell", - "blast_furnace", - "brewing_stand", - "campfire", - "chest", - "ender_chest", - "trapped_chest", - "command_block", - "end_gateway", - "hopper", - "jigsaw", - "jubekox", - "lectern", - "note_block", - "black_shulker_box", - "blue_shulker_box", - "brown_shulker_box", - "cyan_shulker_box", - "gray_shulker_box", - "green_shulker_box", - "light_blue_shulker_box", - "light_gray_shulker_box", - "lime_shulker_box", - "magenta_shulker_box", - "orange_shulker_box", - "pink_shulker_box", - "purple_shulker_box", - "red_shulker_box", - "shulker_box", - "white_shulker_box", - "yellow_shulker_box", - "smoker", - "structure_block", - "structure_void" - ) + Stream.of( + "barrel", + "beacon", + "beehive", + "bee_nest", + "bell", + "blast_furnace", + "brewing_stand", + "campfire", + "chest", + "ender_chest", + "trapped_chest", + "command_block", + "end_gateway", + "hopper", + "jigsaw", + "jubekox", + "lectern", + "note_block", + "black_shulker_box", + "blue_shulker_box", + "brown_shulker_box", + "cyan_shulker_box", + "gray_shulker_box", + "green_shulker_box", + "light_blue_shulker_box", + "light_gray_shulker_box", + "lime_shulker_box", + "magenta_shulker_box", + "orange_shulker_box", + "pink_shulker_box", + "purple_shulker_box", + "red_shulker_box", + "shulker_box", + "white_shulker_box", + "yellow_shulker_box", + "smoker", + "structure_block", + "structure_void" + ) .map(BlockTypes::get).filter(Objects::nonNull).forEach(tileEntityTypes::add); } return this.tileEntityTypes; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java index ed68a3c2b..54805c10c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java @@ -33,12 +33,12 @@ import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.block.BaseBlock; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.util.HashMap; import java.util.HashSet; 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 6ee0a50ee..958925438 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java @@ -32,12 +32,12 @@ import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotVersion; import com.plotsquared.core.configuration.Settings; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import javax.net.ssl.HttpsURLConnection; import java.io.IOException; 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 f2dc9d4b5..af5b43a63 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java @@ -32,9 +32,9 @@ import com.plotsquared.core.uuid.UUIDService; import com.sk89q.squirrelid.Profile; import com.sk89q.squirrelid.resolver.HttpRepositoryService; import com.sk89q.squirrelid.resolver.ProfileService; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; import java.io.IOException; import java.util.ArrayList; diff --git a/Core/src/main/java/com/plotsquared/core/PlotAPI.java b/Core/src/main/java/com/plotsquared/core/PlotAPI.java index a68e07d00..1e9b3569c 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotAPI.java +++ b/Core/src/main/java/com/plotsquared/core/PlotAPI.java @@ -152,7 +152,8 @@ public class PlotAPI { */ public void sendConsoleMessage( final @NonNull String message, - final @NonNull Template @NonNull... replacements) { + final @NonNull Template @NonNull ... replacements + ) { ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements); } @@ -164,7 +165,7 @@ public class PlotAPI { */ public void sendConsoleMessage( final @NonNull Caption caption, - final @NonNull Template @NonNull... replacements + final @NonNull Template @NonNull ... replacements ) { ConsolePlayer.getConsole().sendMessage(caption, replacements); } diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index b5270f423..7511fc458 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -73,11 +73,11 @@ import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.uuid.UUIDPipeline; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.BlockVector2; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.BufferedReader; import java.io.File; @@ -135,8 +135,8 @@ public class PlotSquared { new UUIDPipeline(Executors.newSingleThreadExecutor()); // Localization private final Map captionMaps = new HashMap<>(); - private CaptionLoader captionLoader; public HashMap> plots_tmp; + private CaptionLoader captionLoader; // WorldEdit instance private WorldEdit worldedit; private File configFile; @@ -556,7 +556,7 @@ public class PlotSquared { * * @param input an array of plots to sort */ - private void sortPlotsByHash(final @NonNull Plot @NonNull[] input) { + private void sortPlotsByHash(final @NonNull Plot @NonNull [] input) { List[] bucket = new ArrayList[32]; Arrays.fill(bucket, new ArrayList<>()); boolean maxLength = false; diff --git a/Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java b/Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java index c49257e24..a37b534f8 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java +++ b/Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java @@ -66,6 +66,7 @@ public class PlayerBackupProfile implements BackupProfile { private final SchematicHandler schematicHandler; private final Object backupLock = new Object(); private volatile List backupCache; + @Inject public PlayerBackupProfile( @Assisted final @NonNull UUID owner, @Assisted final @NonNull Plot plot, diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index a9b8f2bd3..08a2451b7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -261,8 +261,8 @@ public class Area extends SubCommand { // Now the schematic is saved, which is wonderful! PlotAreaBuilder singleBuilder = PlotAreaBuilder.ofPlotArea(hybridPlotWorld).plotManager(PlotSquared - .platform() - .pluginName()) + .platform() + .pluginName()) .generatorName(PlotSquared.platform().pluginName()).maximumId(plotId).minimumId(plotId); Runnable singleRun = () -> { final String path = @@ -310,9 +310,9 @@ public class Area extends SubCommand { switch (args[1].toLowerCase()) { case "pos1" -> { // Set position 1 HybridPlotWorld area = (HybridPlotWorld) metaData.computeIfAbsent( - player.getUUID(), - missingUUID -> new HashMap<>() - ) + player.getUUID(), + missingUUID -> new HashMap<>() + ) .get("area_create_area"); if (area == null) { player.sendMessage( @@ -340,9 +340,9 @@ public class Area extends SubCommand { case "pos2" -> { // Set position 2 and finish creation for type=2 (partial) final HybridPlotWorld area = (HybridPlotWorld) metaData.computeIfAbsent( - player.getUUID(), - missingUUID -> new HashMap<>() - ) + player.getUUID(), + missingUUID -> new HashMap<>() + ) .get("area_create_area"); if (area == null) { player.sendMessage( @@ -378,8 +378,8 @@ public class Area extends SubCommand { return false; } PlotAreaBuilder builder = PlotAreaBuilder.ofPlotArea(area).plotManager(PlotSquared - .platform() - .pluginName()) + .platform() + .pluginName()) .generatorName(PlotSquared.platform().pluginName()).minimumId(PlotId.of(1, 1)) .maximumId(PlotId.of(numX, numZ)); final String path = @@ -718,8 +718,8 @@ public class Area extends SubCommand { generatorTemplate )); Template tooltipTemplate = Template.of("hover_info", tooltip); - Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area.toString()); - Template infocmdTemplate = Template.of("command_info", "/plot area info " + area.toString()); + Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area); + Template infocmdTemplate = Template.of("command_info", "/plot area info " + area); Template numberTemplate = Template.of("number", String.valueOf(i)); Template nameTemplate = Template.of("area_name", name); Template typeTemplate = Template.of("area_type", area.getType().name()); @@ -844,8 +844,8 @@ public class Area extends SubCommand { completions.add("tp"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command( null, true, diff --git a/Core/src/main/java/com/plotsquared/core/command/Backup.java b/Core/src/main/java/com/plotsquared/core/command/Backup.java index 5876c9af0..88717dd8e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Backup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Backup.java @@ -316,8 +316,10 @@ public final class Backup extends Command { if (number < 1 || number > backups.size()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", - TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)) + Template.of( + "plot", + TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player) + ) ); } else { final com.plotsquared.core.backup.Backup backup = @@ -326,7 +328,10 @@ public final class Backup extends Command { .exists(backup.getFile())) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)) + Template.of( + "plot", + TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player) + ) ); } else { CmdConfirm.addPending(player, "/plot backup load " + number, diff --git a/Core/src/main/java/com/plotsquared/core/command/Buy.java b/Core/src/main/java/com/plotsquared/core/command/Buy.java index 76d52f968..dae0ea42f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Buy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Buy.java @@ -97,7 +97,8 @@ public class Buy extends Command { if (price <= 0) { throw new CommandException(TranslatableCaption.of("economy.not_for_sale")); } - checkTrue(this.econHandler.isSupported(), + checkTrue( + this.econHandler.isSupported(), TranslatableCaption.of("economy.vault_or_consumer_null") ); checkTrue( diff --git a/Core/src/main/java/com/plotsquared/core/command/Caps.java b/Core/src/main/java/com/plotsquared/core/command/Caps.java index 4b7ad62af..b9b8487b9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Caps.java +++ b/Core/src/main/java/com/plotsquared/core/command/Caps.java @@ -89,7 +89,9 @@ public class Caps extends SubCommand { final int current = countedEntities[type]; final int max = plot.getFlag(capFlag); final String percentage = String.format("%.1f", 100 * ((float) current / max)); - String maxBeautified = max >= Integer.MAX_VALUE ? TranslatableCaption.of("info.infinite").getComponent(player) : String.valueOf(max); + String maxBeautified = max >= Integer.MAX_VALUE + ? TranslatableCaption.of("info.infinite").getComponent(player) + : String.valueOf(max); player.sendMessage( TranslatableCaption.of("info.plot_caps_format"), Template.of("cap", name), diff --git a/Core/src/main/java/com/plotsquared/core/command/Claim.java b/Core/src/main/java/com/plotsquared/core/command/Claim.java index 8b2ad3535..4edbf9dde 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Claim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Claim.java @@ -46,9 +46,9 @@ import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.PlotExpression; import com.plotsquared.core.util.task.TaskManager; import net.kyori.adventure.text.minimessage.Template; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; @CommandDeclaration( command = "claim", 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 076140dd0..63e07c8ec 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Cluster.java +++ b/Core/src/main/java/com/plotsquared/core/command/Cluster.java @@ -67,8 +67,12 @@ public class Cluster extends SubCommand { // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome if (args.length == 0) { // return arguments - player.sendMessage(TranslatableCaption.of("cluster.cluster_available_args"), - Template.of("list", "list, create, delete, resize, invite, kick, leave, members, info, tp, sethome") + player.sendMessage( + TranslatableCaption.of("cluster.cluster_available_args"), + Template.of( + "list", + "list, create, delete, resize, invite, kick, leave, members, info, tp, sethome" + ) ); return false; } @@ -102,7 +106,7 @@ public class Cluster extends SubCommand { ); for (PlotCluster cluster : clusters) { // Ignore unmanaged clusters - String name = "'" + cluster.getName() + "' : " + cluster.toString(); + String name = "'" + cluster.getName() + "' : " + cluster; if (player.getUUID().equals(cluster.owner)) { player.sendMessage( TranslatableCaption.of("cluster.cluster_list_element_owner"), @@ -852,8 +856,12 @@ public class Cluster extends SubCommand { return true; } } - player.sendMessage(TranslatableCaption.of("cluster.cluster_available_args"), - Template.of("list", "list, create, delete, resize, invite, kick, leave, members, info, tp, sethome") + player.sendMessage( + TranslatableCaption.of("cluster.cluster_available_args"), + Template.of( + "list", + "list, create, delete, resize, invite, kick, leave, members, info, tp, sethome" + ) ); return false; } @@ -896,8 +904,8 @@ public class Cluster extends SubCommand { completions.add("sethome"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command( null, true, diff --git a/Core/src/main/java/com/plotsquared/core/command/Condense.java b/Core/src/main/java/com/plotsquared/core/command/Condense.java index d195895dd..7bbcf6a26 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Condense.java +++ b/Core/src/main/java/com/plotsquared/core/command/Condense.java @@ -88,7 +88,7 @@ public class Condense extends SubCommand { if (args.length == 2) { player.sendMessage( TranslatableCaption.of("commandconfig.command_syntax"), - Template.of("value", "/plot condense" + area.toString() + " start ") + Template.of("value", "/plot condense" + area + " start ") ); return false; } @@ -229,7 +229,7 @@ public class Condense extends SubCommand { if (args.length == 2) { player.sendMessage( TranslatableCaption.of("commandconfig.command_syntax"), - Template.of("value", "/plot condense " + area.toString() + " info ") + Template.of("value", "/plot condense " + area + " info ") ); return false; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Copy.java b/Core/src/main/java/com/plotsquared/core/command/Copy.java index 73ff98ccf..7fe3245c9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Copy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Copy.java @@ -77,7 +77,8 @@ public class Copy extends SubCommand { plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> { if (result) { player.sendMessage(TranslatableCaption.of("move.copy_success"), Template.of("origin", String.valueOf(plot1)), - Template.of("target", String.valueOf(plot2))); + Template.of("target", String.valueOf(plot2)) + ); } else { player.sendMessage(TranslatableCaption.of("move.requires_unowned")); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Debug.java b/Core/src/main/java/com/plotsquared/core/command/Debug.java index e20f98991..015386bfe 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Debug.java +++ b/Core/src/main/java/com/plotsquared/core/command/Debug.java @@ -125,7 +125,7 @@ public class Debug extends SubCommand { for (final EntityType entityType : category.getAll()) { builder.append(entityType.getId()).append(" "); } - player.sendMessage(StaticCaption.of("" + builder.toString())); + player.sendMessage(StaticCaption.of("" + builder)); }); EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId)) .forEach(entityType -> { 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 f634711ef..79cacd479 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -80,7 +80,8 @@ public class DebugExec extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { List allowedParams = Arrays - .asList("analyze", + .asList( + "analyze", "calibrate-analysis", "start-expire", "stop-expire", diff --git a/Core/src/main/java/com/plotsquared/core/command/Dislike.java b/Core/src/main/java/com/plotsquared/core/command/Dislike.java index 023a22943..5edee5408 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Dislike.java +++ b/Core/src/main/java/com/plotsquared/core/command/Dislike.java @@ -65,8 +65,8 @@ public class Dislike extends SubCommand { completions.add("purge"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) { }).collect(Collectors.toCollection(LinkedList::new)); if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Download.java b/Core/src/main/java/com/plotsquared/core/command/Download.java index 153dce9f7..8ba03f312 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Download.java +++ b/Core/src/main/java/com/plotsquared/core/command/Download.java @@ -161,8 +161,8 @@ public class Download extends SubCommand { completions.add("world"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command( null, true, diff --git a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java index 7801cfdcc..38c51b387 100644 --- a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java @@ -363,7 +363,8 @@ public final class FlagCommand extends Command { } plot.setFlag(parsed); player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])), - Template.of("value", String.valueOf(parsed))); + Template.of("value", String.valueOf(parsed)) + ); } @CommandDeclaration(command = "add", @@ -430,7 +431,8 @@ public final class FlagCommand extends Command { return; } player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])), - Template.of("value", String.valueOf(parsed))); + Template.of("value", String.valueOf(parsed)) + ); } @CommandDeclaration(command = "remove", @@ -539,7 +541,8 @@ public final class FlagCommand extends Command { return; } } - player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of("value", + player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of( + "value", String.valueOf(flag) )); } @@ -582,7 +585,8 @@ public final class FlagCommand extends Command { while (flagIterator.hasNext()) { final String flag = flagIterator.next(); builder.append(MINI_MESSAGE - .parse(TranslatableCaption.of("flag.flag_list_flag").getComponent(player), + .parse( + TranslatableCaption.of("flag.flag_list_flag").getComponent(player), Template.of("command", "/plot flag info " + flag), Template.of("flag", flag), Template.of("suffix", flagIterator.hasNext() ? ", " : "") diff --git a/Core/src/main/java/com/plotsquared/core/command/Grant.java b/Core/src/main/java/com/plotsquared/core/command/Grant.java index 025fcf637..412cc1bae 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Grant.java +++ b/Core/src/main/java/com/plotsquared/core/command/Grant.java @@ -164,8 +164,8 @@ public class Grant extends Command { completions.add("check"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command( null, true, 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 a329d74ec..8888a3662 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Help.java +++ b/Core/src/main/java/com/plotsquared/core/command/Help.java @@ -120,14 +120,16 @@ public class Help extends Command { builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_header").getComponent(player))); for (CommandCategory c : CommandCategory.values()) { builder.append(Component.newline()).append(MINI_MESSAGE - .parse(TranslatableCaption.of("help.help_info_item").getComponent(player), + .parse( + TranslatableCaption.of("help.help_info_item").getComponent(player), Template.of("command", "/plot help"), Template.of("category", c.name().toLowerCase()), Template.of("category_desc", c.getComponent(player)) )); } builder.append(Component.newline()).append(MINI_MESSAGE - .parse(TranslatableCaption.of("help.help_info_item").getComponent(player), + .parse( + TranslatableCaption.of("help.help_info_item").getComponent(player), Template.of("command", "/plot help"), Template.of("category", "all"), Template.of("category_desc", "Display all commands") @@ -139,10 +141,10 @@ public class Help extends Command { return true; } new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages().generatePage( - page - 1, - getParent().toString(), - player - ) + page - 1, + getParent().toString(), + player + ) .render(); return true; }); @@ -151,7 +153,8 @@ public class Help extends Command { @Override public Collection tab(PlotPlayer player, String[] args, boolean space) { return Stream.of("claiming", "teleport", "settings", "chat", "schematic", "appearance", "info", "debug", - "administration", "all") + "administration", "all" + ) .filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH))) .map(value -> new Command(null, false, value, "", RequiredType.NONE, null) { }).collect(Collectors.toList()); diff --git a/Core/src/main/java/com/plotsquared/core/command/Inbox.java b/Core/src/main/java/com/plotsquared/core/command/Inbox.java index 8b8574b1c..0cdcf4de9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Inbox.java +++ b/Core/src/main/java/com/plotsquared/core/command/Inbox.java @@ -150,7 +150,7 @@ public class Inbox extends SubCommand { if (total != 0) { player.sendMessage( TranslatableCaption.of("comment.inbox_item"), - Template.of("value", inbox.toString() + " (" + total + '/' + unread + ')') + Template.of("value", inbox + " (" + total + '/' + unread + ')') ); return; } @@ -179,7 +179,7 @@ public class Inbox extends SubCommand { return false; } final MetaDataKey metaDataKey = MetaDataKey.of( - String.format("inbox:%s", inbox.toString()), + String.format("inbox:%s", inbox), new TypeLiteral<>() { } ); @@ -302,8 +302,8 @@ public class Inbox extends SubCommand { completions.add("report"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.CHAT) { }).collect(Collectors.toCollection(LinkedList::new)); if (Permissions.hasPermission(player, Permission.PERMISSION_INBOX) && args[0].length() > 0) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Info.java b/Core/src/main/java/com/plotsquared/core/command/Info.java index b52bc03ab..54450cacc 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Info.java +++ b/Core/src/main/java/com/plotsquared/core/command/Info.java @@ -155,8 +155,8 @@ public class Info extends SubCommand { } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) { }).collect(Collectors.toCollection(LinkedList::new)); diff --git a/Core/src/main/java/com/plotsquared/core/command/Like.java b/Core/src/main/java/com/plotsquared/core/command/Like.java index 749e744bd..32b9abf79 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Like.java +++ b/Core/src/main/java/com/plotsquared/core/command/Like.java @@ -215,8 +215,8 @@ public class Like extends SubCommand { completions.add("purge"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) { }).collect(Collectors.toCollection(LinkedList::new)); if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) { 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 84ac5c0ee..36d72d9e7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java @@ -526,8 +526,8 @@ public class ListCmd extends SubCommand { } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command(null, true, completion, "", RequiredType.NONE, CommandCategory.TELEPORT) { }).collect(Collectors.toCollection(LinkedList::new)); diff --git a/Core/src/main/java/com/plotsquared/core/command/Music.java b/Core/src/main/java/com/plotsquared/core/command/Music.java index 2f47e3b31..641baeb45 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Music.java +++ b/Core/src/main/java/com/plotsquared/core/command/Music.java @@ -44,7 +44,6 @@ import com.sk89q.worldedit.world.item.ItemTypes; import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nullable; - import java.util.Arrays; import java.util.Collection; import java.util.Locale; @@ -85,7 +84,12 @@ public class Music extends SubCommand { ); return true; } - PlotInventory inv = new PlotInventory(this.inventoryUtil, player, 2, TranslatableCaption.of("plotjukebox.jukebox_header").getComponent(player)) { + PlotInventory inv = new PlotInventory( + this.inventoryUtil, + player, + 2, + TranslatableCaption.of("plotjukebox.jukebox_header").getComponent(player) + ) { @Override public boolean onClick(int index) { PlotItemStack item = getItem(index); @@ -104,7 +108,8 @@ public class Music extends SubCommand { return true; } plot.removeFlag(event.getFlag()); - getPlayer().sendMessage(TranslatableCaption.of("flag.flag_removed"), + getPlayer().sendMessage( + TranslatableCaption.of("flag.flag_removed"), Template.of("flag", "music"), Template.of("value", "music_disc") ); @@ -121,7 +126,8 @@ public class Music extends SubCommand { } plot.setFlag(event.getFlag()); getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", "music"), - Template.of("value", String.valueOf(event.getFlag().getValue()))); + Template.of("value", String.valueOf(event.getFlag().getValue())) + ); } else { getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added")); } 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 a1b5d9c23..9881afe4c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Owner.java +++ b/Core/src/main/java/com/plotsquared/core/command/Owner.java @@ -87,7 +87,8 @@ public class Owner extends SetCommand { ); return; } - PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange(player, + PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange( + player, plot, plot.hasOwner() ? plot.getOwnerAbs() : null, uuid, diff --git a/Core/src/main/java/com/plotsquared/core/command/Purge.java b/Core/src/main/java/com/plotsquared/core/command/Purge.java index e4a2d0bc2..6d43cce13 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Purge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Purge.java @@ -40,9 +40,9 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.uuid.UUIDMapping; import net.kyori.adventure.text.minimessage.Template; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; import java.util.HashMap; import java.util.HashSet; diff --git a/Core/src/main/java/com/plotsquared/core/command/Rate.java b/Core/src/main/java/com/plotsquared/core/command/Rate.java index 90e80d397..9f685af54 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Rate.java +++ b/Core/src/main/java/com/plotsquared/core/command/Rate.java @@ -287,8 +287,8 @@ public class Rate extends SubCommand { completions.add("purge"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) { }).collect(Collectors.toCollection(LinkedList::new)); if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) { diff --git a/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java b/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java index 5049c63dd..e9fcf1e02 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java @@ -305,8 +305,8 @@ public class SchematicCmd extends SubCommand { completions.add("paste"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command( null, true, 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 f745f176b..d5f7c65fe 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Set.java +++ b/Core/src/main/java/com/plotsquared/core/command/Set.java @@ -282,8 +282,8 @@ public class Set extends SubCommand { completions.add("middle"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command(null, true, completion, "", RequiredType.NONE, CommandCategory.APPEARANCE) { }).collect(Collectors.toCollection(LinkedList::new)); diff --git a/Core/src/main/java/com/plotsquared/core/command/Swap.java b/Core/src/main/java/com/plotsquared/core/command/Swap.java index 3c7ccf651..3003226ec 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Swap.java +++ b/Core/src/main/java/com/plotsquared/core/command/Swap.java @@ -86,7 +86,8 @@ public class Swap extends SubCommand { }, true).thenApply(result -> { if (result) { player.sendMessage(TranslatableCaption.of("swap.swap_success"), Template.of("origin", String.valueOf(plot1)), - Template.of("target", String.valueOf(plot2))); + Template.of("target", String.valueOf(plot2)) + ); return true; } else { player.sendMessage(TranslatableCaption.of("swap.swap_overlap")); diff --git a/Core/src/main/java/com/plotsquared/core/command/Template.java b/Core/src/main/java/com/plotsquared/core/command/Template.java index d5a1d14a2..c169f4d09 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Template.java +++ b/Core/src/main/java/com/plotsquared/core/command/Template.java @@ -293,8 +293,8 @@ public class Template extends SubCommand { completions.add("import"); } final List commands = completions.stream().filter(completion -> completion - .toLowerCase() - .startsWith(args[0].toLowerCase())) + .toLowerCase() + .startsWith(args[0].toLowerCase())) .map(completion -> new Command( null, true, diff --git a/Core/src/main/java/com/plotsquared/core/command/Trim.java b/Core/src/main/java/com/plotsquared/core/command/Trim.java index bf9c46da5..2767f1ce2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trim.java @@ -46,9 +46,9 @@ import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskTime; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; import java.util.HashSet; import java.util.Iterator; diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java index 81f0b56fb..503034b70 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -47,10 +47,10 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.item.ItemTypes; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.Template; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.io.File; import java.io.IOException; @@ -123,7 +123,8 @@ public class ComponentPresetManager { .collect(Collectors.toList()); } else { final List defaultPreset = Collections.singletonList( - new ComponentPreset(ClassicPlotManagerComponent.FLOOR, + new ComponentPreset( + ClassicPlotManagerComponent.FLOOR, "##wool", 0, "", @@ -160,7 +161,10 @@ public class ComponentPresetManager { } else if (!plot.hasOwner()) { player.sendMessage(TranslatableCaption.of("info.plot_unowned")); return null; - } else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMPONENTS_OTHER)) { + } else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !Permissions.hasPermission( + player, + Permission.PERMISSION_ADMIN_COMPONENTS_OTHER + )) { player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); return null; } else if (plot.getVolume() > Integer.MAX_VALUE) { diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 410f0ff1e..3efc52072 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -792,6 +792,7 @@ public class Settings extends Config { ); @Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not") public static boolean USE_MVDWAPI = true; + } } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java index 28ff8b7b6..34fa8f5cc 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java @@ -31,7 +31,6 @@ import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.DescriptionFlag; import com.plotsquared.core.plot.flag.implementations.FarewellFlag; import com.plotsquared.core.plot.flag.implementations.GreetingFlag; -import com.plotsquared.core.plot.flag.types.StringFlag; import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; @@ -103,7 +102,6 @@ public class CaptionUtility { * * @param miniMessageString the message from which the specified click events should be removed from. * @return the string without the click events that are configured to be removed. - * * @see Settings.Chat#CLICK_EVENT_ACTIONS_TO_REMOVE */ public static String stripClickEvents(final @NonNull String miniMessageString) { @@ -119,10 +117,9 @@ public class CaptionUtility { * This method works the same way as {@link #stripClickEvents(String)} but will only * strip click events from messages that target flags that are meant to contain MiniMessage strings. * - * @param flag the flag the message is targeted for. + * @param flag the flag the message is targeted for. * @param miniMessageString the message from which the specified click events should be removed from. * @return the string without the click events that are configured to be removed. - * * @see Settings.Chat#CLICK_EVENT_ACTIONS_TO_REMOVE * @see #stripClickEvents(String) */ diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/ChatFormatter.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/ChatFormatter.java index c3d8feadc..2eb3df076 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/ChatFormatter.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/ChatFormatter.java @@ -49,7 +49,6 @@ public interface ChatFormatter { private final PlotPlayer recipient; private final boolean rawOutput; - ; private String message; /** diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java index 1a9f8db58..f4520e42e 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java @@ -34,6 +34,7 @@ import java.util.EnumSet; import java.util.Set; final class ClickStripTransform implements ComponentTransform { + private final Set actionsToStrip; public ClickStripTransform(final Set actionsToStrip) { @@ -43,7 +44,9 @@ final class ClickStripTransform implements ComponentTransform { @Override public @NonNull Component transform(@NonNull final Component original) { var clickEvent = original.clickEvent(); - if (clickEvent == null || !actionsToStrip.contains(clickEvent.action())) return original; + if (clickEvent == null || !actionsToStrip.contains(clickEvent.action())) { + return original; + } return original.clickEvent(null); // remove it } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/NestedComponentTransform.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/NestedComponentTransform.java index 4024d578b..8fc462d82 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/NestedComponentTransform.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/NestedComponentTransform.java @@ -25,8 +25,6 @@ */ package com.plotsquared.core.configuration.caption; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.NonNull; @@ -37,6 +35,7 @@ import java.util.stream.Collectors; * A transform that applies a nested transform on all child components and the component itself. */ final class NestedComponentTransform implements ComponentTransform { + private final ComponentTransform transform; public NestedComponentTransform(final ComponentTransform transform) { @@ -51,4 +50,5 @@ final class NestedComponentTransform implements ComponentTransform { private List transformChildren(List children) { return children.stream().map(this::transform).collect(Collectors.toList()); } + } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/load/CaptionLoader.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/load/CaptionLoader.java index ac191dc8f..eb65f7758 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/load/CaptionLoader.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/load/CaptionLoader.java @@ -214,8 +214,9 @@ public final class CaptionLoader { } return new LocalizedCaptionMap(locale, map.entrySet().stream() .collect(Collectors.toMap( - entry -> TranslatableCaption.of(this.namespace, entry.getKey()), - Map.Entry::getValue) + entry -> TranslatableCaption.of(this.namespace, entry.getKey()), + Map.Entry::getValue + ) )); } } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/load/ClassLoaderCaptionProvider.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/load/ClassLoaderCaptionProvider.java index 6f35be06b..2e6a6c621 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/load/ClassLoaderCaptionProvider.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/load/ClassLoaderCaptionProvider.java @@ -25,10 +25,10 @@ */ package com.plotsquared.core.configuration.caption.load; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.io.BufferedReader; import java.io.IOException; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/load/DefaultCaptionProvider.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/load/DefaultCaptionProvider.java index 79432fb44..8ea417d7d 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/load/DefaultCaptionProvider.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/load/DefaultCaptionProvider.java @@ -63,7 +63,7 @@ public interface DefaultCaptionProvider { final @NonNull ClassLoader classLoader, final @NonNull String toFormat ) { - return forClassLoader(classLoader, locale -> String.format(toFormat, locale.toString())); + return forClassLoader(classLoader, locale -> String.format(toFormat, locale)); } /** diff --git a/Core/src/main/java/com/plotsquared/core/configuration/serialization/ConfigurationSerialization.java b/Core/src/main/java/com/plotsquared/core/configuration/serialization/ConfigurationSerialization.java index 399701bd8..6464a4712 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/serialization/ConfigurationSerialization.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/serialization/ConfigurationSerialization.java @@ -231,7 +231,7 @@ public class ConfigurationSerialization { if (result == null) { Logger.getLogger(ConfigurationSerialization.class.getName()).log( Level.SEVERE, - "Could not call method '" + method.toString() + "' of " + this.clazz + "Could not call method '" + method + "' of " + this.clazz + " for deserialization: method returned null" ); } else { @@ -240,12 +240,12 @@ public class ConfigurationSerialization { } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) { if (ex instanceof InvocationTargetException) { Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, - "Could not call method '" + method.toString() + "' of " + this.clazz + "Could not call method '" + method + "' of " + this.clazz + " for deserialization", ex.getCause() ); } else { Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, - "Could not call method '" + method.toString() + "' of " + this.clazz + "Could not call method '" + method + "' of " + this.clazz + " for deserialization", ex ); } @@ -262,12 +262,12 @@ public class ConfigurationSerialization { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException ex) { if (ex instanceof InvocationTargetException) { Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, - "Could not call constructor '" + ctor.toString() + "' of " + this.clazz + "Could not call constructor '" + ctor + "' of " + this.clazz + " for deserialization", ex.getCause() ); } else { Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE, - "Could not call constructor '" + ctor.toString() + "' of " + this.clazz + "Could not call constructor '" + ctor + "' of " + this.clazz + " for deserialization", ex ); } diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java index eb78968eb..dba81e1eb 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java @@ -51,9 +51,9 @@ import com.plotsquared.core.util.HashUtil; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; import java.sql.Connection; import java.sql.DatabaseMetaData; @@ -3390,22 +3390,19 @@ public class SQLManager implements AbstractDB { .toString() + "' WHERE `owner` = '" + old.toString() + '\''); stmt.executeUpdate( "UPDATE `" + SQLManager.this.prefix + "cluster_helpers` SET `user_uuid` = '" - + now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + + now + "' WHERE `user_uuid` = '" + old + '\''); stmt.executeUpdate( "UPDATE `" + SQLManager.this.prefix + "cluster_invited` SET `user_uuid` = '" - + now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + + now + "' WHERE `user_uuid` = '" + old + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now.toString() - + "' WHERE `owner` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now + + "' WHERE `owner` = '" + old + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" + now - .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" + now + "' WHERE `user_uuid` = '" + old + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" + now - .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" + now + "' WHERE `user_uuid` = '" + old + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" + now - .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" + now + "' WHERE `user_uuid` = '" + old + '\''); } catch (SQLException e) { e.printStackTrace(); } 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 e8c92f4b2..1816a675d 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java @@ -37,9 +37,9 @@ public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEv private final PlotPlayer initiator; @Nullable private final UUID oldOwner; + private final boolean hasOldOwner; @Nullable private UUID newOwner; - private final boolean hasOldOwner; private Result eventResult; /** 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 00c2252f1..fb0c67f51 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java @@ -37,10 +37,10 @@ import org.checkerframework.checker.nullness.qual.NonNull; public final class PlotMergeEvent extends PlotPlayerEvent implements CancellablePlotEvent { private final String world; + private final PlotPlayer player; private Direction dir; private int max; private Result eventResult; - private final PlotPlayer player; /** * PlotMergeEvent: Called when plots are merged diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java index 181ca9a9e..8073c2a24 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java @@ -511,32 +511,38 @@ public class ClassicPlotManager extends SquarePlotManager { ), Location.at(classicPlotWorld.getWorldName(), ex, maxY, ez - 1), BlockTypes.AIR.getDefaultState() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0) ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING.toPattern() ); if (classicPlotWorld.PLACE_TOP_BLOCK) { - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK.toPattern() ); } - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), ex, 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), ex, 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING.toPattern() ); if (classicPlotWorld.PLACE_TOP_BLOCK) { - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK.toPattern() ); } - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern() ); @@ -568,32 +574,38 @@ public class ClassicPlotManager extends SquarePlotManager { Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz), Location.at(classicPlotWorld.getWorldName(), ex - 1, 0, ez), BlockUtil.get((short) 7, (byte) 0) ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, sz), classicPlotWorld.WALL_FILLING.toPattern() ); if (classicPlotWorld.PLACE_TOP_BLOCK) { - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, sz), classicPlotWorld.WALL_BLOCK.toPattern() ); } - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, ez), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, ez), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, ez), classicPlotWorld.WALL_FILLING.toPattern() ); if (classicPlotWorld.PLACE_TOP_BLOCK) { - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, ez), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, ez), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK.toPattern() ); } - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern() ); @@ -623,7 +635,8 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex - 1, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0) ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK.toPattern() ); @@ -656,11 +669,13 @@ public class ClassicPlotManager extends SquarePlotManager { Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK.toPattern() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK.toPattern() ); @@ -694,11 +709,13 @@ public class ClassicPlotManager extends SquarePlotManager { Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK.toPattern() ); @@ -731,11 +748,13 @@ public class ClassicPlotManager extends SquarePlotManager { Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 1, sz), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx, 1, sz), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern() ); - queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz), + queue.setCuboid( + Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK.toPattern() ); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index dfb36b565..502a58f5b 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -55,13 +55,11 @@ import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.checkerframework.checker.nullness.qual.NonNull; import javax.annotation.Nullable; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import java.io.File; import java.lang.reflect.Field; import java.util.HashMap; diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java index 27219329c..089c191cf 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java @@ -61,9 +61,9 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; import java.io.File; import java.util.ArrayDeque; @@ -482,7 +482,8 @@ public class HybridUtils { Iterator iterator = HybridUtils.regions.iterator(); BlockVector2 loc = iterator.next(); iterator.remove(); - LOGGER.error("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)", + LOGGER.error( + "Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)", area.getWorldHash(), loc.getX(), loc.getZ() @@ -626,7 +627,8 @@ public class HybridUtils { int maxY = Math.max(extend, blocks.length); for (int y = 0; y < maxY; y++) { if (y > blocks.length - 1) { - queue.setBlock(finalX + X + plotWorld.ROAD_OFFSET_X, + queue.setBlock( + finalX + X + plotWorld.ROAD_OFFSET_X, minY + y, finalZ + Z + plotWorld.ROAD_OFFSET_Z, WEExtent.AIRBASE @@ -641,7 +643,8 @@ public class HybridUtils { block ); } else { - queue.setBlock(finalX + X + plotWorld.ROAD_OFFSET_X, + queue.setBlock( + finalX + X + plotWorld.ROAD_OFFSET_X, minY + y, finalZ + Z + plotWorld.ROAD_OFFSET_Z, WEExtent.AIRBASE diff --git a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java index 1feffc0ba..8f2e5fea8 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java @@ -35,10 +35,10 @@ import com.plotsquared.core.queue.QueueCoordinator; import com.plotsquared.core.util.HashUtil; import com.plotsquared.core.util.RegionManager; import com.sk89q.worldedit.regions.CuboidRegion; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; import java.util.Set; diff --git a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java index 18cc6bd37..17d9a5f79 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java @@ -31,10 +31,10 @@ import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.queue.GlobalBlockQueue; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; public abstract class SquarePlotWorld extends GridPlotWorld { diff --git a/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java b/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java index 68064e3e9..36d77ed26 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java @@ -42,9 +42,9 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; import java.lang.reflect.Field; import java.util.HashMap; @@ -59,12 +59,11 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { private final String world; private final int max; private final WorldUtil worldUtil; - + private final Map tileEntityCount = new HashMap<>(); int Ecount = 0; boolean Eblocked = false; private int count; private Extent parent; - private final Map tileEntityCount = new HashMap<>(); public ProcessedWEExtent( String world, diff --git a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java index aa7ffdc4f..3357f7a28 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -213,7 +213,8 @@ public enum Permission { this.text = text; } - @Override public String toString() { + @Override + public String toString() { return this.text; } 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 65bf12aa5..68760fc18 100644 --- a/Core/src/main/java/com/plotsquared/core/player/MetaDataAccess.java +++ b/Core/src/main/java/com/plotsquared/core/player/MetaDataAccess.java @@ -71,7 +71,8 @@ public abstract class MetaDataAccess implements AutoCloseable { * * @return Old value, or {@code null} */ - public @Nullable abstract T remove(); + public @Nullable + abstract T remove(); /** * Set the meta data value @@ -85,7 +86,8 @@ public abstract class MetaDataAccess implements AutoCloseable { * * @return Stored value, or {@link Optional#empty()} */ - public @NonNull abstract Optional get(); + public @NonNull + abstract Optional get(); @Override public final void close() { diff --git a/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java b/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java index d5702594d..7d184ba47 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java @@ -38,20 +38,39 @@ import java.util.List; public final class PlayerMetaDataKeys { //@formatter:off - public static final MetaDataKey PERSISTENT_FLIGHT = MetaDataKey.of("flight", new TypeLiteral<>() {}); - public static final MetaDataKey PERSISTENT_GRANTED_PLOTS = MetaDataKey.of("grantedPlots", new TypeLiteral<>() {}); + public static final MetaDataKey PERSISTENT_FLIGHT = MetaDataKey.of("flight", new TypeLiteral<>() { + }); + public static final MetaDataKey PERSISTENT_GRANTED_PLOTS = MetaDataKey.of("grantedPlots", new TypeLiteral<>() { + }); - public static final MetaDataKey TEMPORARY_LAST_PLOT = MetaDataKey.of("lastplot", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_MUSIC = MetaDataKey.of("music", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_KICK = MetaDataKey.of("kick", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_SETUP = MetaDataKey.of("setup", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_INVENTORY = MetaDataKey.of("inventory", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_IGNORE_EXPIRE_TASK = MetaDataKey.of("ignoreExpireTask", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_WORLD_EDIT_REGION_PLOT = MetaDataKey.of("WorldEditRegionPlot", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_AUTO = MetaDataKey.of(Auto.class.getName(), new TypeLiteral<>() {}); - public static final MetaDataKey> TEMPORARY_SCHEMATICS = MetaDataKey.of("plot_schematics", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_LOCATION = MetaDataKey.of("location", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_CONFIRM = MetaDataKey.of("cmdConfirm", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_LAST_PLOT = MetaDataKey.of("lastplot", new TypeLiteral<>() { + }); + public static final MetaDataKey TEMPORARY_MUSIC = MetaDataKey.of("music", new TypeLiteral<>() { + }); + public static final MetaDataKey TEMPORARY_KICK = MetaDataKey.of("kick", new TypeLiteral<>() { + }); + public static final MetaDataKey TEMPORARY_SETUP = MetaDataKey.of("setup", new TypeLiteral<>() { + }); + public static final MetaDataKey TEMPORARY_INVENTORY = MetaDataKey.of("inventory", new TypeLiteral<>() { + }); + public static final MetaDataKey TEMPORARY_IGNORE_EXPIRE_TASK = MetaDataKey.of( + "ignoreExpireTask", + new TypeLiteral<>() { + } + ); + public static final MetaDataKey TEMPORARY_WORLD_EDIT_REGION_PLOT = MetaDataKey.of( + "WorldEditRegionPlot", + new TypeLiteral<>() { + } + ); + public static final MetaDataKey TEMPORARY_AUTO = MetaDataKey.of(Auto.class.getName(), new TypeLiteral<>() { + }); + public static final MetaDataKey> TEMPORARY_SCHEMATICS = MetaDataKey.of("plot_schematics", new TypeLiteral<>() { + }); + public static final MetaDataKey TEMPORARY_LOCATION = MetaDataKey.of("location", new TypeLiteral<>() { + }); + public static final MetaDataKey TEMPORARY_CONFIRM = MetaDataKey.of("cmdConfirm", new TypeLiteral<>() { + }); //@formatter:on private PlayerMetaDataKeys() { diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index 496126019..f4ad47c48 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -437,16 +437,14 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, * @return UUID */ @Override - public @NonNull abstract UUID getUUID(); + public @NonNull + abstract UUID getUUID(); public boolean canTeleport(final @NonNull Location location) { Preconditions.checkNotNull(location, "Specified location cannot be null"); final Location current = getLocationFull(); teleport(location); - boolean result = true; - if (!getLocation().equals(location)) { - result = false; - } + boolean result = getLocation().equals(location); teleport(current); return result; } @@ -803,7 +801,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, } else if (key.getType().getRawType().equals(Boolean.class)) { this.setPersistentMeta(key.toString(), ByteArrayUtilities.booleanToBytes((boolean) rawValue)); } else { - throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType().toString())); + throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType())); } } @@ -818,7 +816,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, } else if (key.getType().getRawType().equals(Boolean.class)) { returnValue = ByteArrayUtilities.bytesToBoolean(value); } else { - throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType().toString())); + throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType())); } return (T) returnValue; } @@ -843,7 +841,14 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, final @NonNull Caption title, final @NonNull Caption subtitle, final @NonNull Template... replacements ) { - sendTitle(title, subtitle, Settings.Titles.TITLES_FADE_IN, Settings.Titles.TITLES_STAY, Settings.Titles.TITLES_FADE_OUT, replacements); + sendTitle( + title, + subtitle, + Settings.Titles.TITLES_FADE_IN, + Settings.Titles.TITLES_STAY, + Settings.Titles.TITLES_FADE_OUT, + replacements + ); } /** @@ -876,7 +881,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, /** * Method designed to send an ActionBar to a player. * - * @param caption Caption + * @param caption Caption * @param replacements Variable replacements */ public void sendActionBar( @@ -1001,7 +1006,8 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, * * @return Player audience */ - public @NonNull abstract Audience getAudience(); + public @NonNull + abstract Audience getAudience(); /** * Get this player's {@link LockRepository} diff --git a/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java b/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java index 2b4e904a2..b38ccbb2b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java +++ b/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java @@ -52,8 +52,8 @@ public final class BlockBucket implements ConfigurationSerializable { private static final java.util.regex.Pattern regex = java.util.regex.Pattern.compile( "((?[A-Za-z_]+):)?(?([A-Za-z_]+(\\[?[\\S\\s]+\\])?))(:(?[0-9]{1,3}))?"); - private boolean compiled; private final StringBuilder input; + private boolean compiled; private BlockState single; private Pattern pattern; @@ -105,7 +105,7 @@ public final class BlockBucket implements ConfigurationSerializable { chance = 1; } String prefix = input.length() == 0 ? "" : ","; - input.append(prefix).append(block.toString()).append(":").append(chance); + input.append(prefix).append(block).append(":").append(chance); this.compiled = false; } 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 1dcefafef..6eb6de683 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -80,10 +80,10 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.Template; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.lang.ref.Cleaner; import java.text.DecimalFormat; @@ -1301,7 +1301,8 @@ public class Plot { Location[] corners = getCorners(); Location top = corners[0]; Location bot = corners[1]; - Location location = Location.at(this.getWorldName(), + Location location = Location.at( + this.getWorldName(), MathMan.average(bot.getX(), top.getX()), MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()) @@ -1332,7 +1333,8 @@ public class Plot { 0 ); } - Location location = Location.at(this.getWorldName(), + Location location = Location.at( + this.getWorldName(), MathMan.average(bot.getX(), top.getX()), MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()) @@ -1407,7 +1409,8 @@ public class Plot { ); } Location location = Location - .at(bottom.getWorldName(), + .at( + bottom.getWorldName(), bottom.getX() + home.getX(), bottom.getY() + home.getY(), bottom.getZ() + home.getZ(), @@ -1447,7 +1450,8 @@ public class Plot { } Location bottom = this.getBottomAbs(); Location location = Location - .at(bottom.getWorldName(), + .at( + bottom.getWorldName(), bottom.getX() + home.getX(), bottom.getY() + home.getY(), bottom.getZ() + home.getZ(), @@ -1898,7 +1902,7 @@ public class Plot { if (this.settings != null && this.settings.getAlias().length() > 1) { return this.settings.getAlias(); } - return this.area + ";" + this.id.toString(); + return this.area + ";" + this.id; } /** @@ -2806,9 +2810,10 @@ public class Plot { } else { value = flag.toString(); } - Component snip = MINI_MESSAGE.parse(prefix + CaptionUtility.format( - player, - TranslatableCaption.of("info.plot_flag_list").getComponent(player) + Component snip = MINI_MESSAGE.parse( + prefix + CaptionUtility.format( + player, + TranslatableCaption.of("info.plot_flag_list").getComponent(player) ), Template.of("flag", flag.getName()), Template.of("value", CaptionUtility.formatRaw(player, value.toString())) @@ -2905,7 +2910,8 @@ public class Plot { } } future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE - .parse(iInfo.getComponent(player), + .parse( + iInfo.getComponent(player), headerTemplate, areaTemplate, idTemplate, @@ -2930,7 +2936,8 @@ public class Plot { return; } future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE - .parse(iInfo.getComponent(player), + .parse( + iInfo.getComponent(player), headerTemplate, areaTemplate, idTemplate, 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 d0b5b3c89..a34c5e1aa 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -70,10 +70,10 @@ import com.sk89q.worldedit.world.gamemode.GameModes; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.Template; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.text.DecimalFormat; import java.util.ArrayList; @@ -147,7 +147,7 @@ public abstract class PlotArea { private GameMode gameMode = GameModes.CREATIVE; private Map prices = new HashMap<>(); private List schematics = new ArrayList<>(); - private boolean roadFlags = false; + private final boolean roadFlags = false; private boolean worldBorder = false; private boolean useEconomy = false; private int hash; @@ -1312,8 +1312,8 @@ public abstract class PlotArea { * * @return the legacy sign material. * @deprecated Use {@link #signMaterial()}. This method is used for 1.13 only and - * will be removed without replacement in favor of {@link #signMaterial()} - * once we remove the support for 1.13. + * will be removed without replacement in favor of {@link #signMaterial()} + * once we remove the support for 1.13. */ @Deprecated(forRemoval = true) public String getLegacySignMaterial() { diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java index bac093ca4..c11d6a2a8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java @@ -52,10 +52,10 @@ import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; import net.kyori.adventure.text.minimessage.Template; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.ArrayDeque; import java.util.ArrayList; @@ -175,7 +175,7 @@ public final class PlotModificationManager { return; } CuboidRegion region = regions.poll(); - Location[] corners = plot.getCorners(plot.getWorldName(), region); + Location[] corners = Plot.getCorners(plot.getWorldName(), region); Location pos1 = corners[0]; Location pos2 = corners[1]; Location newPos = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName()); @@ -239,7 +239,7 @@ public final class PlotModificationManager { if (queue.isEmpty()) { Runnable run = () -> { for (CuboidRegion region : regions) { - Location[] corners = plot.getCorners(plot.getWorldName(), region); + Location[] corners = Plot.getCorners(plot.getWorldName(), region); PlotSquared.platform().regionManager().clearAllEntities(corners[0], corners[1]); } TaskManager.runTask(whenDone); @@ -731,7 +731,7 @@ public final class PlotModificationManager { TaskManager.runTask(whenDone); } else { CuboidRegion region = regions.poll(); - Location[] corners = plot.getCorners(plot.getWorldName(), region); + Location[] corners = Plot.getCorners(plot.getWorldName(), region); Location pos1 = corners[0]; Location pos2 = corners[1]; Location pos3 = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName()); @@ -770,7 +770,7 @@ public final class PlotModificationManager { } final Runnable task = this; CuboidRegion region = regions.poll(); - Location[] corners = PlotModificationManager.this.plot.getCorners( + Location[] corners = Plot.getCorners( PlotModificationManager.this.plot.getWorldName(), region ); diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java b/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java index 41b0d4002..3c73d111e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java @@ -46,4 +46,5 @@ public class PlotTitle { public String subtitle() { return subtitle; } + } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java b/Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java index 5477f8cc0..5853ff017 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java @@ -56,14 +56,16 @@ public abstract class PlotWorld { * @param location Location * @return Containing plot area, or null */ - public @Nullable abstract PlotArea getArea(final @NonNull Location location); + public @Nullable + abstract PlotArea getArea(final @NonNull Location location); /** * Get all plot areas in the world * * @return All plot areas in the world */ - public @NonNull abstract Collection getAreas(); + public @NonNull + abstract Collection getAreas(); /** * Get all plot areas in a specified region @@ -71,7 +73,8 @@ public abstract class PlotWorld { * @param region Region * @return All areas in the region */ - public @NonNull abstract Collection getAreasInRegion( + public @NonNull + abstract Collection getAreasInRegion( final @NonNull CuboidRegion region ); diff --git a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java index 06e3696e6..753acaf76 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java +++ b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentInbox.java @@ -44,9 +44,9 @@ public abstract class CommentInbox { * @return the inbox, otherwise {@code false} false */ public boolean canRead(Plot plot, PlotPlayer player) { - if (Permissions.hasPermission(player, "plots.inbox.read." + toString(), true)) { + if (Permissions.hasPermission(player, "plots.inbox.read." + this, true)) { return plot.isOwner(player.getUUID()) || Permissions - .hasPermission(player, "plots.inbox.read." + toString() + ".other", true); + .hasPermission(player, "plots.inbox.read." + this + ".other", true); } return false; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java index b11c7df6a..b65fd1ee0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java @@ -236,8 +236,10 @@ public class PlotAnalysis { int optimalIndex = (int) Math.round((1 - threshold) * (n - 1)); LOGGER.info("- Calculating rank correlation: "); - LOGGER.info("- The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking"); - LOGGER.info("- The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing"); + LOGGER.info( + "- The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking"); + LOGGER.info( + "- The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing"); Settings.Auto_Clear settings = new Settings.Auto_Clear(); @@ -381,8 +383,8 @@ public class PlotAnalysis { logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings))))); if (optimalComplexity == Integer.MAX_VALUE) { LOGGER.info("Insufficient data to determine correlation! {} | {}", - optimalIndex, n - ); + optimalIndex, n + ); running = false; for (Plot plot : plots) { plot.removeRunning(); 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 1fdc14664..94eadff69 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 @@ -52,8 +52,8 @@ public class FlagContainer { private final Map, PlotFlag> flagMap = new HashMap<>(); private final PlotFlagUpdateHandler plotFlagUpdateHandler; private final Collection updateSubscribers = new HashSet<>(); - private FlagContainer parentContainer; private final PlotFlagUpdateHandler unknownsRef; + private FlagContainer parentContainer; /** * Construct a new flag container with an optional parent container and update handler. diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java index 1de1eb686..2b12782c0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java @@ -95,7 +95,8 @@ public abstract class PlotFlag> { * * @return Non-nullable flag value */ - public @NonNull final T getValue() { + public @NonNull + final T getValue() { return this.value; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java index 0d3a86a60..9d1b8422d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlotTitleFlag.java @@ -41,7 +41,11 @@ public class PlotTitleFlag extends PlotFlag { * @param value Flag value */ protected PlotTitleFlag(PlotTitle value) { - super(value, TranslatableCaption.of("flags.flag_category_string"), TranslatableCaption.of("flags.flag_description_title")); + super( + value, + TranslatableCaption.of("flags.flag_category_string"), + TranslatableCaption.of("flags.flag_description_title") + ); } @Override diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java index a0d7c458a..6f6799ae8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java @@ -31,10 +31,10 @@ import com.plotsquared.core.configuration.Settings; import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.HashMap; import java.util.Map; diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java index a54e74ce9..8a05a2235 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java @@ -182,7 +182,12 @@ public class SinglePlotArea extends GridPlotWorld { @Override public ConfigurationNode[] getSettingNodes() { return new ConfigurationNode[]{ - new ConfigurationNode("void", this.VOID, TranslatableCaption.of("setup.singleplotarea_void_world"), ConfigurationUtil.BOOLEAN)}; + new ConfigurationNode( + "void", + this.VOID, + TranslatableCaption.of("setup.singleplotarea_void_world"), + ConfigurationUtil.BOOLEAN + )}; } @Nullable diff --git a/Core/src/main/java/com/plotsquared/core/queue/BasicQueueCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/BasicQueueCoordinator.java index 179d45788..051478242 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/BasicQueueCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/BasicQueueCoordinator.java @@ -271,7 +271,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator { } @Override - public @Nullable final Consumer getChunkConsumer() { + public @Nullable + final Consumer getChunkConsumer() { return this.consumer; } @@ -293,7 +294,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator { } @Override - public @NonNull final LightingMode getLightingMode() { + public @NonNull + final LightingMode getLightingMode() { if (lightingMode == null) { return LightingMode.valueOf(Settings.QUEUE.LIGHTING_MODE); } diff --git a/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinatorBuilder.java b/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinatorBuilder.java index 5d19502a3..e7749d14a 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinatorBuilder.java +++ b/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinatorBuilder.java @@ -218,7 +218,8 @@ public class ChunkCoordinatorBuilder { Preconditions.checkNotNull(this.whenDone, "No final action was supplied"); Preconditions.checkNotNull(this.throwableConsumer, "No throwable consumer was supplied"); return chunkCoordinatorFactory - .create(this.maxIterationTime, + .create( + this.maxIterationTime, this.initialBatchSize, this.chunkConsumer, this.world, 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 13848637c..5c0f88c88 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java @@ -190,7 +190,8 @@ public abstract class QueueCoordinator { * @param z block z * @return WorldEdit BlockState */ - public @Nullable abstract BlockState getBlock(int x, int y, int z); + public @Nullable + abstract BlockState getBlock(int x, int y, int z); /** * Set a biome in XZ. This will likely set to the whole column @@ -199,10 +200,9 @@ public abstract class QueueCoordinator { * @param z z coordinate * @param biome biome * @return success or not - * * @deprecated Biomes now take XYZ, see {@link #setBiome(int, int, int, BiomeType)} - *
- * Scheduled for removal once we drop the support for versions not supporting 3D biomes. + *
+ * Scheduled for removal once we drop the support for versions not supporting 3D biomes. */ @Deprecated(forRemoval = true) public abstract boolean setBiome(int x, int z, @NonNull BiomeType biome); @@ -249,7 +249,8 @@ public abstract class QueueCoordinator { * * @return list of BlockVector2 of chunks that are to be "read" */ - public @NonNull abstract List getReadChunks(); + public @NonNull + abstract List getReadChunks(); /** * Add a set of {@link BlockVector2} Chunk coordinates to the Read Chunks list @@ -284,7 +285,8 @@ public abstract class QueueCoordinator { * * @return CuboidRegion to regenerate */ - public @Nullable abstract CuboidRegion getRegenRegion(); + public @Nullable + abstract CuboidRegion getRegenRegion(); /** * Set the {@link CuboidRegion} designated for direct regeneration @@ -306,7 +308,8 @@ public abstract class QueueCoordinator { * * @return world of the queue */ - public @Nullable abstract World getWorld(); + public @Nullable + abstract World getWorld(); /** * Set the queue as having been modified now @@ -353,7 +356,8 @@ public abstract class QueueCoordinator { * * @return Consumer to be executed on each chunk in queue */ - public @Nullable abstract Consumer getChunkConsumer(); + public @Nullable + abstract Consumer getChunkConsumer(); /** * Set the Consumer that will be executed on each chunk in queue @@ -370,7 +374,8 @@ public abstract class QueueCoordinator { /** * Get the {@link LightingMode} to be used when setting blocks */ - public @NonNull abstract LightingMode getLightingMode(); + public @NonNull + abstract LightingMode getLightingMode(); /** * Set the {@link LightingMode} to be used when setting blocks diff --git a/Core/src/main/java/com/plotsquared/core/queue/QueueProvider.java b/Core/src/main/java/com/plotsquared/core/queue/QueueProvider.java index 2f1c43288..56e495809 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/QueueProvider.java +++ b/Core/src/main/java/com/plotsquared/core/queue/QueueProvider.java @@ -27,9 +27,9 @@ package com.plotsquared.core.queue; import com.plotsquared.core.PlotSquared; import com.sk89q.worldedit.world.World; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; public abstract class QueueProvider { diff --git a/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java b/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java index 59acf48fa..0d1a272f1 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java +++ b/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java @@ -41,7 +41,6 @@ import net.kyori.adventure.text.minimessage.Template; import org.checkerframework.checker.nullness.qual.NonNull; import javax.annotation.Nullable; - import java.util.concurrent.atomic.AtomicBoolean; /** diff --git a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java index 690e417ed..02b896ff5 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java +++ b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java @@ -278,7 +278,9 @@ public enum CommonSetupSteps implements SetupStep { } private static boolean isValidWorldName(String s) { - return s.chars().allMatch((i) -> i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 65 && i <= 90 || i >= 48 && i <= 57 || i == 46); + return s + .chars() + .allMatch((i) -> i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 65 && i <= 90 || i >= 48 && i <= 57 || i == 46); } @Override diff --git a/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java b/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java index 669cf020c..9210ddb7e 100644 --- a/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java @@ -91,13 +91,13 @@ public final class BlockUtil { return FuzzyBlockState.builder().type(BlockTypes.AIR).build(); } String mutableId = id; - mutableId = id.toLowerCase(); - BlockType type = BlockTypes.get(mutableId ); + mutableId = id.toLowerCase(); + BlockType type = BlockTypes.get(mutableId); if (type != null) { return type.getDefaultState(); } - if (Character.isDigit(mutableId .charAt(0))) { - String[] split = mutableId .split(":"); + if (Character.isDigit(mutableId.charAt(0))) { + String[] split = mutableId.split(":"); if (MathMan.isInteger(split[0])) { if (split.length == 2) { if (MathMan.isInteger(split[1])) { diff --git a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java index 9b84bb9d8..5fdb8d316 100644 --- a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java +++ b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java @@ -32,9 +32,9 @@ import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.plot.BlockBucket; import com.sk89q.worldedit.world.block.BlockState; import net.kyori.adventure.text.minimessage.Template; -import org.checkerframework.checker.nullness.qual.NonNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; import java.util.Collection; import java.util.HashMap; @@ -117,7 +117,8 @@ public final class LegacyConverter { ) { final BlockBucket bucket = this.blockToBucket(block); this.setString(section, key, bucket); - ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("legacyconfig.legacy_config_replaced"), + ConsolePlayer.getConsole().sendMessage( + TranslatableCaption.of("legacyconfig.legacy_config_replaced"), Template.of("value1", block), Template.of("value2", bucket.toString()) ); @@ -132,7 +133,8 @@ public final class LegacyConverter { final BlockBucket bucket = this.blockListToBucket(blocks); this.setString(section, key, bucket); ConsolePlayer.getConsole() - .sendMessage(TranslatableCaption.of("legacyconfig.legacy_config_replaced"), + .sendMessage( + TranslatableCaption.of("legacyconfig.legacy_config_replaced"), Template.of("value1", plotBlockArrayString(blocks)), Template.of("value2", bucket.toString()) ); diff --git a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java index 0c9758fbc..f6bb1e10f 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java @@ -257,7 +257,8 @@ public abstract class PlayerManager

, T> { * @param object Platform player object * @return Player object */ - public @NonNull abstract P getPlayer(final @NonNull T object); + public @NonNull + abstract P getPlayer(final @NonNull T object); /** * Get a plot player from a UUID. This method requires @@ -280,7 +281,8 @@ public abstract class PlayerManager

, T> { } } - public @NonNull abstract P createPlayer(final @NonNull UUID uuid); + public @NonNull + abstract P createPlayer(final @NonNull UUID uuid); /** * Get an an offline player object from the player's UUID @@ -288,7 +290,8 @@ public abstract class PlayerManager

, T> { * @param uuid Player UUID * @return Offline player object */ - public @Nullable abstract OfflinePlotPlayer getOfflinePlayer(final @Nullable UUID uuid); + public @Nullable + abstract OfflinePlotPlayer getOfflinePlayer(final @Nullable UUID uuid); /** * Get an offline player object from the player's username @@ -296,7 +299,8 @@ public abstract class PlayerManager

, T> { * @param username Player name * @return Offline player object */ - public @Nullable abstract OfflinePlotPlayer getOfflinePlayer(final @NonNull String username); + public @Nullable + abstract OfflinePlotPlayer getOfflinePlayer(final @NonNull String username); /** * Get all online players @@ -311,7 +315,7 @@ public abstract class PlayerManager

, T> { public static final class NoSuchPlayerException extends IllegalArgumentException { public NoSuchPlayerException(final @NonNull UUID uuid) { - super(String.format("There is no online player with UUID '%s'", uuid.toString())); + super(String.format("There is no online player with UUID '%s'", uuid)); } } diff --git a/Core/src/main/java/com/plotsquared/core/util/PlotUploader.java b/Core/src/main/java/com/plotsquared/core/util/PlotUploader.java index a33a3cc93..ff9917046 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PlotUploader.java +++ b/Core/src/main/java/com/plotsquared/core/util/PlotUploader.java @@ -33,10 +33,10 @@ import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.plot.Plot; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTOutputStream; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.io.IOException; import java.io.OutputStream; diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index 3310395de..ee8468267 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -71,10 +71,10 @@ import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; diff --git a/Core/src/main/java/com/plotsquared/core/util/StringComparison.java b/Core/src/main/java/com/plotsquared/core/util/StringComparison.java index 1901a0318..634c693cc 100644 --- a/Core/src/main/java/com/plotsquared/core/util/StringComparison.java +++ b/Core/src/main/java/com/plotsquared/core/util/StringComparison.java @@ -35,10 +35,10 @@ import java.util.function.Function; */ public class StringComparison { + private final Function toString; private T bestMatch; private double match = Integer.MAX_VALUE; private T bestMatchObject; - private final Function toString; /** * Constructor diff --git a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java index e3484c72a..a824387b4 100644 --- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java @@ -100,7 +100,8 @@ public abstract class WorldUtil { * @deprecated May result in synchronous chunk loading */ @Deprecated - public @NonNull abstract String[] getSignSynchronous(@NonNull Location location); + public @NonNull + abstract String[] getSignSynchronous(@NonNull Location location); /** * Get the world spawn location @@ -108,7 +109,8 @@ public abstract class WorldUtil { * @param world World name * @return World spawn location */ - public @NonNull abstract Location getSpawn(@NonNull String world); + public @NonNull + abstract Location getSpawn(@NonNull String world); /** * Set the world spawn location @@ -130,7 +132,8 @@ public abstract class WorldUtil { * @param name Block name * @return Comparison result containing the closets matching block */ - public @NonNull abstract StringComparison.ComparisonResult getClosestBlock(@NonNull String name); + public @NonNull + abstract StringComparison.ComparisonResult getClosestBlock(@NonNull String name); /** * Set the block at the specified location to a sign, with given text @@ -165,7 +168,8 @@ public abstract class WorldUtil { * @deprecated Use {@link #getBiome(String, int, int, Consumer)} */ @Deprecated - public @NonNull abstract BiomeType getBiomeSynchronous(@NonNull String world, int x, int z); + public @NonNull + abstract BiomeType getBiomeSynchronous(@NonNull String world, int x, int z); /** * Get the block at a given location (asynchronously) @@ -183,7 +187,8 @@ public abstract class WorldUtil { * @deprecated Use {@link #getBlock(Location, Consumer)} */ @Deprecated - public @NonNull abstract BlockState getBlockSynchronous(@NonNull Location location); + public @NonNull + abstract BlockState getBlockSynchronous(@NonNull Location location); /** * Get the Y coordinate of the highest non-air block in the world, asynchronously @@ -398,14 +403,16 @@ public abstract class WorldUtil { * @param category Entity category * @return Set containing all entities belonging to the given category */ - public @NonNull abstract Set getTypesInCategory(@NonNull String category); + public @NonNull + abstract Set getTypesInCategory(@NonNull String category); /** * Get all recognized tile entity types * * @return Collection containing all known tile entity types */ - public @NonNull abstract Collection getTileEntityTypes(); + public @NonNull + abstract Collection getTileEntityTypes(); /** * Get the tile entity count in a chunk diff --git a/Core/src/main/java/com/plotsquared/core/util/placeholders/Placeholder.java b/Core/src/main/java/com/plotsquared/core/util/placeholders/Placeholder.java index 7e4b06ef5..891533889 100644 --- a/Core/src/main/java/com/plotsquared/core/util/placeholders/Placeholder.java +++ b/Core/src/main/java/com/plotsquared/core/util/placeholders/Placeholder.java @@ -46,14 +46,16 @@ public abstract class Placeholder { * @param player Player * @return Placeholder value. Return {@code ""} if no placeholder value can be returned */ - public @NonNull abstract String getValue(final @NonNull PlotPlayer player); + public @NonNull + abstract String getValue(final @NonNull PlotPlayer player); /** * Get the placeholder key * * @return Placeholder key */ - public @NonNull final String getKey() { + public @NonNull + final String getKey() { return this.key; } diff --git a/Core/src/main/java/com/plotsquared/core/util/placeholders/PlotSpecificPlaceholder.java b/Core/src/main/java/com/plotsquared/core/util/placeholders/PlotSpecificPlaceholder.java index 1755f7a4c..0011e12f8 100644 --- a/Core/src/main/java/com/plotsquared/core/util/placeholders/PlotSpecificPlaceholder.java +++ b/Core/src/main/java/com/plotsquared/core/util/placeholders/PlotSpecificPlaceholder.java @@ -39,7 +39,8 @@ public abstract class PlotSpecificPlaceholder extends Placeholder { } @Override - public @NonNull final String getValue(final @NonNull PlotPlayer player) { + public @NonNull + final String getValue(final @NonNull PlotPlayer player) { final Plot plot = player.getCurrentPlot(); if (plot == null) { return ""; @@ -54,7 +55,8 @@ public abstract class PlotSpecificPlaceholder extends Placeholder { * @param plot Plot that the player is in * @return Placeholder value, or {@code ""} if the placeholder does not apply */ - public @NonNull abstract String getValue( + public @NonNull + abstract String getValue( final @NonNull PlotPlayer player, final @NonNull Plot plot ); diff --git a/Core/src/main/java/com/plotsquared/core/util/query/SortingStrategy.java b/Core/src/main/java/com/plotsquared/core/util/query/SortingStrategy.java index 849ff8c83..c93cef757 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/SortingStrategy.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/SortingStrategy.java @@ -52,5 +52,5 @@ public enum SortingStrategy { /** * Sort using a comparator */ - COMPARATOR; + COMPARATOR } diff --git a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java index 845a524c3..2e0af830a 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java @@ -33,10 +33,10 @@ import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.util.ThreadUtils; import com.plotsquared.core.util.task.TaskManager; import net.kyori.adventure.text.minimessage.MiniMessage; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -215,9 +215,9 @@ public class UUIDPipeline { */ public void getSingle(final @NonNull String username, final @NonNull BiConsumer<@Nullable UUID, @Nullable Throwable> uuid) { this.getUUIDs(Collections.singletonList(username)).applyToEither( - timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), - Function.identity() - ) + timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), + Function.identity() + ) .whenComplete((uuids, throwable) -> { if (throwable != null) { uuid.accept(null, throwable); @@ -239,9 +239,9 @@ public class UUIDPipeline { */ public void getSingle(final @NonNull UUID uuid, final @NonNull BiConsumer<@Nullable String, @Nullable Throwable> username) { this.getNames(Collections.singletonList(uuid)).applyToEither( - timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), - Function.identity() - ) + timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), + Function.identity() + ) .whenComplete((uuids, throwable) -> { if (throwable != null) { username.accept(null, throwable); @@ -427,7 +427,8 @@ public class UUIDPipeline { * * @return All mappings that could be provided immediately */ - public @NonNull final Collection<@NonNull UUIDMapping> getAllImmediately() { + public @NonNull + final Collection<@NonNull UUIDMapping> getAllImmediately() { final Set mappings = new LinkedHashSet<>(); for (final UUIDService service : this.getServiceListInstance()) { mappings.addAll(service.getImmediately()); @@ -441,7 +442,8 @@ public class UUIDPipeline { * @param object Username ({@link String}) or {@link UUID} * @return Mapping, if it could be found immediately */ - public @Nullable final UUIDMapping getImmediately(final @NonNull Object object) { + public @Nullable + final UUIDMapping getImmediately(final @NonNull Object object) { for (final UUIDService uuidService : this.getServiceListInstance()) { final UUIDMapping mapping = uuidService.getImmediately(object); if (mapping != null) { diff --git a/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java b/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java index 89f484ac2..eb739a81b 100644 --- a/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java +++ b/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java @@ -48,8 +48,8 @@ class ClickStripTransformTest { var transform = new ClickStripTransform(EnumSet.of(commonAction)); var component = Component.text("Hello") .clickEvent(ClickEvent.clickEvent( - commonAction, - "World" + commonAction, + "World" ) ); var transformedComponent = transform.transform(component); diff --git a/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java b/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java index 7a030aa59..172a905c3 100644 --- a/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java +++ b/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java @@ -30,10 +30,10 @@ import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.UseFlag; import com.sk89q.worldedit.world.item.ItemType; -import org.junit.Before; -import org.junit.Test; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java b/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java index 74e9eedbb..e7d8b323d 100644 --- a/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java +++ b/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java @@ -26,9 +26,9 @@ package com.plotsquared.core.plot; import com.plotsquared.core.PlotVersion; -import org.junit.Test; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.junit.Test; public class PlotVersionTest {