From 510ea5643127fd04ee99c57ed760ad794b50d816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Tue, 14 Jul 2020 18:49:40 +0200 Subject: [PATCH] Finalize DI stuff --- Bukkit/build.gradle | 3 +- Bukkit/pom.xml | 6 ++ .../plotsquared/bukkit/BukkitPlatform.java | 72 +++++++++++---- .../bukkit/entity/EntityWrapper.java | 5 +- .../bukkit/generator/BlockStatePopulator.java | 15 +-- .../generator/BukkitAugmentedGenerator.java | 4 +- .../bukkit/generator/BukkitPlotGenerator.java | 20 ++-- .../generator/DelegatePlotGenerator.java | 10 +- .../bukkit/inject/BukkitModule.java | 29 +++++- .../bukkit/inject/WorldManagerModule.java | 13 ++- .../bukkit/listener/ChunkListener.java | 4 +- .../bukkit/listener/EntitySpawnListener.java | 10 +- .../bukkit/listener/PaperListener.java | 4 +- .../bukkit/listener/PlayerEvents.java | 12 +-- .../bukkit/listener/WorldEvents.java | 4 +- .../bukkit/managers/BukkitWorldManager.java | 6 +- .../managers/HyperverseWorldManager.java | 6 +- .../managers/MultiverseWorldManager.java | 6 +- .../bukkit/player/BukkitOfflinePlayer.java | 4 +- .../bukkit/player/BukkitPlayer.java | 36 ++++---- .../bukkit/player/BukkitPlayerManager.java | 23 +++-- .../bukkit/queue/BukkitLocalQueue.java | 7 +- .../plotsquared/bukkit/queue/GenChunk.java | 4 +- .../schematic/BukkitSchematicHandler.java | 4 +- .../bukkit/util/BukkitChunkManager.java | 5 +- .../bukkit/util/BukkitEconHandler.java | 2 +- .../bukkit/util/BukkitRegionManager.java | 20 ++-- .../bukkit/util/BukkitSetupUtils.java | 8 +- .../plotsquared/bukkit/util/BukkitUtil.java | 60 ++++++------ .../plotsquared/bukkit/util/BukkitWorld.java | 12 +-- .../com/plotsquared/bukkit/util/SetGenCB.java | 2 +- .../bukkit/uuid/BungeePermsUUIDService.java | 6 +- .../bukkit/uuid/EssentialsUUIDService.java | 6 +- .../bukkit/uuid/LuckPermsUUIDService.java | 6 +- .../bukkit/uuid/OfflinePlayerUUIDService.java | 6 +- .../bukkit/uuid/PaperUUIDService.java | 6 +- .../bukkit/uuid/SQLiteUUIDService.java | 8 +- .../bukkit/uuid/SquirrelIdUUIDService.java | 6 +- Core/build.gradle | 2 +- Core/pom.xml | 42 +++++---- .../com/plotsquared/core/PlotPlatform.java | 48 +++++++--- .../com/plotsquared/core/PlotSquared.java | 90 +++++++----------- .../com/plotsquared/core/backup/Backup.java | 2 +- .../core/backup/BackupManager.java | 12 +-- .../core/backup/BackupProfile.java | 10 +- .../core/backup/NullBackupManager.java | 10 +- .../core/backup/NullBackupProfile.java | 10 +- .../core/backup/PlayerBackupProfile.java | 18 ++-- .../core/backup/SimpleBackupManager.java | 10 +- .../com/plotsquared/core/command/Add.java | 5 +- .../com/plotsquared/core/command/Area.java | 16 ++-- .../com/plotsquared/core/command/Auto.java | 26 +++--- .../com/plotsquared/core/command/Backup.java | 4 +- .../com/plotsquared/core/command/Buy.java | 6 +- .../com/plotsquared/core/command/Caps.java | 2 +- .../com/plotsquared/core/command/Claim.java | 6 +- .../com/plotsquared/core/command/Clear.java | 6 +- .../com/plotsquared/core/command/Command.java | 4 +- .../plotsquared/core/command/Condense.java | 10 +- .../plotsquared/core/command/Continue.java | 5 +- .../core/command/CreateRoadSchematic.java | 4 +- .../core/command/DatabaseCommand.java | 9 +- .../com/plotsquared/core/command/Debug.java | 11 ++- .../plotsquared/core/command/DebugExec.java | 76 +++++++-------- .../core/command/DebugImportWorlds.java | 10 +- .../plotsquared/core/command/DebugPaste.java | 11 ++- .../core/command/DebugRoadRegen.java | 4 +- .../com/plotsquared/core/command/Delete.java | 6 +- .../com/plotsquared/core/command/Deny.java | 8 +- .../com/plotsquared/core/command/Desc.java | 5 +- .../com/plotsquared/core/command/Dislike.java | 5 +- .../com/plotsquared/core/command/Done.java | 12 ++- .../plotsquared/core/command/Download.java | 19 ++-- .../plotsquared/core/command/FlagCommand.java | 12 +-- .../plotsquared/core/command/HomeCommand.java | 11 ++- .../com/plotsquared/core/command/Kick.java | 6 +- .../com/plotsquared/core/command/Leave.java | 5 +- .../com/plotsquared/core/command/Like.java | 5 +- .../com/plotsquared/core/command/ListCmd.java | 6 +- .../com/plotsquared/core/command/Load.java | 6 +- .../plotsquared/core/command/MainCommand.java | 21 ++--- .../com/plotsquared/core/command/Merge.java | 6 +- .../com/plotsquared/core/command/Move.java | 5 +- .../com/plotsquared/core/command/Music.java | 2 +- .../com/plotsquared/core/command/Owner.java | 5 +- .../plotsquared/core/command/PluginCmd.java | 2 +- .../com/plotsquared/core/command/Purge.java | 6 +- .../com/plotsquared/core/command/Rate.java | 11 ++- .../core/command/RegenAllRoads.java | 6 +- .../com/plotsquared/core/command/Reload.java | 9 +- .../com/plotsquared/core/command/Remove.java | 5 +- .../com/plotsquared/core/command/Save.java | 12 ++- .../core/command/SchematicCmd.java | 6 +- .../com/plotsquared/core/command/Set.java | 13 ++- .../com/plotsquared/core/command/Setup.java | 10 +- .../plotsquared/core/command/Template.java | 14 +-- .../com/plotsquared/core/command/Trim.java | 23 +++-- .../com/plotsquared/core/command/Trust.java | 5 +- .../com/plotsquared/core/command/Unlink.java | 5 +- .../com/plotsquared/core/command/Visit.java | 9 +- .../core/components/ComponentPreset.java | 4 +- .../components/ComponentPresetManager.java | 6 +- .../core/configuration/ConfigurationUtil.java | 8 +- .../plotsquared/core/database/AbstractDB.java | 4 +- .../plotsquared/core/database/SQLManager.java | 16 ++-- .../core/events/PlotAutoMergeEvent.java | 6 +- .../core/events/PlotChangeOwnerEvent.java | 2 +- .../plotsquared/core/events/PlotEvent.java | 4 +- .../core/events/PlotMergeEvent.java | 6 +- .../core/events/PlotRateEvent.java | 2 +- .../core/events/PlotUnlinkEvent.java | 4 +- .../core/generator/AugmentedUtils.java | 6 +- .../core/generator/ClassicPlotManager.java | 6 +- .../ClassicPlotManagerComponent.java | 4 +- .../core/generator/ClassicPlotWorld.java | 18 ++-- .../core/generator/GridPlotWorld.java | 10 +- .../plotsquared/core/generator/HybridGen.java | 6 +- .../core/generator/HybridPlotManager.java | 6 +- .../core/generator/HybridPlotWorld.java | 28 +++--- .../core/generator/HybridUtils.java | 8 +- .../core/generator/SingleWorldGenerator.java | 4 +- .../core/generator/SquarePlotManager.java | 4 +- .../core/generator/SquarePlotWorld.java | 10 +- .../annotations/BackgroundPipeline.java | 3 + .../core/inject/annotations/ConfigFile.java | 3 + .../core/inject/annotations/ConsoleActor.java | 3 + .../inject/annotations/DefaultGenerator.java | 3 + .../inject/annotations/ImpromptuPipeline.java | 3 + .../core/inject/annotations/WorldConfig.java | 3 + .../core/inject/annotations/WorldFile.java | 3 + .../factory/HybridPlotWorldFactory.java | 12 ++- .../factory/PlayerBackupProfileFactory.java | 4 +- .../core/listener/PlotListener.java | 2 +- .../core/listener/ProcessedWEExtent.java | 4 +- .../core/listener/WESubscriber.java | 4 +- .../plotsquared/core/location/Location.java | 63 ++++++------- .../plotsquared/core/location/PlotLoc.java | 2 +- .../com/plotsquared/core/location/World.java | 10 +- .../core/player/ConsolePlayer.java | 26 +++--- .../plotsquared/core/player/PlotPlayer.java | 27 +++--- .../plotsquared/core/plot/BlockBucket.java | 13 +-- .../java/com/plotsquared/core/plot/Plot.java | 32 +++---- .../com/plotsquared/core/plot/PlotArea.java | 92 +++++++++---------- .../plotsquared/core/plot/PlotCluster.java | 4 +- .../com/plotsquared/core/plot/PlotId.java | 8 +- .../plotsquared/core/plot/PlotInventory.java | 17 ++-- .../com/plotsquared/core/plot/PlotWorld.java | 18 ++-- .../core/plot/expiration/ExpireManager.java | 4 +- .../core/plot/expiration/ExpiryTask.java | 4 +- .../core/plot/flag/FlagContainer.java | 6 +- .../plotsquared/core/plot/flag/PlotFlag.java | 16 ++-- .../flag/implementations/AnalysisFlag.java | 6 +- .../implementations/AnimalAttackFlag.java | 4 +- .../flag/implementations/AnimalCapFlag.java | 4 +- .../implementations/AnimalInteractFlag.java | 4 +- .../flag/implementations/BlockBurnFlag.java | 4 +- .../implementations/BlockIgnitionFlag.java | 4 +- .../flag/implementations/BlockedCmdsFlag.java | 6 +- .../plot/flag/implementations/BreakFlag.java | 4 +- .../plot/flag/implementations/ChatFlag.java | 4 +- .../flag/implementations/CoralDryFlag.java | 4 +- .../flag/implementations/DenyExitFlag.java | 5 +- .../implementations/DenyTeleportFlag.java | 14 +-- .../flag/implementations/DescriptionFlag.java | 10 +- .../implementations/DeviceInteractFlag.java | 4 +- .../implementations/DisablePhysicsFlag.java | 4 +- .../plot/flag/implementations/DoneFlag.java | 10 +- .../implementations/DropProtectionFlag.java | 4 +- .../flag/implementations/EntityCapFlag.java | 4 +- .../flag/implementations/ExplosionFlag.java | 4 +- .../flag/implementations/FarewellFlag.java | 10 +- .../plot/flag/implementations/FeedFlag.java | 6 +- .../plot/flag/implementations/FlyFlag.java | 8 +- .../flag/implementations/ForcefieldFlag.java | 4 +- .../flag/implementations/GamemodeFlag.java | 10 +- .../flag/implementations/GrassGrowFlag.java | 4 +- .../flag/implementations/GreetingFlag.java | 10 +- .../implementations/GuestGamemodeFlag.java | 10 +- .../implementations/HangingBreakFlag.java | 4 +- .../implementations/HangingPlaceFlag.java | 4 +- .../plot/flag/implementations/HealFlag.java | 6 +- .../flag/implementations/HideInfoFlag.java | 4 +- .../implementations/HostileAttackFlag.java | 4 +- .../flag/implementations/HostileCapFlag.java | 4 +- .../implementations/HostileInteractFlag.java | 4 +- .../flag/implementations/IceFormFlag.java | 4 +- .../flag/implementations/IceMeltFlag.java | 4 +- .../flag/implementations/InstabreakFlag.java | 4 +- .../flag/implementations/InvincibleFlag.java | 4 +- .../flag/implementations/ItemDropFlag.java | 4 +- .../plot/flag/implementations/KeepFlag.java | 10 +- .../implementations/KeepInventoryFlag.java | 4 +- .../flag/implementations/KelpGrowFlag.java | 4 +- .../flag/implementations/LiquidFlowFlag.java | 8 +- .../flag/implementations/MiscBreakFlag.java | 4 +- .../flag/implementations/MiscCapFlag.java | 4 +- .../implementations/MiscInteractFlag.java | 4 +- .../flag/implementations/MiscPlaceFlag.java | 4 +- .../flag/implementations/MobBreakFlag.java | 4 +- .../plot/flag/implementations/MobCapFlag.java | 4 +- .../flag/implementations/MobPlaceFlag.java | 4 +- .../plot/flag/implementations/MusicFlag.java | 8 +- .../flag/implementations/MycelGrowFlag.java | 4 +- .../flag/implementations/NoWorldeditFlag.java | 4 +- .../flag/implementations/NotifyEnterFlag.java | 4 +- .../flag/implementations/NotifyLeaveFlag.java | 4 +- .../plot/flag/implementations/PlaceFlag.java | 4 +- .../implementations/PlayerInteractFlag.java | 4 +- .../PreventCreativeCopyFlag.java | 6 +- .../plot/flag/implementations/PriceFlag.java | 6 +- .../plot/flag/implementations/PveFlag.java | 4 +- .../plot/flag/implementations/PvpFlag.java | 4 +- .../flag/implementations/RedstoneFlag.java | 4 +- .../flag/implementations/ServerPlotFlag.java | 4 +- .../flag/implementations/SnowFormFlag.java | 4 +- .../flag/implementations/SnowMeltFlag.java | 4 +- .../flag/implementations/SoilDryFlag.java | 4 +- .../flag/implementations/TamedAttackFlag.java | 4 +- .../implementations/TamedInteractFlag.java | 4 +- .../plot/flag/implementations/TimeFlag.java | 6 +- .../plot/flag/implementations/TitlesFlag.java | 10 +- .../implementations/UntrustedVisitFlag.java | 4 +- .../plot/flag/implementations/UseFlag.java | 4 +- .../implementations/VehicleBreakFlag.java | 4 +- .../flag/implementations/VehicleCapFlag.java | 4 +- .../implementations/VehiclePlaceFlag.java | 4 +- .../flag/implementations/VehicleUseFlag.java | 4 +- .../implementations/VillagerInteractFlag.java | 4 +- .../flag/implementations/VineGrowFlag.java | 4 +- .../flag/implementations/WeatherFlag.java | 10 +- .../plot/flag/types/BlockTypeListFlag.java | 4 +- .../plot/flag/types/BlockTypeWrapper.java | 10 +- .../core/plot/flag/types/BooleanFlag.java | 6 +- .../core/plot/flag/types/DoubleFlag.java | 12 +-- .../core/plot/flag/types/IntegerFlag.java | 10 +- .../core/plot/flag/types/ListFlag.java | 4 +- .../core/plot/flag/types/LongFlag.java | 12 +-- .../flag/types/NonNegativeIntegerFlag.java | 6 +- .../core/plot/flag/types/NumberFlag.java | 10 +- .../core/plot/flag/types/TimedFlag.java | 8 +- .../plot/world/DefaultPlotAreaManager.java | 22 ++--- .../core/plot/world/PlotAreaManager.java | 36 ++++---- .../core/plot/world/ScatteredPlotWorld.java | 16 ++-- .../core/plot/world/SinglePlot.java | 6 +- .../core/plot/world/SinglePlotArea.java | 44 ++++----- .../plot/world/SinglePlotAreaManager.java | 36 ++++---- .../core/plot/world/SinglePlotManager.java | 8 +- .../core/plot/world/StandardPlotWorld.java | 12 +-- .../AreaBoundDelegateLocalBlockQueue.java | 4 +- .../core/queue/BasicLocalBlockQueue.java | 6 +- .../core/queue/ChunkBlockQueue.java | 6 +- .../core/queue/LocalBlockQueue.java | 6 +- .../core/setup/CommonSetupSteps.java | 14 +-- .../core/setup/SettingsNodeStep.java | 6 +- .../com/plotsquared/core/setup/SetupStep.java | 6 +- .../com/plotsquared/core/util/BlockUtil.java | 4 +- .../com/plotsquared/core/util/EntityUtil.java | 4 +- .../core/util/EventDispatcher.java | 8 +- .../core/util/LegacyConverter.java | 24 ++--- .../com/plotsquared/core/util/MainUtil.java | 16 ++-- .../plotsquared/core/util/OperationUtil.java | 10 +- .../plotsquared/core/util/PatternUtil.java | 4 +- .../core/util/PlatformWorldManager.java | 6 +- .../plotsquared/core/util/PlayerManager.java | 18 ++-- .../plotsquared/core/util/RegionManager.java | 4 +- .../com/plotsquared/core/util/RegionUtil.java | 4 +- .../core/util/SchematicHandler.java | 8 +- .../com/plotsquared/core/util/StringMan.java | 4 +- .../plotsquared/core/util/TabCompletions.java | 30 +++--- .../com/plotsquared/core/util/WorldUtil.java | 6 +- .../core/util/query/AliasFilter.java | 6 +- .../core/util/query/FixedPlotProvider.java | 4 +- .../core/util/query/GlobalPlotProvider.java | 4 +- .../core/util/query/MemberFilter.java | 8 +- .../core/util/query/OwnerFilter.java | 6 +- .../core/util/query/PaginatedPlotResult.java | 4 +- .../core/util/query/PlotFilter.java | 6 +- .../core/util/query/PlotQuery.java | 52 +++++------ .../core/util/query/PredicateFilter.java | 6 +- .../core/util/query/SearchPlotProvider.java | 4 +- .../core/uuid/CacheUUIDService.java | 12 +-- .../plotsquared/core/uuid/ServiceError.java | 6 +- .../plotsquared/core/uuid/UUIDMapping.java | 8 +- .../plotsquared/core/uuid/UUIDPipeline.java | 40 ++++---- .../plotsquared/core/uuid/UUIDService.java | 12 +-- .../uuid/offline/OfflineModeUUIDService.java | 8 +- .../core/database/AbstractDBTest.java | 4 +- build.gradle | 4 +- 288 files changed, 1512 insertions(+), 1320 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 3479adaeb..3730e0577 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -101,13 +101,14 @@ shadowJar { include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT")) include(dependency("com.google.inject:guice:4.2.3")) include(dependency("com.google.inject.extensions:guice-assistedinject:4.2.3")) + include(dependency("javax.annotation:javax-annotation-api")) } relocate('net.kyori.text', 'com.plotsquared.formatting.text') relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib") relocate("org.bstats", "com.plotsquared.metrics") relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid') relocate('org.khelekore.prtree', 'com.plotsquared.prtree') - relocate('com.google', 'com.plotsquared.google') + relocate('com.google.inject', 'com.plotsquared.google') archiveFileName = "${project.name}-${parent.version}.jar" destinationDirectory = file "../target" } diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index cde998b9a..7c51f3aec 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -12,6 +12,12 @@ 20200518 compile + + javax.annotation + javax.annotation-api + 1.3.2 + compile + org.bstats bstats-bukkit diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index dcf48a119..a2f434e76 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -61,6 +61,7 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.backup.BackupManager; import com.plotsquared.core.command.WE_Anywhere; import com.plotsquared.core.components.ComponentPresetManager; +import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ChatFormatter; import com.plotsquared.core.configuration.ConfigurationNode; @@ -79,12 +80,14 @@ import com.plotsquared.core.inject.annotations.WorldFile; import com.plotsquared.core.inject.modules.PlotSquaredModule; import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.WESubscriber; +import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotId; +import com.plotsquared.core.plot.comment.CommentManager; import com.plotsquared.core.plot.message.PlainChatManager; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotArea; @@ -111,7 +114,7 @@ import com.plotsquared.core.uuid.offline.OfflineModeUUIDService; import com.sk89q.worldedit.WorldEdit; import io.papermc.lib.PaperLib; import lombok.Getter; -import lombok.NonNull; + import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -129,8 +132,8 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.lang.reflect.Method; @@ -234,8 +237,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; // 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, new PlotSquaredModule(), - new BukkitModule(this), new BackupModule(), new WorldManagerModule()); + this.injector = Guice.createInjector(Stage.PRODUCTION, new WorldManagerModule(), new PlotSquaredModule(), + new BukkitModule(this), new BackupModule()); this.injector.injectMembers(this); if (PremiumVerification.isPremium() && Settings.Enabled_Components.UPDATE_NOTIFICATIONS) { @@ -253,6 +256,33 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; PlotSquared.log(Captions.PREFIX + "&6Couldn't verify purchase :("); } + // Database + if (Settings.Enabled_Components.DATABASE) { + plotSquared.setupDatabase(); + } + + // Check if we need to convert old flag values, etc + if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) { + // Perform upgrade + if (DBFunc.dbManager.convertFlags()) { + log(Captions.PREFIX.getTranslated() + "Flags were converted successfully!"); + // Update the config version + try { + plotSquared.setConfigurationVersion("v5"); + } catch (final Exception e) { + e.printStackTrace(); + } + } + } + + // Comments + CommentManager.registerDefaultInboxes(); + + plotSquared.startExpiryTasks(); + + // This is getting removed so I won't even bother migrating it + ChatManager.manager = this.initChatManager(); + // Do stuff that was previously done in PlotSquared // Kill entities if (Settings.Enabled_Components.KILL_ROAD_MOBS @@ -302,8 +332,14 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; // Economy if (Settings.Enabled_Components.ECONOMY) { TaskManager.runTask(() -> { - getInjector().getInstance(PermHandler.class).init(); - getInjector().getInstance(EconHandler.class).init(); + final PermHandler permHandler = getInjector().getInstance(PermHandler.class); + if (permHandler != null) { + permHandler.init(); + } + final EconHandler econHandler = getInjector().getInstance(EconHandler.class); + if (econHandler != null) { + econHandler.init(); + } }); } @@ -501,6 +537,10 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; getLogger().warning("Failed to clean up players: " + e.getMessage()); } }, 100L, 100L); + + PlotSquared.log(Captions.PREFIX + CaptionUtility + .format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(), + this.getPluginName())); } private void unload() { @@ -582,8 +622,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; } } - private void startUuidCaching(@NotNull final SQLiteUUIDService sqLiteUUIDService, - @NotNull final CacheUUIDService cacheUUIDService) { + private void startUuidCaching(@Nonnull final SQLiteUUIDService sqLiteUUIDService, + @Nonnull final CacheUUIDService cacheUUIDService) { // Load all uuids into a big chunky boi queue final Queue uuidQueue = new LinkedBlockingQueue<>(); PlotSquared.get().forEachPlotRaw(plot -> { @@ -658,7 +698,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; Bukkit.getScheduler().cancelTasks(this); } - @Override public void log(@NonNull String message) { + @Override public void log(@Nonnull String message) { try { message = Captions.color(message); if (!Settings.Chat.CONSOLE_COLOR) { @@ -948,7 +988,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; } @Override @Nullable - public final ChunkGenerator getDefaultWorldGenerator(@NotNull final String worldName, + public final ChunkGenerator getDefaultWorldGenerator(@Nonnull final String worldName, final String id) { final IndependentPlotGenerator result; if (id != null && id.equalsIgnoreCase("single")) { @@ -962,7 +1002,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; return (ChunkGenerator) result.specify(worldName); } - @Override @Nullable public GeneratorWrapper getGenerator(@NonNull final String world, + @Override @Nullable public GeneratorWrapper getGenerator(@Nonnull final String world, @Nullable final String name) { if (name == null) { return null; @@ -1011,11 +1051,11 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; "WorldEdit")); } - @Override public void unregister(@NonNull final PlotPlayer player) { + @Override public void unregister(@Nonnull final PlotPlayer player) { BukkitUtil.removePlayer(player.getUUID()); } - @Override public void setGenerator(@NonNull final String worldName) { + @Override public void setGenerator(@Nonnull final String worldName) { World world = BukkitUtil.getWorld(worldName); if (world == null) { // create world @@ -1098,7 +1138,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; } @Override public GeneratorWrapper wrapPlotGenerator(@Nullable final String world, - @NonNull final IndependentPlotGenerator generator) { + @Nonnull final IndependentPlotGenerator generator) { return new BukkitPlotGenerator(world, generator, this.plotAreaManager); } @@ -1112,7 +1152,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; return names; } - @Override @NotNull public com.plotsquared.core.location.World getPlatformWorld(@NotNull final String worldName) { + @Override public com.plotsquared.core.location.World getPlatformWorld(@Nonnull final String worldName) { return BukkitWorld.of(worldName); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java index 6e777f23a..08924e27a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/EntityWrapper.java @@ -26,11 +26,12 @@ package com.plotsquared.bukkit.entity; import lombok.Getter; -import lombok.NonNull; + import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import javax.annotation.Nonnull; @Getter public abstract class EntityWrapper { @@ -43,7 +44,7 @@ public abstract class EntityWrapper { public double y; public double z; - EntityWrapper(@NonNull final Entity entity) { + EntityWrapper(@Nonnull final Entity entity) { this.entity = entity; this.type = entity.getType(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java index 0dc7e943f..3e3b74938 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java @@ -25,17 +25,17 @@ */ package com.plotsquared.bukkit.generator; +import com.plotsquared.core.PlotSquared; import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.location.ChunkWrapper; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.world.PlotAreaManager; -import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Random; @@ -46,17 +46,18 @@ final class BlockStatePopulator extends BlockPopulator { private LocalBlockQueue queue; - public BlockStatePopulator(@NotNull final IndependentPlotGenerator plotGenerator, - @NotNull final PlotAreaManager plotAreaManager) { + public BlockStatePopulator(@Nonnull final IndependentPlotGenerator plotGenerator, + @Nonnull final PlotAreaManager plotAreaManager) { this.plotGenerator = plotGenerator; this.plotAreaManager = plotAreaManager; } @Override - public void populate(@NotNull final World world, @NotNull final Random random, - @NotNull final Chunk source) { + public void populate(@Nonnull final World world, @Nonnull final Random random, + @Nonnull final Chunk source) { if (this.queue == null) { - this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false); + this.queue = PlotSquared.platform().getGlobalBlockQueue() + .getNewQueue(world.getName(), false); } final PlotArea area = this.plotAreaManager.getPlotArea(world.getName(), null); if (area == null) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java index ff158f295..7c08c6871 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java @@ -29,7 +29,7 @@ import com.plotsquared.core.generator.AugmentedUtils; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Random; @@ -51,7 +51,7 @@ public class BukkitAugmentedGenerator extends BlockPopulator { } @Override - public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk source) { + public void populate(@Nonnull World world, @Nonnull Random random, @Nonnull Chunk source) { AugmentedUtils.generate(source, world.getName(), source.getX(), source.getZ(), null); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index c8169ce9e..60bb34b9a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -43,7 +43,7 @@ import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -64,9 +64,9 @@ public class BukkitPlotGenerator extends ChunkGenerator @Getter private final String levelName; - public BukkitPlotGenerator(@NotNull final String name, - @NotNull final IndependentPlotGenerator generator, - @NotNull final PlotAreaManager plotAreaManager) { + public BukkitPlotGenerator(@Nonnull final String name, + @Nonnull final IndependentPlotGenerator generator, + @Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; this.levelName = name; this.plotGenerator = generator; @@ -77,7 +77,7 @@ public class BukkitPlotGenerator extends ChunkGenerator MainUtil.initCache(); } - public BukkitPlotGenerator(final String world, final ChunkGenerator cg, @NotNull final PlotAreaManager plotAreaManager) { + public BukkitPlotGenerator(final String world, final ChunkGenerator cg, @Nonnull final PlotAreaManager plotAreaManager) { if (cg instanceof BukkitPlotGenerator) { throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName() + " is already a BukkitPlotGenerator!"); @@ -106,7 +106,7 @@ public class BukkitPlotGenerator extends ChunkGenerator return this.platformGenerator; } - @Override @NotNull public List getDefaultPopulators(@NotNull World world) { + @Override @Nonnull public List getDefaultPopulators(@Nonnull World world) { try { if (!this.loaded) { String name = world.getName(); @@ -150,9 +150,9 @@ public class BukkitPlotGenerator extends ChunkGenerator return toAdd; } - @Override @NotNull - public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, - @NotNull BiomeGrid biome) { + @Override @Nonnull + public ChunkData generateChunkData(@Nonnull World world, @Nonnull Random random, int x, int z, + @Nonnull BiomeGrid biome) { GenChunk result = new GenChunk(); if (this.getPlotGenerator() instanceof SingleWorldGenerator) { @@ -216,7 +216,7 @@ public class BukkitPlotGenerator extends ChunkGenerator ChunkManager.postProcessChunk(loc, result); } - @Override public boolean canSpawn(@NotNull final World world, final int x, final int z) { + @Override public boolean canSpawn(@Nonnull final World world, final int x, final int z) { return true; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java index bb6a46041..6452941a2 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -38,7 +38,7 @@ import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.jetbrains.annotations.Range; import java.util.Random; @@ -74,21 +74,21 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator { ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { @Override public void setBiome(@Range(from = 0, to = 15) int x, - @Range(from = 0, to = 15) int z, @NotNull Biome biome) { + @Range(from = 0, to = 15) int z, @Nonnull Biome biome) { result.setBiome(x, z, BukkitAdapter.adapt(biome)); } //do not annotate with Override until we discontinue support for 1.4.4 - public void setBiome(int x, int y, int z, @NotNull Biome biome) { + public void setBiome(int x, int y, int z, @Nonnull Biome biome) { result.setBiome(x, z, BukkitAdapter.adapt(biome)); } - @Override @NotNull public Biome getBiome(int x, int z) { + @Override @Nonnull public Biome getBiome(int x, int z) { return Biome.FOREST; } - @Override public @NotNull Biome getBiome(int x, int y, int z) { + @Override public @Nonnull Biome getBiome(int x, int y, int z) { return Biome.FOREST; } }; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java index 01f450316..c6fe99ba7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java @@ -27,6 +27,7 @@ package com.plotsquared.bukkit.inject; import com.google.inject.AbstractModule; import com.google.inject.assistedinject.FactoryModuleBuilder; +import com.google.inject.util.Providers; import com.plotsquared.bukkit.BukkitPlatform; import com.plotsquared.bukkit.player.BukkitPlayerManager; import com.plotsquared.bukkit.queue.BukkitLocalQueue; @@ -65,7 +66,7 @@ import lombok.RequiredArgsConstructor; import org.bukkit.Bukkit; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.plugin.java.JavaPlugin; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @RequiredArgsConstructor public class BukkitModule extends AbstractModule { @@ -77,7 +78,7 @@ import org.jetbrains.annotations.NotNull; bind(PlotPlatform.class).toInstance(bukkitPlatform); bind(IndependentPlotGenerator.class).annotatedWith(DefaultGenerator.class).to(HybridGen.class); // Console actor - @NotNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); + @Nonnull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit")); bind(Actor.class).annotatedWith(ConsoleActor.class).toInstance(wePlugin.wrapCommandSender(console)); bind(InventoryUtil.class).to(BukkitInventoryUtil.class); @@ -88,8 +89,7 @@ import org.jetbrains.annotations.NotNull; bind(ChunkManager.class).to(BukkitChunkManager.class); bind(RegionManager.class).to(BukkitRegionManager.class); bind(SchematicHandler.class).to(BukkitSchematicHandler.class); - bind(PermHandler.class).to(BukkitPermHandler.class); - bind(EconHandler.class).to(BukkitEconHandler.class); + this.setupVault(); if (Settings.Enabled_Components.WORLDS) { bind(PlotAreaManager.class).to(SinglePlotAreaManager.class); } else { @@ -98,4 +98,25 @@ import org.jetbrains.annotations.NotNull; install(new FactoryModuleBuilder().build(HybridPlotWorldFactory.class)); } + private void setupVault() { + if (Bukkit.getPluginManager().isPluginEnabled("Vault")) { + BukkitPermHandler bukkitPermHandler = null; + try { + bukkitPermHandler = new BukkitPermHandler(); + bind(PermHandler.class).toInstance(bukkitPermHandler); + } catch (final Exception ignored) { + bind(PermHandler.class).toProvider(Providers.of(null)); + } + try { + final BukkitEconHandler bukkitEconHandler = new BukkitEconHandler(bukkitPermHandler); + bind(EconHandler.class).toInstance(bukkitEconHandler); + } catch (final Exception ignored) { + bind(EconHandler.class).toProvider(Providers.of(null)); + } + } else { + bind(PermHandler.class).toProvider(Providers.of(null)); + bind(EconHandler.class).toProvider(Providers.of(null)); + } + } + } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java index 361049d90..f098192b5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/WorldManagerModule.java @@ -26,21 +26,26 @@ package com.plotsquared.bukkit.inject; import com.google.inject.AbstractModule; +import com.google.inject.Provides; +import com.google.inject.Singleton; import com.plotsquared.bukkit.managers.BukkitWorldManager; import com.plotsquared.bukkit.managers.HyperverseWorldManager; import com.plotsquared.bukkit.managers.MultiverseWorldManager; import com.plotsquared.core.util.PlatformWorldManager; import org.bukkit.Bukkit; +import org.bukkit.World; public class WorldManagerModule extends AbstractModule { - @Override protected void configure() { + @Provides + @Singleton + PlatformWorldManager provideWorldManager() { if (Bukkit.getPluginManager().getPlugin("Hyperverse") != null) { - bind(PlatformWorldManager.class).to(HyperverseWorldManager.class); + return new HyperverseWorldManager(); } else if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) { - bind(PlatformWorldManager.class).to(MultiverseWorldManager.class); + return new MultiverseWorldManager(); } else { - bind(PlatformWorldManager.class).to(BukkitWorldManager.class); + return new BukkitWorldManager(); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java index 8c41c30d7..a5109983d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java @@ -53,7 +53,7 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.lang.reflect.Method; import java.util.HashSet; @@ -70,7 +70,7 @@ public class ChunkListener implements Listener { private Chunk lastChunk; private boolean ignoreUnload = false; - @Inject public ChunkListener(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public ChunkListener(@Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; if (Settings.Chunk_Processor.AUTO_TRIM) { try { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java index b122b51d1..85903eb9a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -53,7 +53,7 @@ import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.List; @@ -65,7 +65,7 @@ public class EntitySpawnListener implements Listener { private static String areaName = null; public static void testNether(final Entity entity) { - @NotNull World world = entity.getWorld(); + @Nonnull World world = entity.getWorld(); if (world.getEnvironment() != World.Environment.NETHER && world.getEnvironment() != World.Environment.THE_END) { return; @@ -74,7 +74,7 @@ public class EntitySpawnListener implements Listener { } public static void testCreate(final Entity entity) { - @NotNull World world = entity.getWorld(); + @Nonnull World world = entity.getWorld(); if (areaName == world.getName()) { } else { areaName = world.getName(); @@ -87,7 +87,7 @@ public class EntitySpawnListener implements Listener { } public static void test(Entity entity) { - @NotNull World world = entity.getWorld(); + @Nonnull World world = entity.getWorld(); List meta = entity.getMetadata(KEY); if (meta.isEmpty()) { if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world.getName())) { @@ -167,7 +167,7 @@ public class EntitySpawnListener implements Listener { } @EventHandler public void onChunkLoad(ChunkLoadEvent event) { - @NotNull Chunk chunk = event.getChunk(); + @Nonnull Chunk chunk = event.getChunk(); for (final Entity entity : chunk.getEntities()) { testCreate(entity); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java index 059dc2486..7dfe8fbcb 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -59,7 +59,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.projectiles.ProjectileSource; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -76,7 +76,7 @@ public class PaperListener implements Listener { private final PlotAreaManager plotAreaManager; private Chunk lastChunk; - @Inject public PaperListener(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public PaperListener(@Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java index 78a7bc67d..ea7f6dcd5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java @@ -215,7 +215,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.projectiles.BlockProjectileSource; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.util.ArrayList; @@ -247,11 +247,11 @@ import java.util.regex.Pattern; private PlayerMoveEvent moveTmp; private String internalVersion; - @Inject public PlayerEvents(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final EventDispatcher eventDispatcher, - @NotNull final WorldEdit worldEdit, - @NotNull final WorldUtil worldUtil) { - super(eventDispatcher, worldUtil); + @Inject public PlayerEvents(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @Nonnull final WorldEdit worldEdit, + @Nonnull final WorldUtil worldUtil) { + super(eventDispatcher); this.plotAreaManager = plotAreaManager; this.eventDispatcher = eventDispatcher; this.worldEdit = worldEdit; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java index 870c6113e..dbd0e9dba 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/WorldEvents.java @@ -37,14 +37,14 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.world.WorldInitEvent; import org.bukkit.generator.ChunkGenerator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @SuppressWarnings("unused") public class WorldEvents implements Listener { private final PlotAreaManager plotAreaManager; - @Inject public WorldEvents(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public WorldEvents(@Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java index 5c0a8934d..8a8dd891e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java @@ -32,8 +32,8 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.WorldType; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.io.IOException; @@ -51,7 +51,7 @@ import java.util.List; } @Override @Nullable - public World handleWorldCreation(@NotNull String worldName, @Nullable String generator) { + public World handleWorldCreation(@Nonnull String worldName, @Nullable String generator) { this.setGenerator(worldName, generator); final WorldCreator wc = new WorldCreator(worldName); wc.environment(World.Environment.NORMAL); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/HyperverseWorldManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/HyperverseWorldManager.java index 2fdfbd44a..9c96d596c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/HyperverseWorldManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/HyperverseWorldManager.java @@ -27,8 +27,8 @@ package com.plotsquared.bukkit.managers; import com.google.inject.Singleton; import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import se.hyperver.hyperverse.Hyperverse; import se.hyperver.hyperverse.world.WorldConfiguration; import se.hyperver.hyperverse.world.WorldConfigurationBuilder; @@ -42,7 +42,7 @@ import se.hyperver.hyperverse.world.WorldType; @Singleton public class HyperverseWorldManager extends BukkitWorldManager { @Override @Nullable - public World handleWorldCreation(@NotNull String worldName, @Nullable String generator) { + public World handleWorldCreation(@Nonnull String worldName, @Nullable String generator) { // First let Bukkit register the world this.setGenerator(worldName, generator); // Create the world 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 40f1cb33e..105b8c9c0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/MultiverseWorldManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/MultiverseWorldManager.java @@ -28,8 +28,8 @@ package com.plotsquared.bukkit.managers; import com.google.inject.Singleton; import org.bukkit.Bukkit; import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * Multiverse specific manager that informs Multiverse of @@ -38,7 +38,7 @@ import org.jetbrains.annotations.Nullable; @Singleton public class MultiverseWorldManager extends BukkitWorldManager { @Override @Nullable - public World handleWorldCreation(@NotNull final String worldName, @Nullable final String generator) { + public World handleWorldCreation(@Nonnull final String worldName, @Nullable final String generator) { // First let Bukkit register the world this.setGenerator(worldName, generator); // Then we send the console command 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 8f46d3636..3aa5d12c3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitOfflinePlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitOfflinePlayer.java @@ -27,7 +27,7 @@ package com.plotsquared.bukkit.player; import com.plotsquared.core.player.OfflinePlotPlayer; import org.bukkit.OfflinePlayer; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.UUID; @@ -45,7 +45,7 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer { this.player = player; } - @NotNull @Override public UUID getUUID() { + @Nonnull @Override public UUID getUUID() { return this.player.getUniqueId(); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index 09e332e29..8ee58b2f5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -53,8 +53,8 @@ import org.bukkit.event.EventException; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.RegisteredListener; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Arrays; import java.util.Set; @@ -82,18 +82,18 @@ public class BukkitPlayer extends PlotPlayer { * * @param player Bukkit player instance */ - public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher, - @NotNull final Player player, @Nullable final EconHandler econHandler) { + public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, + @Nonnull final Player player, @Nullable final EconHandler econHandler) { this(plotAreaManager, eventDispatcher, player, false, econHandler); } - public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher, - @NotNull final Player player, final boolean offline, @Nullable final EconHandler econHandler) { + public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, + @Nonnull final Player player, final boolean offline, @Nullable final EconHandler econHandler) { this(plotAreaManager, eventDispatcher, player, offline, true, econHandler); } - public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final - EventDispatcher eventDispatcher, @NotNull final Player player, final boolean offline, + public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final + EventDispatcher eventDispatcher, @Nonnull final Player player, final boolean offline, final boolean realPlayer, @Nullable final EconHandler econHandler) { super(plotAreaManager, eventDispatcher, econHandler); this.player = player; @@ -112,12 +112,12 @@ public class BukkitPlayer extends PlotPlayer { return this.player; } - @NotNull @Override public Location getLocation() { + @Nonnull @Override public Location getLocation() { final Location location = super.getLocation(); return location == null ? BukkitUtil.getLocation(this.player) : location; } - @NotNull @Override public UUID getUUID() { + @Nonnull @Override public UUID getUUID() { if (Settings.UUID.OFFLINE) { if (Settings.UUID.FORCE_LOWERCASE) { return UUID.nameUUIDFromBytes(("OfflinePlayer:" + @@ -134,7 +134,7 @@ public class BukkitPlayer extends PlotPlayer { return this.player.getLastPlayed(); } - @Override public boolean canTeleport(@NotNull final Location location) { + @Override public boolean canTeleport(@Nonnull final Location location) { final org.bukkit.Location to = BukkitUtil.getLocation(location); final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); @@ -152,7 +152,7 @@ public class BukkitPlayer extends PlotPlayer { player.sendTitle(title, subtitle, fadeIn, stay, fadeOut); } - private void callEvent(@NotNull final Event event) { + private void callEvent(@Nonnull final Event event) { final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (final RegisteredListener listener : listeners) { if (listener.getPlugin().getName().equals(PlotSquared.platform().getPluginName())) { @@ -248,7 +248,7 @@ public class BukkitPlayer extends PlotPlayer { } @Override - public void teleport(@NotNull final Location location, @NotNull final TeleportCause cause) { + public void teleport(@Nonnull final Location location, @Nonnull final TeleportCause cause) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { return; } @@ -279,7 +279,7 @@ public class BukkitPlayer extends PlotPlayer { return BukkitUtil.getLocationFull(this.player); } - @Override public void setWeather(@NotNull final PlotWeather weather) { + @Override public void setWeather(@Nonnull final PlotWeather weather) { switch (weather) { case CLEAR: this.player.setPlayerWeather(WeatherType.CLEAR); @@ -294,7 +294,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @NotNull @Override public com.sk89q.worldedit.world.gamemode.GameMode getGameMode() { + @Override public com.sk89q.worldedit.world.gamemode.GameMode getGameMode() { switch (this.player.getGameMode()) { case ADVENTURE: return ADVENTURE; @@ -309,7 +309,7 @@ public class BukkitPlayer extends PlotPlayer { } @Override - public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) { + public void setGameMode(final com.sk89q.worldedit.world.gamemode.GameMode gameMode) { if (ADVENTURE.equals(gameMode)) { this.player.setGameMode(GameMode.ADVENTURE); } else if (CREATIVE.equals(gameMode)) { @@ -337,7 +337,7 @@ public class BukkitPlayer extends PlotPlayer { this.player.setAllowFlight(fly); } - @Override public void playMusic(@NotNull final Location location, @NotNull final ItemType id) { + @Override public void playMusic(@Nonnull final Location location, @Nonnull final ItemType id) { if (id == ItemTypes.AIR) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()) @@ -367,7 +367,7 @@ public class BukkitPlayer extends PlotPlayer { } - public PlayerTeleportEvent.TeleportCause getTeleportCause(@NotNull final TeleportCause cause) { + public PlayerTeleportEvent.TeleportCause getTeleportCause(@Nonnull final TeleportCause cause) { switch (cause) { case COMMAND: return PlayerTeleportEvent.TeleportCause.COMMAND; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayerManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayerManager.java index edb651fbb..7238709e3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayerManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayerManager.java @@ -28,13 +28,14 @@ package com.plotsquared.bukkit.player; import com.google.inject.Inject; import com.google.inject.Singleton; import com.plotsquared.core.plot.world.PlotAreaManager; +import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.PlayerManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; import java.util.UUID; /** @@ -44,27 +45,31 @@ import java.util.UUID; private final PlotAreaManager plotAreaManager; private final EventDispatcher eventDispatcher; + private final EconHandler econHandler; - @Inject public BukkitPlayerManager(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final EventDispatcher eventDispatcher) { + @Inject public BukkitPlayerManager(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @Nullable final EconHandler econHandler) { this.plotAreaManager = plotAreaManager; this.eventDispatcher = eventDispatcher; + this.econHandler = econHandler; } - @NotNull @Override public BukkitPlayer getPlayer(@NotNull final Player object) { + @Nonnull @Override public BukkitPlayer getPlayer(@Nonnull final Player object) { try { return getPlayer(object.getUniqueId()); } catch (final NoSuchPlayerException exception) { - return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, object.isOnline(), false); + return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, + object.isOnline(), false, this.econHandler); } } - @Override @NotNull public BukkitPlayer createPlayer(@NotNull final UUID uuid) { + @Override @Nonnull public BukkitPlayer createPlayer(@Nonnull final UUID uuid) { final Player player = Bukkit.getPlayer(uuid); if (player == null || !player.isOnline()) { throw new NoSuchPlayerException(uuid); } - return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player); + return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player, this.econHandler); } @Nullable @Override public BukkitOfflinePlayer getOfflinePlayer(@Nullable final UUID uuid) { @@ -74,7 +79,7 @@ import java.util.UUID; return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(uuid)); } - @NotNull @Override public BukkitOfflinePlayer getOfflinePlayer(@NotNull final String username) { + @Nonnull @Override public BukkitOfflinePlayer getOfflinePlayer(@Nonnull final String username) { return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(username)); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java index c8d6d929f..7eaa4004b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java @@ -31,7 +31,6 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.queue.BasicLocalBlockQueue; import com.plotsquared.core.util.BlockUtil; import com.plotsquared.core.util.MainUtil; -import com.plotsquared.core.util.task.TaskManager; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; @@ -42,7 +41,6 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import io.papermc.lib.PaperLib; -import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Material; @@ -51,6 +49,7 @@ import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.Container; import org.bukkit.block.data.BlockData; +import javax.annotation.Nonnull; import java.util.concurrent.ExecutionException; import java.util.function.Consumer; @@ -201,12 +200,12 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { return chunk; } - private void setMaterial(@NonNull final BlockState plotBlock, @NonNull final Block block) { + private void setMaterial(@Nonnull final BlockState plotBlock, @Nonnull final Block block) { Material material = BukkitAdapter.adapt(plotBlock.getBlockType()); block.setType(material, false); } - private boolean equals(@NonNull final BlockState plotBlock, @NonNull final Block block) { + private boolean equals(@Nonnull final BlockState plotBlock, @Nonnull final Block block) { return plotBlock.equals(BukkitBlockUtil.get(block)); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java index cfd21bf4c..3a18ec355 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java @@ -46,7 +46,7 @@ import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.ChunkGenerator.BiomeGrid; import org.bukkit.generator.ChunkGenerator.ChunkData; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; @@ -135,7 +135,7 @@ public class GenChunk extends ScopedLocalBlockQueue { return false; } - @Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) { + @Override public boolean setBlock(int x, int y, int z, @Nonnull Pattern pattern) { return setBlock(x, y, z, PatternUtil .apply(Preconditions.checkNotNull(pattern, "Pattern may not be null"), x, y, z)); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java index 8860dddab..e2e22ed3c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/BukkitSchematicHandler.java @@ -31,14 +31,14 @@ import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.WorldUtil; import com.sk89q.jnbt.CompoundTag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * Schematic Handler. */ @Singleton public class BukkitSchematicHandler extends SchematicHandler { - @Inject public BukkitSchematicHandler(@NotNull final WorldUtil worldUtil) { + @Inject public BukkitSchematicHandler(@Nonnull final WorldUtil worldUtil) { super(worldUtil); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java index dac4377b4..325d47544 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java @@ -28,7 +28,6 @@ package com.plotsquared.bukkit.util; import com.google.inject.Singleton; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.listener.WEExtent; -import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.entity.EntityCategories; @@ -80,8 +79,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; BukkitWorld bukkitWorld1 = new BukkitWorld(world1); BukkitWorld bukkitWorld2 = new BukkitWorld(world2); - LocalBlockQueue queue1 = GlobalBlockQueue.IMP.getNewQueue(worldName1, false); - LocalBlockQueue queue2 = GlobalBlockQueue.IMP.getNewQueue(worldName2, false); + LocalBlockQueue queue1 = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(worldName1, false); + LocalBlockQueue queue2 = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(worldName2, false); for (int x = Math.max(r1.getMinimumPoint().getX(), sx); x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java index 3de48ae99..c7356c13b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java @@ -36,7 +36,7 @@ import com.plotsquared.core.util.PermHandler; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; import org.bukkit.plugin.RegisteredServiceProvider; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; @Singleton public class BukkitEconHandler extends EconHandler { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java index 0b405b904..da4b2a896 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java @@ -35,7 +35,6 @@ import com.plotsquared.core.location.PlotLoc; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.plotsquared.core.util.ChunkManager; @@ -58,7 +57,7 @@ import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayDeque; import java.util.ArrayList; @@ -79,7 +78,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; @Singleton public class BukkitRegionManager extends RegionManager { - @Inject public BukkitRegionManager(@NotNull ChunkManager chunkManager) { + @Inject public BukkitRegionManager(@Nonnull final ChunkManager chunkManager) { super(chunkManager); } @@ -212,7 +211,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; assert oldWorld != null; final String newWorldName = newWorld.getName(); final ContentMap map = new ContentMap(); - final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(newWorldName, false); + final LocalBlockQueue queue = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(newWorldName, false); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { int bx = value[2]; @@ -243,7 +242,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; } } queue.enqueue(); - GlobalBlockQueue.IMP.addEmptyTask(() -> { + PlotSquared.platform().getGlobalBlockQueue().addEmptyTask(() -> { //map.restoreBlocks(newWorld, 0, 0); map.restoreEntities(newWorld, relX, relZ); TaskManager.runTask(whenDone); @@ -291,8 +290,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; if (chunkObj == null) { return; } - final LocalBlockQueue queue = - GlobalBlockQueue.IMP.getNewQueue(world, false); + final LocalBlockQueue queue = PlotSquared.platform().getGlobalBlockQueue() + .getNewQueue(world, false); if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) { AugmentedUtils.bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.getX(), chunk.getZ())); @@ -452,7 +451,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; BukkitChunkManager.swapChunk(world1, world2, chunk1, chunk2, region1, region2)); } } - GlobalBlockQueue.IMP.addEmptyTask(() -> { + PlotSquared.platform().getGlobalBlockQueue().addEmptyTask(() -> { for (ContentMap map : maps) { map.restoreEntities(world1, 0, 0); TaskManager.runTaskLater(whenDone, 1); @@ -467,12 +466,13 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; region.getMinimumPoint().getY(), region.getMinimumPoint().getZ() - extendBiome); Location pos2 = Location.at(world, region.getMaximumPoint().getX() + extendBiome, region.getMaximumPoint().getY(), region.getMaximumPoint().getZ() + extendBiome); - final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); + final LocalBlockQueue queue = PlotSquared.platform().getGlobalBlockQueue() + .getNewQueue(world, false); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run(int[] value) { BlockVector2 loc = BlockVector2.at(value[0], value[1]); - ChunkManager.manager.loadChunk(world, loc, false).thenRun(() -> { + PlotSquared.platform().getChunkManager().loadChunk(world, loc, false).thenRun(() -> { MainUtil.setBiome(world, value[2], value[3], value[4], value[5], biome); queue.refreshChunk(value[0], value[1]); }); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java index 80df11232..e4cc3d071 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -48,7 +48,7 @@ import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.io.IOException; @@ -62,9 +62,9 @@ import java.util.Objects; private final YamlConfiguration worldConfiguration; private final File worldFile; - @Inject public BukkitSetupUtils(@NotNull final PlotAreaManager plotAreaManager, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @WorldFile @NotNull final File worldFile) { + @Inject public BukkitSetupUtils(@Nonnull final PlotAreaManager plotAreaManager, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @WorldFile @Nonnull final File worldFile) { this.plotAreaManager = plotAreaManager; this.worldConfiguration = worldConfiguration; this.worldFile = worldFile; 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 d3659b481..f5ae64d33 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -54,7 +54,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import io.papermc.lib.PaperLib; -import lombok.NonNull; + import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Material; @@ -96,8 +96,8 @@ import org.bukkit.entity.Snowman; import org.bukkit.entity.Tameable; import org.bukkit.entity.Vehicle; import org.bukkit.entity.WaterMob; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -119,7 +119,7 @@ import java.util.stream.Stream; private static Player lastPlayer = null; private static BukkitPlayer lastPlotPlayer = null; - @Inject public BukkitUtil(@NotNull final RegionManager regionManager) { + @Inject public BukkitUtil(@Nonnull final RegionManager regionManager) { super(regionManager); } @@ -130,7 +130,7 @@ import java.util.stream.Stream; PlotSquared.platform().getPlayerManager().removePlayer(uuid); } - public static PlotPlayer getPlayer(@NonNull final OfflinePlayer op) { + public static PlotPlayer getPlayer(@Nonnull final OfflinePlayer op) { if (op.isOnline()) { return getPlayer(op.getPlayer()); } @@ -275,7 +275,7 @@ import java.util.stream.Stream; MainUtil.sendMessage(BukkitUtil.getPlayer(player), caption); } - public static BukkitPlayer getPlayer(@NonNull final Player player) { + public static BukkitPlayer getPlayer(@Nonnull final Player player) { if (player == lastPlayer) { return lastPlotPlayer; } @@ -283,31 +283,31 @@ import java.util.stream.Stream; return ((BukkitPlayerManager) playerManager).getPlayer(player); } - public static Location getLocation(@NonNull final org.bukkit.Location location) { + public static Location getLocation(final org.bukkit.Location location) { return Location.at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ())); } - public static Location getLocationFull(@NonNull final org.bukkit.Location location) { + public static Location getLocationFull(final org.bukkit.Location location) { return Location.at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(), location.getPitch()); } - public static org.bukkit.Location getLocation(@NonNull final Location location) { + public static org.bukkit.Location getLocation(@Nonnull final Location location) { return new org.bukkit.Location((World) location.getWorld().getPlatformWorld(), location.getX(), location.getY(), location.getZ()); } - public static World getWorld(@NonNull final String string) { + public static World getWorld(@Nonnull final String string) { return Bukkit.getWorld(string); } - public static String getWorld(@NonNull final Entity entity) { + public static String getWorld(@Nonnull final Entity entity) { return entity.getWorld().getName(); } - public static List getEntities(@NonNull final String worldName) { + public static List getEntities(@Nonnull final String worldName) { World world = getWorld(worldName); if (world != null) { return world.getEntities(); @@ -316,21 +316,21 @@ import java.util.stream.Stream; } } - public static Location getLocation(@NonNull final Entity entity) { + public static Location getLocation(@Nonnull final Entity entity) { final org.bukkit.Location location = entity.getLocation(); String world = location.getWorld().getName(); return Location.at(world, location.getBlockX(), location.getBlockY(), location.getBlockZ()); } - @NotNull public static Location getLocationFull(@NonNull final Entity entity) { + @Nonnull public static Location getLocationFull(@Nonnull final Entity entity) { final org.bukkit.Location location = entity.getLocation(); return Location.at(location.getWorld().getName(), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(), location.getPitch()); } - public static Material getMaterial(@NonNull final BlockState plotBlock) { + public static Material getMaterial(@Nonnull final BlockState plotBlock) { return BukkitAdapter.adapt(plotBlock.getBlockType()); } @@ -342,7 +342,7 @@ import java.util.stream.Stream; return mat1 == mat2; } - @Override public boolean isWorld(@NonNull final String worldName) { + @Override public boolean isWorld(@Nonnull final String worldName) { return getWorld(worldName) != null; } @@ -356,7 +356,7 @@ import java.util.stream.Stream; } @Override - public void getHighestBlock(@NonNull final String world, final int x, final int z, + public void getHighestBlock(@Nonnull final String world, final int x, final int z, final IntConsumer result) { ensureLoaded(world, x, z, chunk -> { final World bukkitWorld = getWorld(world); @@ -406,7 +406,7 @@ import java.util.stream.Stream; } @Override - public void getSign(@NonNull final Location location, final Consumer result) { + public void getSign(@Nonnull final Location location, final Consumer result) { ensureLoaded(location, chunk -> { final Block block = chunk.getWorld().getBlockAt(getLocation(location)); if (block.getState() instanceof Sign) { @@ -416,7 +416,7 @@ import java.util.stream.Stream; }); } - @Override @Nullable public String[] getSignSynchronous(@NonNull final Location location) { + @Override @Nullable public String[] getSignSynchronous(@Nonnull final Location location) { Block block = getWorld(location.getWorldName()) .getBlockAt(location.getX(), location.getY(), location.getZ()); return TaskManager.getImplementation().sync(new RunnableVal() { @@ -429,20 +429,20 @@ import java.util.stream.Stream; }); } - @Override public Location getSpawn(@NonNull final String world) { + @Override public Location getSpawn(@Nonnull final String world) { final org.bukkit.Location temp = getWorld(world).getSpawnLocation(); return Location.at(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ(), temp.getYaw(), temp.getPitch()); } - @Override public void setSpawn(@NonNull final Location location) { + @Override public void setSpawn(@Nonnull final Location location) { final World world = getWorld(location.getWorldName()); if (world != null) { world.setSpawnLocation(location.getX(), location.getY(), location.getZ()); } } - @Override public void saveWorld(@NonNull final String worldName) { + @Override public void saveWorld(@Nonnull final String worldName) { final World world = getWorld(worldName); if (world != null) { world.save(); @@ -450,8 +450,8 @@ import java.util.stream.Stream; } @Override @SuppressWarnings("deprecation") - public void setSign(@NonNull final String worldName, final int x, final int y, final int z, - @NonNull final String[] lines) { + public void setSign(@Nonnull final String worldName, final int x, final int y, final int z, + @Nonnull final String[] lines) { ensureLoaded(worldName, x, z, chunk -> { final World world = getWorld(worldName); final Block block = world.getBlockAt(x, y, z); @@ -490,11 +490,11 @@ import java.util.stream.Stream; }); } - @Override public boolean isBlockSolid(@NonNull final BlockState block) { + @Override public boolean isBlockSolid(@Nonnull final BlockState block) { return block.getBlockType().getMaterial().isSolid(); } - @Override public String getClosestMatchingName(@NonNull final BlockState block) { + @Override public String getClosestMatchingName(@Nonnull final BlockState block) { try { return getMaterial(block).name(); } catch (Exception ignored) { @@ -509,8 +509,8 @@ import java.util.stream.Stream; } @Override - public void setBiomes(@NonNull final String worldName, @NonNull final CuboidRegion region, - @NonNull final BiomeType biomeType) { + public void setBiomes(@Nonnull final String worldName, @Nonnull final CuboidRegion region, + @Nonnull final BiomeType biomeType) { final World world = getWorld(worldName); if (world == null) { PlotSquared.log("An error occurred setting the biome because the world was null."); @@ -532,7 +532,7 @@ import java.util.stream.Stream; } @Override - public void getBlock(@NonNull final Location location, final Consumer result) { + public void getBlock(@Nonnull final Location location, final Consumer result) { ensureLoaded(location, chunk -> { final World world = getWorld(location.getWorldName()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); @@ -540,7 +540,7 @@ import java.util.stream.Stream; }); } - @Override public BlockState getBlockSynchronous(@NonNull final Location location) { + @Override public BlockState getBlockSynchronous(@Nonnull final Location location) { final World world = getWorld(location.getWorldName()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); return BukkitAdapter.asBlockType(block.getType()).getDefaultState(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java index 4bf9a1eac..70e664c64 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java @@ -30,7 +30,7 @@ import com.plotsquared.core.location.World; import lombok.EqualsAndHashCode; import lombok.ToString; import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Map; @@ -40,7 +40,7 @@ import java.util.Map; private final org.bukkit.World world; - private BukkitWorld(@NotNull final org.bukkit.World world) { + private BukkitWorld(final org.bukkit.World world) { this.world = world; } @@ -50,7 +50,7 @@ import java.util.Map; * @param worldName World name * @return World instance */ - @NotNull public static BukkitWorld of(@NotNull final String worldName) { + @Nonnull public static BukkitWorld of(@Nonnull final String worldName) { final org.bukkit.World bukkitWorld = Bukkit.getWorld(worldName); if (bukkitWorld == null) { throw new IllegalArgumentException(String.format("There is no world with the name '%s'", worldName)); @@ -64,7 +64,7 @@ import java.util.Map; * @param world Bukkit world * @return World instance */ - @NotNull public static BukkitWorld of(@NotNull final org.bukkit.World world) { + @Nonnull public static BukkitWorld of(final org.bukkit.World world) { BukkitWorld bukkitWorld = worldMap.get(world.getName()); if (bukkitWorld != null && bukkitWorld.getPlatformWorld().equals(world)) { return bukkitWorld; @@ -74,11 +74,11 @@ import java.util.Map; return bukkitWorld; } - @NotNull @Override public org.bukkit.World getPlatformWorld() { + @Override public org.bukkit.World getPlatformWorld() { return this.world; } - @Override @NotNull public String getName() { + @Override @Nonnull public String getName() { return this.world.getName(); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java index f7c588bf4..1f6b7e5cb 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java @@ -38,7 +38,7 @@ import java.util.ArrayList; public class SetGenCB { public static void setGenerator(World world) throws Exception { - SetupUtils.manager.updateGenerators(); + PlotSquared.platform().getSetupUtils().updateGenerators(); PlotSquared.get().removePlotAreas(world.getName()); ChunkGenerator gen = world.getGenerator(); if (gen == null) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/BungeePermsUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/BungeePermsUUIDService.java index 4de1bdb92..5163b4045 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/BungeePermsUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/BungeePermsUUIDService.java @@ -30,7 +30,7 @@ import com.plotsquared.core.uuid.UUIDService; import net.luckperms.api.model.user.UserManager; import org.bukkit.Bukkit; import org.bukkit.plugin.RegisteredServiceProvider; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -54,7 +54,7 @@ public class BungeePermsUUIDService implements UUIDService { } } - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { final List mappings = new ArrayList<>(uuids.size()); final UUIDPlayerDB uuiddb = BungeePerms.getInstance().getPermissionsManager().getUUIDPlayerDB(); for (final UUID uuid : uuids) { @@ -68,7 +68,7 @@ public class BungeePermsUUIDService implements UUIDService { return mappings; } - @Override @NotNull public List getUUIDs(@NotNull final List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull final List usernames) { final List mappings = new ArrayList<>(usernames.size()); final UUIDPlayerDB uuiddb = BungeePerms.getInstance().getPermissionsManager().getUUIDPlayerDB(); for (final String username : usernames) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java index eb473d67e..a2472bd69 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/EssentialsUUIDService.java @@ -29,7 +29,7 @@ import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDService; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; @@ -47,11 +47,11 @@ public class EssentialsUUIDService implements UUIDService { this.essentials = Essentials.getPlugin(Essentials.class); } - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { return Collections.emptyList(); } - @Override @NotNull public List getUUIDs(@NotNull final List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull final List usernames) { final List mappings = new ArrayList<>(usernames.size()); for (final String username : usernames) { try { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java index 47bcc9bb3..d2bcae5a5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/LuckPermsUUIDService.java @@ -31,7 +31,7 @@ import net.luckperms.api.LuckPerms; import net.luckperms.api.model.user.UserManager; import org.bukkit.Bukkit; import org.bukkit.plugin.RegisteredServiceProvider; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -53,7 +53,7 @@ public class LuckPermsUUIDService implements UUIDService { } } - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { final List mappings = new ArrayList<>(uuids.size()); final UserManager userManager = this.luckPerms.getUserManager(); for (final UUID uuid : uuids) { @@ -67,7 +67,7 @@ public class LuckPermsUUIDService implements UUIDService { return mappings; } - @Override @NotNull public List getUUIDs(@NotNull final List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull final List usernames) { final List mappings = new ArrayList<>(usernames.size()); final UserManager userManager = this.luckPerms.getUserManager(); for (final String username : usernames) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java index 7b904e627..7193f9033 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java @@ -31,7 +31,7 @@ import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDService; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; @@ -43,7 +43,7 @@ import java.util.UUID; */ public class OfflinePlayerUUIDService implements UUIDService { - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { if (Settings.UUID.FORCE_LOWERCASE || Bukkit.getWorlds().isEmpty()) { return Collections.emptyList(); // This is useless now } @@ -61,7 +61,7 @@ public class OfflinePlayerUUIDService implements UUIDService { return wrappers; } - @Override @NotNull public List getUUIDs(@NotNull final List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull final List usernames) { final List wrappers = new ArrayList<>(usernames.size()); for (final String username : usernames) { if (Settings.UUID.OFFLINE) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/PaperUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/PaperUUIDService.java index 4f370c8b3..19ce31c45 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/PaperUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/PaperUUIDService.java @@ -29,7 +29,7 @@ import com.destroystokyo.paper.profile.PlayerProfile; import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDService; import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -40,7 +40,7 @@ import java.util.UUID; */ public class PaperUUIDService implements UUIDService { - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { final List mappings = new ArrayList<>(uuids.size()); for (final UUID uuid : uuids) { final PlayerProfile playerProfile = Bukkit.createProfile(uuid); @@ -51,7 +51,7 @@ public class PaperUUIDService implements UUIDService { return mappings; } - @Override @NotNull public List getUUIDs(@NotNull final List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull final List usernames) { final List mappings = new ArrayList<>(usernames.size()); for (final String username : usernames) { final PlayerProfile playerProfile = Bukkit.createProfile(username); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java index 730d6c010..b2f2a8707 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java @@ -30,7 +30,7 @@ import com.plotsquared.core.database.SQLite; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDService; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.sql.Connection; import java.sql.PreparedStatement; @@ -72,7 +72,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { final List mappings = new ArrayList<>(uuids.size()); try (final PreparedStatement statement = getConnection() .prepareStatement("SELECT `username` FROM `usercache` WHERE `uuid` = ?")) { @@ -90,7 +90,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer getUUIDs(@NotNull List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull List usernames) { final List mappings = new ArrayList<>(usernames.size()); try (final PreparedStatement statement = getConnection() .prepareStatement("SELECT `uuid` FROM `usercache` WHERE `username` = ?")) { @@ -127,7 +127,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer getAll() { + @Nonnull public List getAll() { final List mappings = new LinkedList<>(); try (final PreparedStatement statement = getConnection().prepareStatement("SELECT * FROM `usercache`")) { try (final ResultSet resultSet = statement.executeQuery()) { 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 8c8dfca83..42cc8df59 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java @@ -33,7 +33,7 @@ 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.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.IOException; import java.util.ArrayList; @@ -64,7 +64,7 @@ public class SquirrelIdUUIDService implements UUIDService { this.rateLimiter = RateLimiter.create(rateLimit / 600.0D); } - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { final List results = new ArrayList<>(uuids.size()); this.rateLimiter.acquire(uuids.size()); try { @@ -96,7 +96,7 @@ public class SquirrelIdUUIDService implements UUIDService { return results; } - @Override @NotNull public List getUUIDs(@NotNull final List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull final List usernames) { final List results = new ArrayList<>(usernames.size()); this.rateLimiter.acquire(usernames.size()); try { diff --git a/Core/build.gradle b/Core/build.gradle index ed7c50b06..529db92d4 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -16,10 +16,10 @@ dependencies { annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72") - implementation("org.jetbrains:annotations:19.0.0") implementation("org.khelekore:prtree:1.7.0-SNAPSHOT") compile("com.google.inject:guice:4.2.3") compile("com.google.inject.extensions:guice-assistedinject:4.2.3") + compile group: 'com.google.code.findbugs', name: 'annotations', version: '3.0.1' } sourceCompatibility = 1.8 diff --git a/Core/pom.xml b/Core/pom.xml index fab088df7..c04467362 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -12,18 +12,36 @@ 20200518 compile + + javax.annotation + javax.annotation-api + 1.3.2 + compile + + + com.google.inject + guice + 4.2.3 + compile + + + com.google.inject.extensions + guice-assistedinject + 4.2.3 + compile + + + com.google.code.findbugs + annotations + 3.0.1 + compile + org.projectlombok lombok 1.18.12 runtime - - org.jetbrains - annotations - 19.0.0 - runtime - com.sk89q.worldedit worldedit-core @@ -98,18 +116,6 @@ 1.7.0-SNAPSHOT runtime - - com.google.inject - guice - 4.2.3 - runtime - - - com.google.inject.extensions - guice-assistedinject - 4.2.3 - runtime - junit junit diff --git a/Core/src/main/java/com/plotsquared/core/PlotPlatform.java b/Core/src/main/java/com/plotsquared/core/PlotPlatform.java index 3eb5983c4..9a8ff4211 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotPlatform.java +++ b/Core/src/main/java/com/plotsquared/core/PlotPlatform.java @@ -36,14 +36,16 @@ import com.plotsquared.core.location.World; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.ChatManager; +import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.PlatformWorldManager; import com.plotsquared.core.util.PlayerManager; +import com.plotsquared.core.util.RegionManager; import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.logger.ILogger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.util.List; @@ -153,7 +155,7 @@ public interface PlotPlatform

extends ILogger { * * @return Default implementation generator */ - @NotNull default IndependentPlotGenerator getDefaultGenerator() { + @Nonnull default IndependentPlotGenerator getDefaultGenerator() { return getInjector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)); } @@ -164,7 +166,7 @@ public interface PlotPlatform

extends ILogger { * * @return Backup manager */ - @NotNull default BackupManager getBackupManager() { + @Nonnull default BackupManager getBackupManager() { return getInjector().getInstance(BackupManager.class); } @@ -173,7 +175,7 @@ public interface PlotPlatform

extends ILogger { * * @return World manager */ - @NotNull default PlatformWorldManager getWorldManager() { + @Nonnull default PlatformWorldManager getWorldManager() { return getInjector().getInstance(PlatformWorldManager.class); } @@ -182,7 +184,7 @@ public interface PlotPlatform

extends ILogger { * * @return Player manager */ - @NotNull default PlayerManager, ? extends P> getPlayerManager() { + @Nonnull default PlayerManager, ? extends P> getPlayerManager() { return getInjector().getInstance(PlayerManager.class); } @@ -192,21 +194,21 @@ public interface PlotPlatform

extends ILogger { * @param worldName World name * @return Platform world wrapper */ - @NotNull World getPlatformWorld(@NotNull final String worldName); + @Nonnull World getPlatformWorld(@Nonnull final String worldName); /** * Get the {@link com.google.inject.Injector} instance used by PlotSquared * * @return Injector instance */ - @NotNull Injector getInjector(); + @Nonnull Injector getInjector(); /** * Get the world utility implementation * * @return World utility */ - @NotNull default WorldUtil getWorldUtil() { + @Nonnull default WorldUtil getWorldUtil() { return getInjector().getInstance(WorldUtil.class); } @@ -215,7 +217,7 @@ public interface PlotPlatform

extends ILogger { * * @return Global block queue implementation */ - @NotNull default GlobalBlockQueue getGlobalBlockQueue() { + @Nonnull default GlobalBlockQueue getGlobalBlockQueue() { return getInjector().getInstance(GlobalBlockQueue.class); } @@ -224,7 +226,7 @@ public interface PlotPlatform

extends ILogger { * * @return Hybrid utils */ - @NotNull default HybridUtils getHybridUtils() { + @Nonnull default HybridUtils getHybridUtils() { return getInjector().getInstance(HybridUtils.class); } @@ -233,17 +235,35 @@ public interface PlotPlatform

extends ILogger { * * @return Setup utils */ - @NotNull default SetupUtils getSetupUtils() { + @Nonnull default SetupUtils getSetupUtils() { return getInjector().getInstance(SetupUtils.class); } /** * Get the {@link EconHandler} implementation for the platform - * + * * * @return Econ handler */ - @NotNull default EconHandler getEconHandler() { + @Nullable default EconHandler getEconHandler() { return getInjector().getInstance(EconHandler.class); } + /** + * Get the {@link RegionManager} implementation for the platform + * + * @return Region manager + */ + @Nonnull default RegionManager getRegionManager() { + return getInjector().getInstance(RegionManager.class); + } + + /** + * Get the {@link ChunkManager} implementation for the platform + * + * @return Region manager + */ + @Nonnull default ChunkManager getChunkManager() { + return getInjector().getInstance(ChunkManager.class); + } + } diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 2c9bbdeec..ca899a8ca 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -26,7 +26,6 @@ package com.plotsquared.core; import com.plotsquared.core.configuration.Caption; -import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationUtil; @@ -47,7 +46,6 @@ import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.inject.factory.HybridPlotWorldFactory; import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.location.Location; -import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.plot.BlockBucket; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; @@ -56,13 +54,11 @@ import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotManager; -import com.plotsquared.core.plot.comment.CommentManager; import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.plot.expiration.ExpiryTask; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotAreaManager; -import com.plotsquared.core.util.ChatManager; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.LegacyConverter; import com.plotsquared.core.util.MainUtil; @@ -77,9 +73,9 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.BlockVector2; import lombok.Getter; import lombok.Setter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -150,7 +146,6 @@ public class PlotSquared { // Files and configuration @Getter private File jarFile = null; // This file private File storageFile; - @Getter private PlotAreaManager plotAreaManager; @Getter private EventDispatcher eventDispatcher; @Getter private PlotListener plotListener; @@ -195,6 +190,7 @@ public class PlotSquared { if (!setupConfigs()) { return; } + this.translationFile = MainUtil.getFile(this.platform.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + this.platform.getPluginName() + ".use_THIS.yml"); @@ -207,29 +203,6 @@ public class PlotSquared { // Create plot listener this.plotListener = new PlotListener(this.eventDispatcher); - // Database - if (Settings.Enabled_Components.DATABASE) { - setupDatabase(); - } - - // Check if we need to convert old flag values, etc - if (!getConfigurationVersion().equalsIgnoreCase("v5")) { - // Perform upgrade - if (DBFunc.dbManager.convertFlags()) { - log(Captions.PREFIX.getTranslated() + "Flags were converted successfully!"); - // Update the config version - setConfigurationVersion("v5"); - } - } - - // Comments - CommentManager.registerDefaultInboxes(); - - startExpiryTasks(); - - // This is getting removed so I won't even bother migrating it - ChatManager.manager = this.platform.initChatManager(); - // Copy files copyFile("addplots.js", Settings.Paths.SCRIPTS); copyFile("addsigns.js", Settings.Paths.SCRIPTS); @@ -253,10 +226,15 @@ public class PlotSquared { } catch (Throwable e) { e.printStackTrace(); } + } - PlotSquared.log(Captions.PREFIX + CaptionUtility - .format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(), - this.platform.getPluginName())); + /** + * Get the platform specific {@link PlotAreaManager} instance + * + * @return Plot area manager + */ + @Nonnull public PlotAreaManager getPlotAreaManager() { + return this.platform.getInjector().getInstance(PlotAreaManager.class); } /** @@ -273,7 +251,7 @@ public class PlotSquared { * * @return Platform implementation */ - @NotNull public static PlotPlatform platform() { + @Nonnull public static PlotPlatform platform() { if (instance != null && instance.platform != null) { return instance.platform; } @@ -315,12 +293,12 @@ public class PlotSquared { } } - private void startExpiryTasks() { + public void startExpiryTasks() { if (Settings.Enabled_Components.PLOT_EXPIRY) { ExpireManager.IMP = new ExpireManager(this.eventDispatcher); ExpireManager.IMP.runAutomatedTask(); for (Settings.Auto_Clear settings : Settings.AUTO_CLEAR.getInstances()) { - ExpiryTask task = new ExpiryTask(settings, this.plotAreaManager); + ExpiryTask task = new ExpiryTask(settings, this.getPlotAreaManager()); ExpireManager.IMP.addTask(task); } } @@ -412,7 +390,7 @@ public class PlotSquared { cluster.setArea(plotArea); } } - plotAreaManager.addPlotArea(plotArea); + getPlotAreaManager().addPlotArea(plotArea); plotArea.setupBorder(); if (!Settings.Enabled_Components.PERSISTENT_ROAD_REGEN) { return; @@ -459,11 +437,11 @@ public class PlotSquared { * @param area the {@code PlotArea} to remove */ public void removePlotArea(PlotArea area) { - plotAreaManager.removePlotArea(area); + getPlotAreaManager().removePlotArea(area); setPlotsTmp(area); } - public void removePlotAreas(@NotNull final String world) { + public void removePlotAreas(@Nonnull final String world) { for (final PlotArea area : this.getPlotAreaManager().getPlotAreasSet(world)) { if (area.getWorldName().equals(world)) { removePlotArea(area); @@ -486,7 +464,7 @@ public class PlotSquared { this.clustersTmp.put(area.toString(), area.getClusters()); } - public Set getClusters(@NotNull final String world) { + public Set getClusters(@Nonnull final String world) { final Set set = new HashSet<>(); for (final PlotArea area : this.getPlotAreaManager().getPlotAreasSet(world)) { set.addAll(area.getClusters()); @@ -695,13 +673,13 @@ public class PlotSquared { // group by world // sort each HashMap> map = new HashMap<>(); - int totalSize = Arrays.stream(this.plotAreaManager.getAllPlotAreas()).mapToInt(PlotArea::getPlotCount).sum(); + int totalSize = Arrays.stream(this.getPlotAreaManager().getAllPlotAreas()).mapToInt(PlotArea::getPlotCount).sum(); if (plots.size() == totalSize) { - for (PlotArea area : plotAreaManager.getAllPlotAreas()) { + for (PlotArea area : getPlotAreaManager().getAllPlotAreas()) { map.put(area, area.getPlots()); } } else { - for (PlotArea area : plotAreaManager.getAllPlotAreas()) { + for (PlotArea area : getPlotAreaManager().getAllPlotAreas()) { map.put(area, new ArrayList<>(0)); } Collection lastList = null; @@ -716,7 +694,7 @@ public class PlotSquared { } } } - List areas = Arrays.asList(plotAreaManager.getAllPlotAreas()); + List areas = Arrays.asList(getPlotAreaManager().getAllPlotAreas()); areas.sort((a, b) -> { if (priorityArea != null) { if (a.equals(priorityArea)) { @@ -749,7 +727,7 @@ public class PlotSquared { return toReturn; } - public void setPlots(@NotNull final Map> plots) { + public void setPlots(@Nonnull final Map> plots) { if (this.plots_tmp == null) { this.plots_tmp = new HashMap<>(); } @@ -816,7 +794,7 @@ public class PlotSquared { if (world.equals("CheckingPlotSquaredGenerator")) { return; } - this.plotAreaManager.addWorld(world); + this.getPlotAreaManager().addWorld(world); Set worlds; if (this.worldConfiguration.contains("worlds")) { worlds = this.worldConfiguration.getConfigurationSection("worlds").getKeys(false); @@ -832,7 +810,7 @@ public class PlotSquared { type = PlotAreaType.NORMAL; } if (type == PlotAreaType.NORMAL) { - if (plotAreaManager.getPlotAreas(world, null).length != 0) { + if (getPlotAreaManager().getPlotAreas(world, null).length != 0) { debug("World possibly already loaded: " + world); return; } @@ -866,7 +844,7 @@ public class PlotSquared { .log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator); PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName()); PlotSquared.log( - Captions.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName()); + Captions.PREFIX + "&3 - getPlotAreaManager(): &7" + plotManager.getClass().getName()); if (!this.worldConfiguration.contains(path)) { this.worldConfiguration.createSection(path); worldSection = this.worldConfiguration.getConfigurationSection(path); @@ -887,7 +865,7 @@ public class PlotSquared { } ConfigurationSection areasSection = worldSection.getConfigurationSection("areas"); if (areasSection == null) { - if (plotAreaManager.getPlotAreas(world, null).length != 0) { + if (getPlotAreaManager().getPlotAreas(world, null).length != 0) { debug("World possibly already loaded: " + world); return; } @@ -954,7 +932,7 @@ public class PlotSquared { PlotSquared .log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen); PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + pa); - PlotSquared.log(Captions.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager()); + PlotSquared.log(Captions.PREFIX + "&3 - getPlotAreaManager(): &7" + pa.getPlotManager()); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); addPlotArea(pa); @@ -1314,8 +1292,8 @@ public class PlotSquared { } DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, this.eventDispatcher, this.plotListener, this.worldConfiguration); this.plots_tmp = DBFunc.getPlots(); - if (plotAreaManager instanceof SinglePlotAreaManager) { - SinglePlotArea area = ((SinglePlotAreaManager) plotAreaManager).getArea(); + if (getPlotAreaManager() instanceof SinglePlotAreaManager) { + SinglePlotArea area = ((SinglePlotAreaManager) getPlotAreaManager()).getArea(); addPlotArea(area); ConfigurationSection section = worldConfiguration.getConfigurationSection("worlds.*"); if (section == null) { @@ -1556,7 +1534,7 @@ public class PlotSquared { } public void forEachPlotRaw(Consumer consumer) { - for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { + for (final PlotArea area : this.getPlotAreaManager().getAllPlotAreas()) { area.getPlots().forEach(consumer); } if (this.plots_tmp != null) { @@ -1573,10 +1551,10 @@ public class PlotSquared { * @param chunkCoordinates Chunk coordinates * @return True if the chunk uses non-standard generation, false if not */ - public boolean isNonStandardGeneration(@NotNull final String world, - @NotNull final BlockVector2 chunkCoordinates) { + public boolean isNonStandardGeneration(@Nonnull final String world, + @Nonnull final BlockVector2 chunkCoordinates) { final Location location = Location.at(world, chunkCoordinates.getBlockX() << 4, 64, chunkCoordinates.getBlockZ() << 4); - final PlotArea area = plotAreaManager.getApplicablePlotArea(location); + final PlotArea area = getPlotAreaManager().getApplicablePlotArea(location); if (area == null) { return true; } diff --git a/Core/src/main/java/com/plotsquared/core/backup/Backup.java b/Core/src/main/java/com/plotsquared/core/backup/Backup.java index a84fc497f..111edd8a7 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/Backup.java +++ b/Core/src/main/java/com/plotsquared/core/backup/Backup.java @@ -28,7 +28,7 @@ package com.plotsquared.core.backup; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import java.io.IOException; import java.nio.file.Files; diff --git a/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java index 1a2aa5e9b..5ae0dcdfe 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java @@ -28,8 +28,8 @@ package com.plotsquared.core.backup; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.nio.file.Path; import java.util.Objects; @@ -45,7 +45,7 @@ public interface BackupManager { * @param plot Plot to perform the automatic backup on * @param whenDone Action that runs when the automatic backup has been completed */ - static void backup(@Nullable PlotPlayer player, @NotNull final Plot plot, @NotNull Runnable whenDone) { + static void backup(@Nullable PlotPlayer player, @Nonnull final Plot plot, @Nonnull Runnable whenDone) { Objects.requireNonNull(PlotSquared.platform()).getBackupManager().automaticBackup(player, plot, whenDone); } @@ -56,7 +56,7 @@ public interface BackupManager { * @param plot Plot to get the backup profile for * @return Backup profile */ - @NotNull BackupProfile getProfile(@NotNull final Plot plot); + @Nonnull BackupProfile getProfile(@Nonnull final Plot plot); /** * This will perform an automatic backup of the plot iff the plot has an owner, @@ -67,14 +67,14 @@ public interface BackupManager { * @param plot Plot to perform the automatic backup on * @param whenDone Action that runs when the automatic backup has been completed */ - void automaticBackup(@Nullable PlotPlayer player, @NotNull final Plot plot, @NotNull Runnable whenDone); + void automaticBackup(@Nullable PlotPlayer player, @Nonnull final Plot plot, @Nonnull Runnable whenDone); /** * Get the directory in which backups are stored * * @return Backup directory path */ - @NotNull Path getBackupPath(); + @Nonnull Path getBackupPath(); /** * Get the maximum amount of backups that may be stored for diff --git a/Core/src/main/java/com/plotsquared/core/backup/BackupProfile.java b/Core/src/main/java/com/plotsquared/core/backup/BackupProfile.java index 6664246e4..1a9dc7baa 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/BackupProfile.java +++ b/Core/src/main/java/com/plotsquared/core/backup/BackupProfile.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.backup; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.nio.file.Path; import java.util.List; @@ -38,7 +38,7 @@ public interface BackupProfile { * * @return Future that will be completed with available backups */ - @NotNull CompletableFuture> listBackups(); + @Nonnull CompletableFuture> listBackups(); /** * Remove all backups stored for this profile @@ -51,7 +51,7 @@ public interface BackupProfile { * * @return Folder that contains the backups for this profile */ - @NotNull Path getBackupDirectory(); + @Nonnull Path getBackupDirectory(); /** * Create a backup of the plot. If the profile is at the @@ -59,7 +59,7 @@ public interface BackupProfile { * * @return Future that completes with the created backup. */ - @NotNull CompletableFuture createBackup(); + @Nonnull CompletableFuture createBackup(); /** * Restore a backup @@ -67,6 +67,6 @@ public interface BackupProfile { * @param backup Backup to restore * @return Future that completes when the backup has finished */ - @NotNull CompletableFuture restoreBackup(@NotNull final Backup backup); + @Nonnull CompletableFuture restoreBackup(@Nonnull final Backup backup); } diff --git a/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java index fb0e33fda..c83a36c24 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java @@ -29,8 +29,8 @@ import com.google.inject.Singleton; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.nio.file.Path; import java.util.Objects; @@ -40,16 +40,16 @@ import java.util.Objects; */ @Singleton public class NullBackupManager implements BackupManager { - @Override @NotNull public BackupProfile getProfile(@NotNull Plot plot) { + @Override @Nonnull public BackupProfile getProfile(@Nonnull Plot plot) { return new NullBackupProfile(); } @Override public void automaticBackup(@Nullable PlotPlayer plotPlayer, - @NotNull Plot plot, @NotNull Runnable whenDone) { + @Nonnull Plot plot, @Nonnull Runnable whenDone) { whenDone.run(); } - @Override @NotNull public Path getBackupPath() { + @Override @Nonnull public Path getBackupPath() { return Objects.requireNonNull(PlotSquared.platform()).getDirectory().toPath(); } diff --git a/Core/src/main/java/com/plotsquared/core/backup/NullBackupProfile.java b/Core/src/main/java/com/plotsquared/core/backup/NullBackupProfile.java index 39c833579..b16a589fc 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/NullBackupProfile.java +++ b/Core/src/main/java/com/plotsquared/core/backup/NullBackupProfile.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.backup; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.nio.file.Path; @@ -39,22 +39,22 @@ import java.util.concurrent.CompletableFuture; */ public class NullBackupProfile implements BackupProfile { - @Override @NotNull public CompletableFuture> listBackups() { + @Override @Nonnull public CompletableFuture> listBackups() { return CompletableFuture.completedFuture(Collections.emptyList()); } @Override public void destroy(){ } - @Override @NotNull public Path getBackupDirectory() { + @Override @Nonnull public Path getBackupDirectory() { return new File(".").toPath(); } - @Override @NotNull public CompletableFuture createBackup() { + @Override @Nonnull public CompletableFuture createBackup() { throw new UnsupportedOperationException("Cannot create backup of an unowned plot"); } - @Override @NotNull public CompletableFuture restoreBackup(@NotNull final Backup backup) { + @Override @Nonnull public CompletableFuture restoreBackup(@Nonnull final Backup backup) { return CompletableFuture.completedFuture(null); } 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 27e8b0071..e70ef4ac6 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java +++ b/Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java @@ -33,7 +33,7 @@ import com.plotsquared.core.plot.schematic.Schematic; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.IOException; import java.nio.file.Files; @@ -59,8 +59,8 @@ public class PlayerBackupProfile implements BackupProfile { private final BackupManager backupManager; private final SchematicHandler schematicHandler; - @Inject public PlayerBackupProfile(@Assisted @NotNull final UUID owner, @Assisted @NotNull final Plot plot, - @NotNull final BackupManager backupManager, @NotNull final SchematicHandler schematicHandler) { + @Inject public PlayerBackupProfile(@Assisted @Nonnull final UUID owner, @Assisted @Nonnull final Plot plot, + @Nonnull final BackupManager backupManager, @Nonnull final SchematicHandler schematicHandler) { this.owner = owner; this.plot = plot; this.backupManager = backupManager; @@ -70,12 +70,12 @@ public class PlayerBackupProfile implements BackupProfile { private volatile List backupCache; private final Object backupLock = new Object(); - private static boolean isValidFile(@NotNull final Path path) { + private static boolean isValidFile(@Nonnull final Path path) { final String name = path.getFileName().toString(); return name.endsWith(".schem") || name.endsWith(".schematic"); } - @Override @NotNull public CompletableFuture> listBackups() { + @Override @Nonnull public CompletableFuture> listBackups() { synchronized (this.backupLock) { if (this.backupCache != null) { return CompletableFuture.completedFuture(backupCache); @@ -121,12 +121,12 @@ public class PlayerBackupProfile implements BackupProfile { }); } - @NotNull public Path getBackupDirectory() { + @Nonnull public Path getBackupDirectory() { return resolve(resolve(resolve(backupManager.getBackupPath(), Objects.requireNonNull(plot.getArea().toString(), "plot area id")), Objects.requireNonNull(plot.getId().toDashSeparatedString(), "plot id")), Objects.requireNonNull(owner.toString(), "owner")); } - private static Path resolve(@NotNull final Path parent, final String child) { + private static Path resolve(@Nonnull final Path parent, final String child) { Path path = parent; try { if (!Files.exists(parent)) { @@ -142,7 +142,7 @@ public class PlayerBackupProfile implements BackupProfile { return path; } - @Override @NotNull public CompletableFuture createBackup() { + @Override @Nonnull public CompletableFuture createBackup() { final CompletableFuture future = new CompletableFuture<>(); this.listBackups().thenAcceptAsync(backups -> { synchronized (this.backupLock) { @@ -162,7 +162,7 @@ public class PlayerBackupProfile implements BackupProfile { return future; } - @Override @NotNull public CompletableFuture restoreBackup(@NotNull final Backup backup) { + @Override @Nonnull public CompletableFuture restoreBackup(@Nonnull final Backup backup) { final CompletableFuture future = new CompletableFuture<>(); if (backup.getFile() == null || !Files.exists(backup.getFile())) { future.completeExceptionally(new IllegalArgumentException("The specific backup does not exist")); diff --git a/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java index 68d75e810..97bae8f1c 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java @@ -39,8 +39,8 @@ import com.plotsquared.core.util.task.TaskManager; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.nio.file.Files; import java.nio.file.Path; @@ -60,7 +60,7 @@ import java.util.concurrent.TimeUnit; .expireAfterAccess(3, TimeUnit.MINUTES).build(); private final PlayerBackupProfileFactory playerBackupProfileFactory; - @Inject public SimpleBackupManager(@NotNull final PlayerBackupProfileFactory playerBackupProfileFactory) throws Exception { + @Inject public SimpleBackupManager(@Nonnull final PlayerBackupProfileFactory playerBackupProfileFactory) throws Exception { this.playerBackupProfileFactory = playerBackupProfileFactory; this.backupPath = Objects.requireNonNull(PlotSquared.platform()).getDirectory().toPath().resolve("backups"); if (!Files.exists(backupPath)) { @@ -70,7 +70,7 @@ import java.util.concurrent.TimeUnit; this.backupLimit = Settings.Backup.BACKUP_LIMIT; } - @Override @NotNull public BackupProfile getProfile(@NotNull final Plot plot) { + @Override @Nonnull public BackupProfile getProfile(@Nonnull final Plot plot) { if (plot.hasOwner() && !plot.isMerged()) { try { return backupProfileCache.get(new PlotCacheKey(plot), () -> this.playerBackupProfileFactory.create(plot.getOwnerAbs(), plot)); @@ -83,7 +83,7 @@ import java.util.concurrent.TimeUnit; return new NullBackupProfile(); } - @Override public void automaticBackup(@Nullable PlotPlayer player, @NotNull final Plot plot, @NotNull Runnable whenDone) { + @Override public void automaticBackup(@Nullable PlotPlayer player, @Nonnull final Plot plot, @Nonnull Runnable whenDone) { final BackupProfile profile; if (!this.shouldAutomaticallyBackup() || (profile = getProfile(plot)) instanceof NullBackupProfile) { whenDone.run(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Add.java b/Core/src/main/java/com/plotsquared/core/command/Add.java index f1eab4936..b1843fffd 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Add.java +++ b/Core/src/main/java/com/plotsquared/core/command/Add.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.PlotPlayer; @@ -35,7 +36,7 @@ import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -54,7 +55,7 @@ public class Add extends Command { private final EventDispatcher eventDispatcher; - public Add(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Add(@Nonnull final EventDispatcher eventDispatcher) { super(MainCommand.getInstance(), true); this.eventDispatcher = eventDispatcher; } 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 784022f07..18f71b00f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -71,7 +71,7 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.io.FileOutputStream; @@ -100,13 +100,13 @@ public class Area extends SubCommand { private final WorldUtil worldUtil; private final RegionManager regionManager; - @Inject public Area(@NotNull final PlotAreaManager plotAreaManager, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @WorldFile @NotNull final File worldFile, - @NotNull final HybridPlotWorldFactory hybridPlotWorldFactory, - @NotNull final SetupUtils setupUtils, - @NotNull final WorldUtil worldUtil, - @NotNull final RegionManager regionManager) { + @Inject public Area(@Nonnull final PlotAreaManager plotAreaManager, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @WorldFile @Nonnull final File worldFile, + @Nonnull final HybridPlotWorldFactory hybridPlotWorldFactory, + @Nonnull final SetupUtils setupUtils, + @Nonnull final WorldUtil worldUtil, + @Nonnull final RegionManager regionManager) { this.plotAreaManager = plotAreaManager; this.worldConfiguration = worldConfiguration; this.worldFile = worldFile; diff --git a/Core/src/main/java/com/plotsquared/core/command/Auto.java b/Core/src/main/java/com/plotsquared/core/command/Auto.java index ff405ddd3..e212d3e58 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Auto.java +++ b/Core/src/main/java/com/plotsquared/core/command/Auto.java @@ -26,6 +26,7 @@ package com.plotsquared.core.command; import com.google.common.primitives.Ints; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; @@ -49,8 +50,8 @@ import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.AutoClaimFinishTask; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Set; @@ -66,10 +67,14 @@ public class Auto extends SubCommand { private final PlotAreaManager plotAreaManager; private final EventDispatcher eventDispatcher; - - public Auto(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher) { + private final EconHandler econHandler; + + @Inject public Auto(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @Nullable final EconHandler econHandler) { this.plotAreaManager = plotAreaManager; this.eventDispatcher = eventDispatcher; + this.econHandler = econHandler; } @Deprecated public static PlotId getNextPlotId(PlotId id, int step) { @@ -147,7 +152,7 @@ public class Auto extends SubCommand { player.setMeta(Auto.class.getName(), true); autoClaimFromDatabase(player, area, start, new RunnableVal() { @Override public void run(final Plot plot) { - TaskManager.IMP.sync(new AutoClaimFinishTask(player, plot, area, schematic, + TaskManager.getImplementation().sync(new AutoClaimFinishTask(player, plot, area, schematic, PlotSquared.get().getEventDispatcher())); } }); @@ -169,10 +174,9 @@ public class Auto extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { PlotArea plotarea = player.getApplicablePlotArea(); if (plotarea == null) { - if (EconHandler.getEconHandler() != null) { + if (this.econHandler != null) { for (PlotArea area : this.plotAreaManager.getAllPlotAreas()) { - if (EconHandler.getEconHandler() - .hasPermission(area.getWorldName(), player.getName(), "plots.auto")) { + if (this.econHandler.hasPermission(area.getWorldName(), player.getName(), "plots.auto")) { if (plotarea != null) { plotarea = null; break; @@ -265,18 +269,18 @@ public class Auto extends SubCommand { return true; } } - if (EconHandler.getEconHandler() != null && plotarea.useEconomy()) { + if (this.econHandler != null && plotarea.useEconomy()) { Expression costExp = plotarea.getPrices().get("claim"); double cost = costExp.evaluate((double) (Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.getWorldName()))); cost = (size_x * size_z) * cost; if (cost > 0d) { - if (!force && EconHandler.getEconHandler().getMoney(player) < cost) { + if (!force && this.econHandler.getMoney(player) < cost) { sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost); return true; } - EconHandler.getEconHandler().withdrawMoney(player, cost); + this.econHandler.withdrawMoney(player, cost); sendMessage(player, Captions.REMOVED_BALANCE, cost + ""); } } 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 6ddeb7e91..4c16458c6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Backup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Backup.java @@ -36,7 +36,7 @@ import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.nio.file.Files; import java.time.Instant; @@ -64,7 +64,7 @@ public final class Backup extends Command { private final BackupManager backupManager; - @Inject public Backup(@NotNull final BackupManager backupManager) { + @Inject public Backup(@Nonnull final BackupManager backupManager) { super(MainCommand.getInstance(), true); this.backupManager = backupManager; } 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 934a6e684..f62f24bc2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Buy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Buy.java @@ -39,9 +39,9 @@ import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; import java.util.Set; import java.util.concurrent.CompletableFuture; @@ -56,7 +56,7 @@ public class Buy extends Command { private final EventDispatcher eventDispatcher; private final EconHandler econHandler; - @Inject public Buy(@NotNull final EventDispatcher eventDispatcher, + @Inject public Buy(@Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) { super(MainCommand.getInstance(), true); this.eventDispatcher = eventDispatcher; 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 b56d33dc0..55efd2519 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Caps.java +++ b/Core/src/main/java/com/plotsquared/core/command/Caps.java @@ -71,7 +71,7 @@ public class Caps extends SubCommand { } private > void sendFormatted(final Plot plot, - final PlotPlayer player, final Class capFlag, final int[] countedEntities, + final PlotPlayer player, final Class capFlag, final int[] countedEntities, final String name, final int type) { final int current = countedEntities[type]; final int max = plot.getFlag(capFlag); 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 e79f085c3..ea77ae44e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Claim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Claim.java @@ -46,8 +46,8 @@ import com.plotsquared.core.util.Expression; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; @CommandDeclaration(command = "claim", aliases = "c", @@ -61,7 +61,7 @@ public class Claim extends SubCommand { private final EventDispatcher eventDispatcher; private final EconHandler econHandler; - @Inject public Claim(@NotNull final EventDispatcher eventDispatcher, + @Inject public Claim(@Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) { this.eventDispatcher = eventDispatcher; this.econHandler = econHandler; diff --git a/Core/src/main/java/com/plotsquared/core/command/Clear.java b/Core/src/main/java/com/plotsquared/core/command/Clear.java index a68254904..1eee3a26c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Clear.java +++ b/Core/src/main/java/com/plotsquared/core/command/Clear.java @@ -42,7 +42,7 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.concurrent.CompletableFuture; @@ -61,8 +61,8 @@ public class Clear extends Command { private final EventDispatcher eventDispatcher; private final GlobalBlockQueue blockQueue; - @Inject public Clear(@NotNull final EventDispatcher eventDispatcher, - @NotNull final GlobalBlockQueue blockQueue) { + @Inject public Clear(@Nonnull final EventDispatcher eventDispatcher, + @Nonnull final GlobalBlockQueue blockQueue) { super(MainCommand.getInstance(), true); this.eventDispatcher = eventDispatcher; this.blockQueue = blockQueue; diff --git a/Core/src/main/java/com/plotsquared/core/command/Command.java b/Core/src/main/java/com/plotsquared/core/command/Command.java index 194fc48a4..a0dbe9079 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Command.java +++ b/Core/src/main/java/com/plotsquared/core/command/Command.java @@ -36,7 +36,7 @@ import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; import lombok.SneakyThrows; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -582,7 +582,7 @@ public abstract class Command { return object; } - @SneakyThrows protected static void sneakyThrow(@NotNull final Throwable throwable) { + @SneakyThrows protected static void sneakyThrow(@Nonnull final Throwable throwable) { throw throwable; } 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 1f78d9bc5..180e26581 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Condense.java +++ b/Core/src/main/java/com/plotsquared/core/command/Condense.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; @@ -34,7 +35,7 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -56,9 +57,12 @@ public class Condense extends SubCommand { public static boolean TASK = false; private final PlotAreaManager plotAreaManager; + private final WorldUtil worldUtil; - public Condense(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public Condense(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final WorldUtil worldUtil) { this.plotAreaManager = plotAreaManager; + this.worldUtil = worldUtil; } @Override public boolean onCommand(final PlotPlayer player, String[] args) { @@ -67,7 +71,7 @@ public class Condense extends SubCommand { return false; } PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]); - if (area == null || !WorldUtil.IMP.isWorld(area.getWorldName())) { + if (area == null || !this.worldUtil.isWorld(area.getWorldName())) { MainUtil.sendMessage(player, "INVALID AREA"); return false; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Continue.java b/Core/src/main/java/com/plotsquared/core/command/Continue.java index 1f619f2a3..bd061e380 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Continue.java +++ b/Core/src/main/java/com/plotsquared/core/command/Continue.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotFlagRemoveEvent; @@ -36,7 +37,7 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @CommandDeclaration(command = "continue", description = "Continue a plot that was previously marked as done", @@ -47,7 +48,7 @@ public class Continue extends SubCommand { private final EventDispatcher eventDispatcher; - public Continue(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Continue(@Nonnull final EventDispatcher eventDispatcher) { this.eventDispatcher = eventDispatcher; } diff --git a/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java b/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java index acee18881..2820fc204 100644 --- a/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java +++ b/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java @@ -33,7 +33,7 @@ import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @CommandDeclaration(command = "createroadschematic", aliases = {"crs"}, @@ -46,7 +46,7 @@ public class CreateRoadSchematic extends SubCommand { private final HybridUtils hybridUtils; - @Inject public CreateRoadSchematic(@NotNull final HybridUtils hybridUtils) { + @Inject public CreateRoadSchematic(@Nonnull final HybridUtils hybridUtils) { this.hybridUtils = hybridUtils; } diff --git a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java index bd4216e12..424363e3f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.configuration.file.YamlConfiguration; @@ -44,7 +45,7 @@ import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.sql.SQLException; @@ -68,8 +69,10 @@ public class DatabaseCommand extends SubCommand { private final PlotListener plotListener; private final YamlConfiguration worldConfiguration; - public DatabaseCommand(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher, - @NotNull final PlotListener plotListener, @WorldConfig @NotNull final YamlConfiguration worldConfiguration) { + @Inject public DatabaseCommand(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @Nonnull final PlotListener plotListener, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration) { this.plotAreaManager = plotAreaManager; this.eventDispatcher = eventDispatcher; this.plotListener = plotListener; 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 3b912231d..35d413033 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Debug.java +++ b/Core/src/main/java/com/plotsquared/core/command/Debug.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.player.PlotPlayer; @@ -38,7 +39,7 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.uuid.UUIDMapping; import com.sk89q.worldedit.world.entity.EntityType; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Comparator; @@ -52,9 +53,12 @@ import java.util.Map; public class Debug extends SubCommand { private final PlotAreaManager plotAreaManager; + private final RegionManager regionManager; - public Debug(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public Debug(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final RegionManager regionManager) { this.plotAreaManager = plotAreaManager; + this.regionManager = regionManager; } @Override public boolean onCommand(PlotPlayer player, String[] args) { @@ -70,8 +74,7 @@ public class Debug extends SubCommand { final long start = System.currentTimeMillis(); MainUtil.sendMessage(player, "Fetching loaded chunks..."); TaskManager.runTaskAsync(() -> MainUtil.sendMessage(player, - "Loaded chunks: " + RegionManager.manager - .getChunkChunks(player.getLocation().getWorldName()).size() + "(" + ( + "Loaded chunks: " + this.regionManager.getChunkChunks(player.getLocation().getWorldName()).size() + "(" + ( System.currentTimeMillis() - start) + "ms) using thread: " + Thread .currentThread().getName())); return true; 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 0006a6d83..f8daa2a89 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -26,6 +26,7 @@ package com.plotsquared.core.command; import com.google.common.io.Files; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; @@ -62,8 +63,8 @@ import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.world.block.BlockState; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import javax.script.Bindings; import javax.script.ScriptContext; @@ -90,35 +91,39 @@ public class DebugExec extends SubCommand { private final PlotAreaManager plotAreaManager; private final EventDispatcher eventDispatcher; private final WorldEdit worldEdit; + private final GlobalBlockQueue blockQueue; + private final SchematicHandler schematicHandler; + private final EconHandler econHandler; + private final ChunkManager chunkManager; + private final WorldUtil worldUtil; + private final SetupUtils setupUtils; + private final HybridUtils hybridUtils; + private ScriptEngine engine; private Bindings scope; - public DebugExec(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher, - @Nullable final WorldEdit worldEdit) { + @Inject public DebugExec(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @Nullable final WorldEdit worldEdit, + @Nonnull final GlobalBlockQueue blockQueue, + @Nonnull final SchematicHandler schematicHandler, + @Nullable final EconHandler econHandler, + @Nonnull final ChunkManager chunkManager, + @Nonnull final WorldUtil worldUtil, + @Nonnull final SetupUtils setupUtils, + @Nonnull final HybridUtils hybridUtils) { this.plotAreaManager = plotAreaManager; this.eventDispatcher = eventDispatcher; this.worldEdit = worldEdit; + this.blockQueue = blockQueue; + this.schematicHandler = schematicHandler; + this.econHandler = econHandler; + this.chunkManager = chunkManager; + this.worldUtil = worldUtil; + this.setupUtils = setupUtils; + this.hybridUtils = hybridUtils; + init(); -/* - try { - if (PlotSquared.get() != null) { - File file = new File(PlotSquared.imp().getDirectory(), - Settings.Paths.SCRIPTS + File.separator + "start.js"); - if (file.exists()) { - init(); - String script = StringMan.join(Files.readLines(new File(new File( - PlotSquared.imp().getDirectory() + File.separator - + Settings.Paths.SCRIPTS), "start.js"), StandardCharsets.UTF_8), - System.getProperty("line.separator")); - this.scope.put("THIS", this); - this.scope.put("PlotPlayer", ConsolePlayer.getConsole()); - this.engine.eval(script, this.scope); - } - } - } catch (IOException | ScriptException ignored) { - ignored.printStackTrace(); - } -*/ } public ScriptEngine getEngine() { @@ -167,21 +172,21 @@ public class DebugExec extends SubCommand { // Instances this.scope.put("PS", PlotSquared.get()); - this.scope.put("GlobalBlockQueue", GlobalBlockQueue.IMP); + this.scope.put("GlobalBlockQueue", this.blockQueue); this.scope.put("ExpireManager", ExpireManager.IMP); if (this.worldEdit != null) { this.scope.put("WEManager", new WEManager()); } - this.scope.put("TaskManager", TaskManager.IMP); + this.scope.put("TaskManager", TaskManager.getImplementation()); this.scope.put("ConsolePlayer", ConsolePlayer.getConsole()); - this.scope.put("SchematicHandler", SchematicHandler.manager); - this.scope.put("ChunkManager", ChunkManager.manager); - this.scope.put("BlockManager", WorldUtil.IMP); - this.scope.put("SetupUtils", SetupUtils.manager); + this.scope.put("SchematicHandler", this.schematicHandler); + this.scope.put("ChunkManager", this.chunkManager); + this.scope.put("BlockManager", this.worldUtil); + this.scope.put("SetupUtils", this.setupUtils); this.scope.put("EventUtil", this.eventDispatcher); - this.scope.put("EconHandler", EconHandler.getEconHandler()); + this.scope.put("EconHandler", this.econHandler); this.scope.put("DBFunc", DBFunc.dbManager); - this.scope.put("HybridUtils", HybridUtils.manager); + this.scope.put("HybridUtils", this.hybridUtils); this.scope.put("IMP", PlotSquared.platform()); this.scope.put("MainCommand", MainCommand.getInstance()); @@ -213,7 +218,7 @@ public class DebugExec extends SubCommand { return true; } MainUtil.sendMessage(player, "$1Starting task..."); - HybridUtils.manager.analyzePlot(plot, new RunnableVal() { + this.hybridUtils.analyzePlot(plot, new RunnableVal() { @Override public void run(PlotAnalysis value) { MainUtil.sendMessage(player, "$1Done: $2Use $3/plot debugexec analyze$2 for more information"); @@ -279,10 +284,9 @@ public class DebugExec extends SubCommand { } boolean result; if (HybridUtils.regions != null) { - result = HybridUtils.manager - .scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>()); + result = this.hybridUtils.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>()); } else { - result = HybridUtils.manager.scheduleRoadUpdate(area, 0); + result = this.hybridUtils.scheduleRoadUpdate(area, 0); } if (!result) { MainUtil.sendMessage(player, diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java index 1a24a97c9..0f15c1528 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java @@ -26,6 +26,7 @@ package com.plotsquared.core.command; import com.google.common.base.Charsets; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.player.PlotPlayer; @@ -36,7 +37,7 @@ import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.util.UUID; @@ -50,10 +51,13 @@ import java.util.concurrent.CompletableFuture; public class DebugImportWorlds extends Command { private final PlotAreaManager plotAreaManager; + private final WorldUtil worldUtil; - public DebugImportWorlds(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public DebugImportWorlds(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final WorldUtil worldUtil) { super(MainCommand.getInstance(), true); this.plotAreaManager = plotAreaManager; + this.worldUtil = worldUtil; } @Override @@ -75,7 +79,7 @@ public class DebugImportWorlds extends Command { } for (File folder : container.listFiles()) { String name = folder.getName(); - if (!WorldUtil.IMP.isWorld(name) && PlotId.fromStringOrNull(name) == null) { + if (!this.worldUtil.isWorld(name) && PlotId.fromStringOrNull(name) == null) { UUID uuid; if (name.length() > 16) { uuid = UUID.fromString(name); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java index 524d3daa9..fa7f4a837 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java @@ -27,6 +27,7 @@ package com.plotsquared.core.command; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.inject.annotations.ConfigFile; import com.plotsquared.core.inject.annotations.WorldFile; @@ -37,8 +38,8 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.net.IncendoPaster; import com.plotsquared.core.util.task.TaskManager; -import lombok.NonNull; -import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; import java.io.BufferedReader; import java.io.File; @@ -65,13 +66,13 @@ public class DebugPaste extends SubCommand { private final File configFile; private final File worldfile; - public DebugPaste(@ConfigFile @NotNull final File configFile, - @WorldFile @NotNull final File worldFile) { + @Inject public DebugPaste(@ConfigFile @Nonnull final File configFile, + @WorldFile @Nonnull final File worldFile) { this.configFile = configFile; this.worldfile = worldFile; } - private static String readFile(@NonNull final File file) throws IOException { + private static String readFile(@Nonnull final File file) throws IOException { final List lines; try (final BufferedReader reader = new BufferedReader(new FileReader(file))) { lines = reader.lines().collect(Collectors.toList()); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java index baa494029..b656522c7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java @@ -35,7 +35,7 @@ import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.util.MainUtil; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; @@ -51,7 +51,7 @@ public class DebugRoadRegen extends SubCommand { private final HybridUtils hybridUtils; - @Inject public DebugRoadRegen(@NotNull final HybridUtils hybridUtils) { + @Inject public DebugRoadRegen(@Nonnull final HybridUtils hybridUtils) { this.hybridUtils = hybridUtils; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Delete.java b/Core/src/main/java/com/plotsquared/core/command/Delete.java index ccb6dedf5..87d8d683a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Delete.java +++ b/Core/src/main/java/com/plotsquared/core/command/Delete.java @@ -39,8 +39,8 @@ import com.plotsquared.core.util.Expression; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; @CommandDeclaration(command = "delete", @@ -56,7 +56,7 @@ public class Delete extends SubCommand { private final EventDispatcher eventDispatcher; private final EconHandler econHandler; - @Inject public Delete(@NotNull final EventDispatcher eventDispatcher, + @Inject public Delete(@Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) { this.eventDispatcher = eventDispatcher; this.econHandler = econHandler; diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index ed91fcfe9..b97be84f7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -39,7 +39,7 @@ import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.WorldUtil; import com.sk89q.worldedit.world.gamemode.GameModes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -58,9 +58,9 @@ public class Deny extends SubCommand { private final EventDispatcher eventDispatcher; private final WorldUtil worldUtil; - @Inject public Deny(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final EventDispatcher eventDispatcher, - @NotNull final WorldUtil worldUtil) { + @Inject public Deny(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @Nonnull final WorldUtil worldUtil) { super(Argument.PlayerName); this.plotAreaManager = plotAreaManager; this.eventDispatcher = eventDispatcher; diff --git a/Core/src/main/java/com/plotsquared/core/command/Desc.java b/Core/src/main/java/com/plotsquared/core/command/Desc.java index a5de2111c..6b607ae31 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Desc.java +++ b/Core/src/main/java/com/plotsquared/core/command/Desc.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent; @@ -34,7 +35,7 @@ import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.implementations.DescriptionFlag; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @CommandDeclaration(command = "setdescription", permission = "plots.set.desc", @@ -47,7 +48,7 @@ public class Desc extends SetCommand { private final EventDispatcher eventDispatcher; - public Desc(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Desc(@Nonnull final EventDispatcher eventDispatcher) { this.eventDispatcher = eventDispatcher; } 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 503effa12..51e0b1ca2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Dislike.java +++ b/Core/src/main/java/com/plotsquared/core/command/Dislike.java @@ -25,8 +25,9 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.player.PlotPlayer; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @CommandDeclaration(command = "dislike", permission = "plots.dislike", @@ -38,7 +39,7 @@ public class Dislike extends SubCommand { private final Like like; - public Dislike(@NotNull final Like like) { + @Inject public Dislike(@Nonnull final Like like) { this.like = like; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Done.java b/Core/src/main/java/com/plotsquared/core/command/Done.java index 7fa88b40a..2103cc4d9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Done.java +++ b/Core/src/main/java/com/plotsquared/core/command/Done.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.events.PlotDoneEvent; @@ -42,7 +43,7 @@ import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @CommandDeclaration(command = "done", aliases = {"submit"}, @@ -53,9 +54,12 @@ import org.jetbrains.annotations.NotNull; public class Done extends SubCommand { private final EventDispatcher eventDispatcher; - - public Done(@NotNull final EventDispatcher eventDispatcher) { + private final HybridUtils hybridUtils; + + @Inject public Done(@Nonnull final EventDispatcher eventDispatcher, + @Nonnull final HybridUtils hybridUtils) { this.eventDispatcher = eventDispatcher; + this.hybridUtils = hybridUtils; } @Override public boolean onCommand(final PlotPlayer player, String[] args) { @@ -90,7 +94,7 @@ public class Done extends SubCommand { finish(plot, player, true); plot.removeRunning(); } else { - HybridUtils.manager.analyzePlot(plot, new RunnableVal() { + this.hybridUtils.analyzePlot(plot, new RunnableVal() { @Override public void run(PlotAnalysis value) { plot.removeRunning(); boolean result = 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 9245b3b85..66f0b6e86 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Download.java +++ b/Core/src/main/java/com/plotsquared/core/command/Download.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.player.PlotPlayer; @@ -38,7 +39,7 @@ import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.RunnableVal; import com.sk89q.jnbt.CompoundTag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.net.URL; @@ -52,9 +53,15 @@ import java.net.URL; public class Download extends SubCommand { private final PlotAreaManager plotAreaManager; + private final SchematicHandler schematicHandler; + private final WorldUtil worldUtil; - public Download(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public Download(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final SchematicHandler schematicHandler, + @Nonnull final WorldUtil worldUtil) { this.plotAreaManager = plotAreaManager; + this.schematicHandler = schematicHandler; + this.worldUtil = worldUtil; } @Override public boolean onCommand(final PlotPlayer player, String[] args) { @@ -91,10 +98,10 @@ public class Download extends SubCommand { return false; } plot.addRunning(); - SchematicHandler.manager.getCompoundTag(plot, new RunnableVal() { + this.schematicHandler.getCompoundTag(plot, new RunnableVal() { @Override public void run(CompoundTag value) { plot.removeRunning(); - SchematicHandler.manager.upload(value, null, null, new RunnableVal() { + schematicHandler.upload(value, null, null, new RunnableVal() { @Override public void run(URL url) { if (url == null) { MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED); @@ -113,8 +120,8 @@ public class Download extends SubCommand { } MainUtil.sendMessage(player, Captions.MCA_FILE_SIZE); plot.addRunning(); - WorldUtil.IMP.saveWorld(world); - WorldUtil.IMP.upload(plot, null, null, new RunnableVal() { + this.worldUtil.saveWorld(world); + this.worldUtil.upload(plot, null, null, new RunnableVal() { @Override public void run(URL url) { plot.removeRunning(); if (url == null) { 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 d6b5a58e8..d71cbbb2b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java @@ -50,8 +50,8 @@ import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.helpmenu.HelpMenu; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -87,7 +87,7 @@ public final class FlagCommand extends Command { } private static boolean checkPermValue(@Nonnull final PlotPlayer player, - @NotNull final PlotFlag flag, @NotNull String key, @NotNull String value) { + @Nonnull final PlotFlag flag, @Nonnull String key, @Nonnull String value) { key = key.toLowerCase(); value = value.toLowerCase(); String perm = CaptionUtility @@ -152,7 +152,7 @@ public final class FlagCommand extends Command { * * @return true if the player is allowed to modify the flags at their current location */ - private static boolean checkRequirements(@NotNull final PlotPlayer player) { + private static boolean checkRequirements(@Nonnull final PlotPlayer player) { final Location location = player.getLocation(); final Plot plot = location.getPlotAbs(); if (plot == null) { @@ -180,8 +180,8 @@ public final class FlagCommand extends Command { * @param arg String to extract flag from * @return The flag, if found, else null */ - @Nullable private static PlotFlag getFlag(@NotNull final PlotPlayer player, - @NotNull final String arg) { + @Nullable private static PlotFlag getFlag(@Nonnull final PlotPlayer player, + @Nonnull final String arg) { if (arg != null && arg.length() > 0) { final PlotFlag flag = GlobalFlagContainer.getInstance().getFlagFromString(arg); if (flag instanceof InternalFlag || flag == null) { diff --git a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java index f963a8732..3cc72188a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.player.PlotPlayer; @@ -40,7 +41,7 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.SortingStrategy; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -58,13 +59,13 @@ public class HomeCommand extends Command { private final PlotAreaManager plotAreaManager; - public HomeCommand(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public HomeCommand(@Nonnull final PlotAreaManager plotAreaManager) { super(MainCommand.getInstance(), true); this.plotAreaManager = plotAreaManager; } - private void home(@NotNull final PlotPlayer player, - @NotNull final PlotQuery query, final int page, + private void home(@Nonnull final PlotPlayer player, + @Nonnull final PlotQuery query, final int page, final RunnableVal3 confirm, final RunnableVal2 whenDone) { List plots = query.asList(); @@ -86,7 +87,7 @@ public class HomeCommand extends Command { }), () -> whenDone.run(HomeCommand.this, CommandResult.FAILURE)); } - @NotNull private PlotQuery query(@NotNull final PlotPlayer player) { + @Nonnull private PlotQuery query(@Nonnull final PlotPlayer player) { // everything plots need to have in common here return PlotQuery.newQuery().ownedBy(player); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Kick.java b/Core/src/main/java/com/plotsquared/core/command/Kick.java index 8c2ede600..1b35df43c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Kick.java +++ b/Core/src/main/java/com/plotsquared/core/command/Kick.java @@ -37,7 +37,7 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.WorldUtil; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -58,8 +58,8 @@ public class Kick extends SubCommand { private final PlotAreaManager plotAreaManager; private final WorldUtil worldUtil; - @Inject public Kick(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final WorldUtil worldUtil) { + @Inject public Kick(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final WorldUtil worldUtil) { super(Argument.PlayerName); this.plotAreaManager = plotAreaManager; this.worldUtil = worldUtil; diff --git a/Core/src/main/java/com/plotsquared/core/command/Leave.java b/Core/src/main/java/com/plotsquared/core/command/Leave.java index bf1fbe604..a6666f84c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Leave.java +++ b/Core/src/main/java/com/plotsquared/core/command/Leave.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; @@ -32,7 +33,7 @@ import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -47,7 +48,7 @@ public class Leave extends Command { private final EventDispatcher eventDispatcher; - public Leave(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Leave(@Nonnull final EventDispatcher eventDispatcher) { super(MainCommand.getInstance(), true); this.eventDispatcher = eventDispatcher; } 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 92624d342..cab2dc433 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Like.java +++ b/Core/src/main/java/com/plotsquared/core/command/Like.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; @@ -39,7 +40,7 @@ import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -57,7 +58,7 @@ public class Like extends SubCommand { private final EventDispatcher eventDispatcher; - public Like(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Like(@Nonnull final EventDispatcher eventDispatcher) { this.eventDispatcher = eventDispatcher; } 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 e1ba7afbf..57bbe624a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java @@ -49,8 +49,8 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.SortingStrategy; import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.uuid.UUIDMapping; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; @@ -76,7 +76,7 @@ public class ListCmd extends SubCommand { private final PlotAreaManager plotAreaManager; private final EconHandler econHandler; - @Inject public ListCmd(@NotNull final PlotAreaManager plotAreaManager, + @Inject public ListCmd(@Nonnull final PlotAreaManager plotAreaManager, @Nullable final EconHandler econHandler) { this.plotAreaManager = plotAreaManager; this.econHandler = econHandler; diff --git a/Core/src/main/java/com/plotsquared/core/command/Load.java b/Core/src/main/java/com/plotsquared/core/command/Load.java index df18fc8a7..cc099687b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Load.java +++ b/Core/src/main/java/com/plotsquared/core/command/Load.java @@ -39,7 +39,7 @@ import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.net.MalformedURLException; import java.net.URL; @@ -57,8 +57,8 @@ public class Load extends SubCommand { private final PlotAreaManager plotAreaManager; private final SchematicHandler schematicHandler; - @Inject public Load(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final SchematicHandler schematicHandler) { + @Inject public Load(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final SchematicHandler schematicHandler) { this.plotAreaManager = plotAreaManager; this.schematicHandler = schematicHandler; } diff --git a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java index b8d3015b5..d724155cf 100644 --- a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java @@ -29,23 +29,17 @@ import com.google.inject.Injector; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; -import com.plotsquared.core.configuration.file.YamlConfiguration; -import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.util.EconHandler; -import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.Expression; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import com.sk89q.worldedit.WorldEdit; -import java.io.File; import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -152,12 +146,13 @@ public class MainCommand extends Command { // Referenced commands instance.toggle = injector.getInstance(Toggle.class); - instance.help = injector.getInstance(Help.class); + instance.help = new Help(instance); } return instance; } public static boolean onCommand(final PlotPlayer player, String... args) { + final EconHandler econHandler = PlotSquared.platform().getEconHandler(); if (args.length >= 1 && args[0].contains(":")) { String[] split2 = args[0].split(":"); if (split2.length == 2) { @@ -179,14 +174,14 @@ public class MainCommand extends Command { public void run(final Command cmd, final Runnable success, final Runnable failure) { if (cmd.hasConfirmation(player)) { CmdConfirm.addPending(player, cmd.getUsage(), () -> { - if (EconHandler.getEconHandler() != null) { + if (econHandler != null) { PlotArea area = player.getApplicablePlotArea(); if (area != null) { Expression priceEval = area.getPrices().get(cmd.getFullId()); Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; if (price != null - && EconHandler.getEconHandler().getMoney(player) < price) { + && econHandler.getMoney(player) < price) { if (failure != null) { failure.run(); } @@ -200,12 +195,12 @@ public class MainCommand extends Command { }); return; } - if (EconHandler.getEconHandler() != null) { + if (econHandler != null) { PlotArea area = player.getApplicablePlotArea(); if (area != null) { Expression priceEval = area.getPrices().get(cmd.getFullId()); Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; - if (price != 0d && EconHandler.getEconHandler().getMoney(player) < price) { + if (price != 0d && econHandler.getMoney(player) < price) { if (failure != null) { failure.run(); } @@ -267,14 +262,14 @@ public class MainCommand extends Command { if ("f".equals(args[0].substring(1))) { confirm = new RunnableVal3() { @Override public void run(Command cmd, Runnable success, Runnable failure) { - if (EconHandler.getEconHandler() != null) { + if (PlotSquared.platform().getEconHandler() != null) { PlotArea area = player.getApplicablePlotArea(); if (area != null) { Expression priceEval = area.getPrices().get(cmd.getFullId()); Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; if (price != 0d - && EconHandler.getEconHandler().getMoney(player) < price) { + && PlotSquared.platform().getEconHandler().getMoney(player) < price) { if (failure != null) { failure.run(); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Merge.java b/Core/src/main/java/com/plotsquared/core/command/Merge.java index 148b2c137..49d275246 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Merge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Merge.java @@ -42,8 +42,8 @@ import com.plotsquared.core.util.Expression; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.UUID; @@ -63,7 +63,7 @@ public class Merge extends SubCommand { private final EventDispatcher eventDispatcher; private final EconHandler econHandler; - @Inject public Merge(@NotNull final EventDispatcher eventDispatcher, + @Inject public Merge(@Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) { this.eventDispatcher = eventDispatcher; this.econHandler = econHandler; diff --git a/Core/src/main/java/com/plotsquared/core/command/Move.java b/Core/src/main/java/com/plotsquared/core/command/Move.java index aa5cc7afa..2ae527f54 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Move.java +++ b/Core/src/main/java/com/plotsquared/core/command/Move.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; @@ -35,7 +36,7 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.concurrent.CompletableFuture; @@ -49,7 +50,7 @@ public class Move extends SubCommand { private final PlotAreaManager plotAreaManager; - public Move(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public Move(@Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; } 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 989393fff..e3ee4afeb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Music.java +++ b/Core/src/main/java/com/plotsquared/core/command/Music.java @@ -39,7 +39,7 @@ import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.MusicFlag; import com.plotsquared.core.util.InventoryUtil; import com.sk89q.worldedit.world.item.ItemTypes; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collection; 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 02e8c45c9..c4b0938fb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Owner.java +++ b/Core/src/main/java/com/plotsquared/core/command/Owner.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; @@ -37,7 +38,7 @@ import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Set; import java.util.UUID; @@ -56,7 +57,7 @@ public class Owner extends SetCommand { private final EventDispatcher eventDispatcher; - public Owner(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Owner(@Nonnull final EventDispatcher eventDispatcher) { this.eventDispatcher = eventDispatcher; } diff --git a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java index 67f498c67..60925ccbd 100644 --- a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java @@ -40,7 +40,7 @@ import com.plotsquared.core.util.task.TaskManager; public class PluginCmd extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - TaskManager.IMP.taskAsync(() -> { + TaskManager.getImplementation().taskAsync(() -> { MainUtil.sendMessage(player, String.format( "$2>> $1&l" + PlotSquared.platform().getPluginName() + " $2($1Version$2: $1%s$2)", PlotSquared.get().getVersion())); 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 969ee6cd5..09c0f44ba 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Purge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Purge.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; @@ -37,7 +38,7 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.HashMap; import java.util.HashSet; @@ -58,7 +59,8 @@ public class Purge extends SubCommand { private final PlotAreaManager plotAreaManager; private final PlotListener plotListener; - public Purge(@NotNull final PlotAreaManager plotAreaManager, @NotNull final PlotListener plotListener) { + @Inject public Purge(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final PlotListener plotListener) { this.plotAreaManager = plotAreaManager; this.plotListener = plotListener; } 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 f98ecdb3b..64f21a381 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Rate.java +++ b/Core/src/main/java/com/plotsquared/core/command/Rate.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; @@ -38,11 +39,12 @@ import com.plotsquared.core.plot.PlotItemStack; import com.plotsquared.core.plot.Rating; import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.util.EventDispatcher; +import com.plotsquared.core.util.InventoryUtil; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.HashMap; @@ -59,9 +61,12 @@ import java.util.UUID; public class Rate extends SubCommand { private final EventDispatcher eventDispatcher; + private final InventoryUtil inventoryUtil; - public Rate(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Rate(@Nonnull final EventDispatcher eventDispatcher, + @Nonnull final InventoryUtil inventoryUtil) { this.eventDispatcher = eventDispatcher; + this.inventoryUtil = inventoryUtil; } @Override public boolean onCommand(final PlotPlayer player, String[] args) { @@ -143,7 +148,7 @@ public class Rate extends SubCommand { final MutableInt index = new MutableInt(0); final MutableInt rating = new MutableInt(0); String title = Settings.Ratings.CATEGORIES.get(0); - PlotInventory inventory = new PlotInventory(player, 1, title) { + PlotInventory inventory = new PlotInventory(inventoryUtil, player, 1, title) { @Override public boolean onClick(int i) { rating.add((i + 1) * Math.pow(10, index.getValue())); index.increment(); diff --git a/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java b/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java index 7ed15a943..e159e85e7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java +++ b/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java @@ -34,7 +34,7 @@ import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.util.MainUtil; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @CommandDeclaration(command = "regenallroads", description = "Regenerate all roads in the map using the set road schematic", @@ -48,8 +48,8 @@ public class RegenAllRoads extends SubCommand { private final PlotAreaManager plotAreaManager; private final HybridUtils hybridUtils; - @Inject public RegenAllRoads(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final HybridUtils hybridUtils) { + @Inject public RegenAllRoads(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final HybridUtils hybridUtils) { this.plotAreaManager = plotAreaManager; this.hybridUtils = hybridUtils; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Reload.java b/Core/src/main/java/com/plotsquared/core/command/Reload.java index 2fc3bdb9a..72ec89596 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Reload.java +++ b/Core/src/main/java/com/plotsquared/core/command/Reload.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.inject.annotations.WorldFile; @@ -36,7 +37,7 @@ import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.util.MainUtil; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.io.IOException; @@ -54,9 +55,9 @@ public class Reload extends SubCommand { private final YamlConfiguration worldConfiguration; private final File worldFile; - public Reload(@NotNull final PlotAreaManager plotAreaManager, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @WorldFile @NotNull final File worldFile) { + @Inject public Reload(@Nonnull final PlotAreaManager plotAreaManager, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @WorldFile @Nonnull final File worldFile) { this.plotAreaManager = plotAreaManager; this.worldConfiguration = worldConfiguration; this.worldFile = worldFile; diff --git a/Core/src/main/java/com/plotsquared/core/command/Remove.java b/Core/src/main/java/com/plotsquared/core/command/Remove.java index 4178668bc..b20a4da3a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Remove.java +++ b/Core/src/main/java/com/plotsquared/core/command/Remove.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.location.Location; @@ -34,7 +35,7 @@ import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.TabCompletions; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -52,7 +53,7 @@ public class Remove extends SubCommand { private final EventDispatcher eventDispatcher; - public Remove(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Remove(@Nonnull final EventDispatcher eventDispatcher) { super(Argument.PlayerName); this.eventDispatcher = eventDispatcher; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Save.java b/Core/src/main/java/com/plotsquared/core/command/Save.java index 483a29ce6..3c814c655 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Save.java +++ b/Core/src/main/java/com/plotsquared/core/command/Save.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; @@ -37,7 +38,7 @@ import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.jnbt.CompoundTag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.net.URL; import java.util.List; @@ -51,9 +52,12 @@ import java.util.UUID; public class Save extends SubCommand { private final PlotAreaManager plotAreaManager; + private final SchematicHandler schematicHandler; - public Save(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public Save(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final SchematicHandler schematicHandler) { this.plotAreaManager = plotAreaManager; + this.schematicHandler = schematicHandler; } @Override public boolean onCommand(final PlotPlayer player, final String[] args) { @@ -79,7 +83,7 @@ public class Save extends SubCommand { return false; } plot.addRunning(); - SchematicHandler.manager.getCompoundTag(plot, new RunnableVal() { + this.schematicHandler.getCompoundTag(plot, new RunnableVal() { @Override public void run(final CompoundTag value) { TaskManager.runTaskAsync(() -> { String time = (System.currentTimeMillis() / 1000) + ""; @@ -92,7 +96,7 @@ public class Save extends SubCommand { .replaceAll("[^A-Za-z0-9]", ""); final String file = time + '_' + world1 + '_' + id.x + '_' + id.y + '_' + size; UUID uuid = player.getUUID(); - SchematicHandler.manager.upload(value, uuid, file, new RunnableVal() { + schematicHandler.upload(value, uuid, file, new RunnableVal() { @Override public void run(URL url) { plot.removeRunning(); if (url == null) { 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 66e76604e..131549d76 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java @@ -42,7 +42,7 @@ import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.net.URL; import java.util.ArrayList; @@ -61,8 +61,8 @@ public class SchematicCmd extends SubCommand { private final SchematicHandler schematicHandler; private boolean running = false; - @Inject public SchematicCmd(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final SchematicHandler schematicHandler) { + @Inject public SchematicCmd(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final SchematicHandler schematicHandler) { this.plotAreaManager = plotAreaManager; this.schematicHandler = schematicHandler; } 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 3a06ca6e2..743433ad2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Set.java +++ b/Core/src/main/java/com/plotsquared/core/command/Set.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.backup.BackupManager; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; @@ -44,6 +45,7 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Arrays; @@ -67,8 +69,13 @@ public class Set extends SubCommand { public static final String[] aliases = new String[] {"b", "w", "wf", "a", "h"}; private final SetCommand component; + private final WorldUtil worldUtil; + private final GlobalBlockQueue blockQueue; - public Set() { + @Inject public Set(@Nonnull final WorldUtil worldUtil, + @Nonnull final GlobalBlockQueue blockQueue) { + this.worldUtil = worldUtil; + this.blockQueue = blockQueue; this.component = new SetCommand() { @Override public String getId() { @@ -91,7 +98,7 @@ public class Set extends SubCommand { final List forbiddenTypes = new ArrayList<>(Settings.General.INVALID_BLOCKS); if (Settings.Enabled_Components.CHUNK_PROCESSOR) { - forbiddenTypes.addAll(WorldUtil.IMP.getTileEntityTypes().stream().map( + forbiddenTypes.addAll(worldUtil.getTileEntityTypes().stream().map( BlockType::getName).collect(Collectors.toList())); } @@ -154,7 +161,7 @@ public class Set extends SubCommand { current.setComponent(component, pattern); } MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); - GlobalBlockQueue.IMP.addEmptyTask(plot::removeRunning); + blockQueue.addEmptyTask(plot::removeRunning); }); return true; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Setup.java b/Core/src/main/java/com/plotsquared/core/command/Setup.java index d61fd02da..cf412656a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Setup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Setup.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.generator.GeneratorWrapper; @@ -33,6 +34,7 @@ import com.plotsquared.core.setup.SetupProcess; import com.plotsquared.core.setup.SetupStep; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.SetupUtils; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -48,6 +50,12 @@ import java.util.Map.Entry; category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand { + private final SetupUtils setupUtils; + + @Inject public Setup(@Nonnull final SetupUtils setupUtils) { + this.setupUtils = setupUtils; + } + public void displayGenerators(PlotPlayer player) { StringBuilder message = new StringBuilder(); message.append("&6What generator do you want?"); @@ -72,7 +80,7 @@ public class Setup extends SubCommand { } process = new SetupProcess(); player.setMeta("setup", process); - SetupUtils.manager.updateGenerators(); + this.setupUtils.updateGenerators(); SetupStep step = process.getCurrentStep(); step.announce(player); displayGenerators(player); 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 ab9785a01..5e90d5a90 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Template.java +++ b/Core/src/main/java/com/plotsquared/core/command/Template.java @@ -48,7 +48,7 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.io.FileInputStream; @@ -73,12 +73,12 @@ public class Template extends SubCommand { private final GlobalBlockQueue globalBlockQueue; private final WorldUtil worldUtil; - @Inject public Template(@NotNull final PlotAreaManager plotAreaManager, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @WorldFile @NotNull final File worldFile, - @NotNull final SetupUtils setupUtils, - @NotNull final GlobalBlockQueue globalBlockQueue, - @NotNull final WorldUtil worldUtil) { + @Inject public Template(@Nonnull final PlotAreaManager plotAreaManager, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @WorldFile @Nonnull final File worldFile, + @Nonnull final SetupUtils setupUtils, + @Nonnull final GlobalBlockQueue globalBlockQueue, + @Nonnull final WorldUtil worldUtil) { this.plotAreaManager = plotAreaManager; this.worldConfiguration = worldConfiguration; this.worldFile = worldFile; 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 24d352802..8c400c95e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trim.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.location.Location; @@ -44,7 +45,7 @@ import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.HashSet; import java.util.Iterator; @@ -60,9 +61,18 @@ import java.util.Set; public class Trim extends SubCommand { private final PlotAreaManager plotAreaManager; + private final WorldUtil worldUtil; + private final GlobalBlockQueue blockQueue; + private final RegionManager regionManager; - public Trim(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public Trim(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final WorldUtil worldUtil, + @Nonnull final GlobalBlockQueue blockQueue, + @Nonnull final RegionManager regionManager) { this.plotAreaManager = plotAreaManager; + this.worldUtil = worldUtil; + this.blockQueue = blockQueue; + this.regionManager = regionManager; } private static volatile boolean TASK = false; @@ -84,7 +94,7 @@ public class Trim extends SubCommand { if (ExpireManager.IMP != null) { plots.removeAll(ExpireManager.IMP.getPendingExpired()); } - result.value1 = new HashSet<>(RegionManager.manager.getChunkChunks(world)); + result.value1 = new HashSet<>(PlotSquared.platform().getRegionManager().getChunkChunks(world)); result.value2 = new HashSet<>(); MainUtil.sendMessage(null, " - MCA #: " + result.value1.size()); MainUtil.sendMessage(null, " - CHUNKS: " + (result.value1.size() * 1024) + " (max)"); @@ -116,7 +126,7 @@ public class Trim extends SubCommand { return false; } final String world = args[0]; - if (!WorldUtil.IMP.isWorld(world) || !this.plotAreaManager.hasPlotArea(world)) { + if (!this.worldUtil.isWorld(world) || !this.plotAreaManager.hasPlotArea(world)) { MainUtil.sendMessage(player, Captions.NOT_VALID_WORLD); return false; } @@ -174,8 +184,7 @@ public class Trim extends SubCommand { } } } - final LocalBlockQueue queue = - GlobalBlockQueue.IMP.getNewQueue(world, false); + final LocalBlockQueue queue = blockQueue.getNewQueue(world, false); TaskManager.objectTask(chunks, new RunnableVal() { @Override public void run(BlockVector2 value) { queue.regenChunk(value.getX(), value.getZ()); @@ -189,7 +198,7 @@ public class Trim extends SubCommand { player.sendMessage("Trim done!"); }; } - RegionManager.manager.deleteRegionFiles(world, viable, regenTask); + regionManager.deleteRegionFiles(world, viable, regenTask); } }); diff --git a/Core/src/main/java/com/plotsquared/core/command/Trust.java b/Core/src/main/java/com/plotsquared/core/command/Trust.java index 892205f4d..a84feffc3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trust.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trust.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.PlotPlayer; @@ -35,7 +36,7 @@ import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -54,7 +55,7 @@ public class Trust extends Command { private final EventDispatcher eventDispatcher; - public Trust(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Trust(@Nonnull final EventDispatcher eventDispatcher) { super(MainCommand.getInstance(), true); this.eventDispatcher = eventDispatcher; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Unlink.java b/Core/src/main/java/com/plotsquared/core/command/Unlink.java index 424b23819..3c56e3dd3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Unlink.java +++ b/Core/src/main/java/com/plotsquared/core/command/Unlink.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.PlotUnlinkEvent; import com.plotsquared.core.events.Result; @@ -36,7 +37,7 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; @CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"}, @@ -49,7 +50,7 @@ public class Unlink extends SubCommand { private final EventDispatcher eventDispatcher; - public Unlink(@NotNull final EventDispatcher eventDispatcher) { + @Inject public Unlink(@Nonnull final EventDispatcher eventDispatcher) { this.eventDispatcher = eventDispatcher; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Visit.java b/Core/src/main/java/com/plotsquared/core/command/Visit.java index a12c0c625..5982d9337 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Visit.java +++ b/Core/src/main/java/com/plotsquared/core/command/Visit.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.events.TeleportCause; @@ -41,7 +42,7 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.SortingStrategy; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -62,17 +63,17 @@ public class Visit extends Command { private final PlotAreaManager plotAreaManager; - public Visit(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public Visit(@Nonnull final PlotAreaManager plotAreaManager) { super(MainCommand.getInstance(), true); this.plotAreaManager = plotAreaManager; } - private void visit(@NotNull final PlotPlayer player, @NotNull final PlotQuery query, final PlotArea sortByArea, + private void visit(@Nonnull final PlotPlayer player, @Nonnull final PlotQuery query, final PlotArea sortByArea, final RunnableVal3 confirm, final RunnableVal2 whenDone) { this.visit(player, query, sortByArea, confirm, whenDone, 1); } - private void visit(@NotNull final PlotPlayer player, @NotNull final PlotQuery query, final PlotArea sortByArea, + private void visit(@Nonnull final PlotPlayer player, @Nonnull final PlotQuery query, final PlotArea sortByArea, final RunnableVal3 confirm, final RunnableVal2 whenDone, int page) { // We get the query once, // then we get it another time further on diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java index 98150cc58..32d18c13b 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPreset.java @@ -30,7 +30,7 @@ import com.plotsquared.core.configuration.serialization.SerializableAs; import com.plotsquared.core.generator.ClassicPlotManagerComponent; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.HashMap; @@ -63,7 +63,7 @@ public class ComponentPreset implements ConfigurationSerializable { this.icon = icon; } - public static ComponentPreset deserialize(@NotNull final Map map) { + public static ComponentPreset deserialize(@Nonnull final Map map) { final ClassicPlotManagerComponent classicPlotManagerComponent = ClassicPlotManagerComponent .fromString(map.getOrDefault("component", "").toString()).orElseThrow(() -> new IllegalArgumentException("The preset needs a valid target component")); 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 48364b10e..d192f349d 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -44,8 +44,8 @@ import com.plotsquared.core.util.PatternUtil; import com.plotsquared.core.util.Permissions; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.item.ItemTypes; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.io.IOException; @@ -64,7 +64,7 @@ public class ComponentPresetManager { private final EconHandler econHandler; private final InventoryUtil inventoryUtil; - @Inject public ComponentPresetManager(@Nullable final EconHandler econHandler, @NotNull final + @Inject public ComponentPresetManager(@Nullable final EconHandler econHandler, @Nonnull final InventoryUtil inventoryUtil) { this.econHandler = econHandler; this.inventoryUtil = inventoryUtil; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationUtil.java b/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationUtil.java index db03b73a0..a5dd65f8e 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationUtil.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/ConfigurationUtil.java @@ -31,7 +31,9 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; -import lombok.NonNull; + +import javax.annotation.Nonnull; + /** * Main Configuration Utility @@ -104,7 +106,7 @@ public class ConfigurationUtil { @Getter private final String unknownValue; - UnknownBlockException(@NonNull final String unknownValue) { + UnknownBlockException(@Nonnull final String unknownValue) { super(String.format("\"%s\" is not a valid block", unknownValue)); this.unknownValue = unknownValue; } @@ -137,7 +139,7 @@ public class ConfigurationUtil { @Getter private final BlockState unsafeBlock; - UnsafeBlockException(@NonNull final BlockState unsafeBlock) { + UnsafeBlockException(@Nonnull final BlockState unsafeBlock) { super(String.format("%s is not a valid block", unsafeBlock)); this.unsafeBlock = unsafeBlock; } diff --git a/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java b/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java index 4f3beccc2..ab8c50282 100644 --- a/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java +++ b/Core/src/main/java/com/plotsquared/core/database/AbstractDB.java @@ -32,7 +32,7 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.task.RunnableVal; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.HashMap; import java.util.List; @@ -345,7 +345,7 @@ public interface AbstractDB { * * @param plot The Plot to get comments from */ - void getComments(@NotNull Plot plot, String inbox, RunnableVal> whenDone); + void getComments(@Nonnull Plot plot, String inbox, RunnableVal> whenDone); void createPlotAndSettings(Plot plot, Runnable whenDone); 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 f5a7636d0..22890e695 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java @@ -51,7 +51,7 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.sql.Connection; import java.sql.DatabaseMetaData; @@ -144,11 +144,11 @@ public class SQLManager implements AbstractDB { * @throws SQLException * @throws ClassNotFoundException */ - public SQLManager(@NotNull final Database database, - @NotNull final String prefix, - @NotNull final EventDispatcher eventDispatcher, - @NotNull final PlotListener plotListener, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration) + public SQLManager(@Nonnull final Database database, + @Nonnull final String prefix, + @Nonnull final EventDispatcher eventDispatcher, + @Nonnull final PlotListener plotListener, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration) throws SQLException, ClassNotFoundException { // Private final this.eventDispatcher = eventDispatcher; @@ -265,7 +265,7 @@ public class SQLManager implements AbstractDB { return this.notifyTasks; } - public synchronized void addPlotTask(@NotNull Plot plot, UniqueStatement task) { + public synchronized void addPlotTask(@Nonnull Plot plot, UniqueStatement task) { Queue tasks = this.plotTasks.get(plot); if (tasks == null) { tasks = new ConcurrentLinkedQueue<>(); @@ -2390,7 +2390,7 @@ public class SQLManager implements AbstractDB { } @Override - public void getComments(@NotNull Plot plot, final String inbox, + public void getComments(@Nonnull Plot plot, final String inbox, final RunnableVal> whenDone) { addPlotTask(plot, new UniqueStatement("getComments_" + plot) { @Override public void set(PreparedStatement statement) throws SQLException { diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java index a84bc5de0..81653ffe4 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotAutoMergeEvent.java @@ -28,7 +28,7 @@ package com.plotsquared.core.events; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotId; import lombok.Getter; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -50,8 +50,8 @@ public final class PlotAutoMergeEvent extends PlotEvent implements CancellablePl * @param plot Plot that was merged * @param plots A list of plots involved in the event */ - public PlotAutoMergeEvent(@NotNull final String world, @NotNull final Plot plot, - @NotNull final List plots) { + public PlotAutoMergeEvent(@Nonnull final String world, @Nonnull final Plot plot, + @Nonnull final List plots) { super(plot); this.world = world; this.plots = plots; 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 0e1f5eb48..10b3d6c5f 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotChangeOwnerEvent.java @@ -28,7 +28,7 @@ package com.plotsquared.core.events; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotId; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import java.util.UUID; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotEvent.java index 0b9e8801c..bec3a5bfa 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotEvent.java @@ -26,7 +26,7 @@ package com.plotsquared.core.events; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public abstract class PlotEvent { @@ -51,7 +51,7 @@ public abstract class PlotEvent { * * @return the event class name */ - @NotNull public String getEventName() { + @Nonnull public String getEventName() { if (name == null) { name = getClass().getSimpleName(); } 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 71bc2eaad..a6cbe6adc 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotMergeEvent.java @@ -30,7 +30,7 @@ import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import lombok.Getter; import lombok.Setter; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * Event called when several plots are merged @@ -53,8 +53,8 @@ public final class PlotMergeEvent extends PlotPlayerEvent implements Cancellable * @param max Max merge size * @param player The player attempting the merge */ - public PlotMergeEvent(@NotNull final String world, @NotNull final Plot plot, - @NotNull final Direction dir, final int max, PlotPlayer player) { + public PlotMergeEvent(@Nonnull final String world, @Nonnull final Plot plot, + @Nonnull final Direction dir, final int max, PlotPlayer player) { super(player, plot); this.world = world; this.dir = dir; diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java index 7bd8ec31e..0590644b7 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotRateEvent.java @@ -28,7 +28,7 @@ package com.plotsquared.core.events; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Rating; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; public class PlotRateEvent extends PlotEvent implements CancellablePlotEvent { diff --git a/Core/src/main/java/com/plotsquared/core/events/PlotUnlinkEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlotUnlinkEvent.java index 45299868f..827be63d6 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlotUnlinkEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlotUnlinkEvent.java @@ -29,7 +29,7 @@ import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import lombok.Getter; import lombok.Setter; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * Event called when several merged plots are unlinked @@ -52,7 +52,7 @@ public final class PlotUnlinkEvent extends PlotEvent implements CancellablePlotE * @param createSign Whether to regenerate signs * @param reason The {@link REASON} for the unlink */ - public PlotUnlinkEvent(@NotNull final PlotArea area, Plot plot, boolean createRoad, + public PlotUnlinkEvent(@Nonnull final PlotArea area, Plot plot, boolean createRoad, boolean createSign, REASON reason) { super(plot); this.area = area; diff --git a/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java b/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java index 73bbb157e..e672a1fdf 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java @@ -39,8 +39,8 @@ import com.plotsquared.core.util.RegionUtil; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Set; @@ -54,7 +54,7 @@ public class AugmentedUtils { enabled = true; } - public static boolean generate(@Nullable Object chunkObject, @NotNull final String world, + public static boolean generate(@Nullable Object chunkObject, @Nonnull final String world, final int chunkX, final int chunkZ, LocalBlockQueue queue) { if (!enabled) { return false; 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 69b34580b..ac6aca214 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java @@ -40,7 +40,7 @@ import com.plotsquared.core.util.RegionManager; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.block.BlockTypes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.List; import java.util.Optional; @@ -53,8 +53,8 @@ public class ClassicPlotManager extends SquarePlotManager { private final ClassicPlotWorld classicPlotWorld; private final RegionManager regionManager; - public ClassicPlotManager(@NotNull final ClassicPlotWorld classicPlotWorld, - @NotNull final RegionManager regionManager) { + public ClassicPlotManager(@Nonnull final ClassicPlotWorld classicPlotWorld, + @Nonnull final RegionManager regionManager) { super(classicPlotWorld, regionManager); this.classicPlotWorld = classicPlotWorld; this.regionManager = regionManager; diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManagerComponent.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManagerComponent.java index 3856546a5..adeb5222c 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManagerComponent.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManagerComponent.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.generator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Optional; @@ -51,7 +51,7 @@ public enum ClassicPlotManagerComponent { return stringValues; } - public static Optional fromString(@NotNull final String string) { + public static Optional fromString(@Nonnull final String string) { for (final ClassicPlotManagerComponent classicPlotManagerComponent : values()) { if (classicPlotManagerComponent.name().equalsIgnoreCase(string)) { return Optional.of(classicPlotManagerComponent); diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java index 4ea893678..a09901c2c 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java @@ -35,8 +35,8 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.EconHandler; import com.sk89q.worldedit.world.block.BlockTypes; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; @SuppressWarnings("WeakerAccess") public abstract class ClassicPlotWorld extends SquarePlotWorld { @@ -58,13 +58,13 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld { // BlockUtil.get((short) 155, (byte) 0); public boolean PLOT_BEDROCK = true; - public ClassicPlotWorld(@NotNull final String worldName, + public ClassicPlotWorld(@Nonnull final String worldName, @Nullable final String id, - @NotNull final IndependentPlotGenerator generator, - @NotNull final PlotId min, - @NotNull final PlotId max, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @NotNull final GlobalBlockQueue blockQueue, + @Nonnull final IndependentPlotGenerator generator, + @Nonnull final PlotId min, + @Nonnull final PlotId max, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @Nonnull final GlobalBlockQueue blockQueue, @Nullable final EconHandler econHandler) { super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler); } @@ -76,7 +76,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld { * command - this may be useful if a config value can be changed at a later date, and has no impact on the actual * world generation

*/ - @NotNull @Override public ConfigurationNode[] getSettingNodes() { + @Nonnull @Override public ConfigurationNode[] getSettingNodes() { return new ConfigurationNode[] { new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height", ConfigurationUtil.INTEGER), diff --git a/Core/src/main/java/com/plotsquared/core/generator/GridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/GridPlotWorld.java index 935ce6145..108796e45 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/GridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/GridPlotWorld.java @@ -31,16 +31,16 @@ import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.EconHandler; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public abstract class GridPlotWorld extends PlotArea { public short SIZE; - public GridPlotWorld(String worldName, String id, @NotNull IndependentPlotGenerator generator, - PlotId min, PlotId max, @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @NotNull final GlobalBlockQueue blockQueue, + public GridPlotWorld(String worldName, String id, @Nonnull IndependentPlotGenerator generator, + PlotId min, PlotId max, @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @Nonnull final GlobalBlockQueue blockQueue, @Nullable final EconHandler econHandler) { super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler); } diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java b/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java index c3f238470..2560981ab 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java @@ -38,13 +38,13 @@ import com.plotsquared.core.util.MathMan; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HybridGen extends IndependentPlotGenerator { private final HybridPlotWorldFactory hybridPlotWorldFactory; - @Inject public HybridGen(@NotNull final HybridPlotWorldFactory hybridPlotWorldFactory) { + @Inject public HybridGen(@Nonnull final HybridPlotWorldFactory hybridPlotWorldFactory) { this.hybridPlotWorldFactory = hybridPlotWorldFactory; } @@ -76,7 +76,7 @@ public class HybridGen extends IndependentPlotGenerator { } @Override - public void generateChunk(@NotNull ScopedLocalBlockQueue result, @NotNull PlotArea settings) { + public void generateChunk(@Nonnull ScopedLocalBlockQueue result, @Nonnull PlotArea settings) { Preconditions.checkNotNull(result, "result cannot be null"); Preconditions.checkNotNull(settings, "settings cannot be null"); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java index c517f1cd8..e7fd298a0 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java @@ -47,7 +47,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import lombok.Getter; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.io.IOException; @@ -61,8 +61,8 @@ public class HybridPlotManager extends ClassicPlotManager { @Getter private final HybridPlotWorld hybridPlotWorld; private final RegionManager regionManager; - public HybridPlotManager(@NotNull final HybridPlotWorld hybridPlotWorld, - @NotNull final RegionManager regionManager) { + public HybridPlotManager(@Nonnull final HybridPlotWorld hybridPlotWorld, + @Nonnull final RegionManager regionManager) { super(hybridPlotWorld, regionManager); this.hybridPlotWorld = hybridPlotWorld; this.regionManager = regionManager; 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 fa1e7965b..b8031bc2b 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -57,8 +57,8 @@ import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import javax.inject.Inject; import java.io.File; @@ -83,15 +83,15 @@ public class HybridPlotWorld extends ClassicPlotWorld { private final RegionManager regionManager; private final SchematicHandler schematicHandler; - @Inject public HybridPlotWorld(@Assisted final String worldName, - @Assisted final String id, - @Assisted @NotNull final IndependentPlotGenerator generator, - @Assisted final PlotId min, - @Assisted final PlotId max, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @NotNull final RegionManager regionManager, - @NotNull final SchematicHandler schematicHandler, - @NotNull final GlobalBlockQueue blockQueue, + @Inject public HybridPlotWorld(@Assisted("world") final String worldName, + @Nullable @Assisted("id") final String id, + @Assisted @Nonnull final IndependentPlotGenerator generator, + @Nullable @Assisted("min") final PlotId min, + @Nullable @Assisted("max") final PlotId max, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @Nonnull final RegionManager regionManager, + @Nonnull final SchematicHandler schematicHandler, + @Nonnull final GlobalBlockQueue blockQueue, @Nullable final EconHandler econHandler) { super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler); this.regionManager = regionManager; @@ -145,11 +145,11 @@ public class HybridPlotWorld extends ClassicPlotWorld { return BlockTransformExtent.transform(id, transform); } - @NotNull @Override protected PlotManager createManager() { + @Nonnull @Override protected PlotManager createManager() { return new HybridPlotManager(this, this.regionManager); } - public Location getSignLocation(@NotNull Plot plot) { + public Location getSignLocation(@Nonnull Plot plot) { plot = plot.getBasePlot(false); final Location bot = plot.getBottomAbs(); if (SIGN_LOCATION == null) { @@ -206,7 +206,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { } } - @Override public boolean isCompatible(@NotNull final PlotArea plotArea) { + @Override public boolean isCompatible(@Nonnull final PlotArea plotArea) { if (!(plotArea instanceof SquarePlotWorld)) { return false; } 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 cbba50067..bb5e0db42 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java @@ -63,7 +63,7 @@ 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.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.util.ArrayDeque; @@ -92,9 +92,9 @@ public class HybridUtils { private final RegionManager regionManager; private final SchematicHandler schematicHandler; - @Inject public HybridUtils(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final ChunkManager chunkManager, @NotNull final GlobalBlockQueue blockQueue, - @NotNull final WorldUtil worldUtil, @NotNull final RegionManager regionManager, @NotNull final SchematicHandler schematicHandler) { + @Inject public HybridUtils(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final ChunkManager chunkManager, @Nonnull final GlobalBlockQueue blockQueue, + @Nonnull final WorldUtil worldUtil, @Nonnull final RegionManager regionManager, @Nonnull final SchematicHandler schematicHandler) { this.plotAreaManager = plotAreaManager; this.chunkManager = chunkManager; this.blockQueue = blockQueue; diff --git a/Core/src/main/java/com/plotsquared/core/generator/SingleWorldGenerator.java b/Core/src/main/java/com/plotsquared/core/generator/SingleWorldGenerator.java index 6be1db74d..7e2f164d3 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SingleWorldGenerator.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SingleWorldGenerator.java @@ -35,7 +35,7 @@ import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockTypes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class SingleWorldGenerator extends IndependentPlotGenerator { @@ -48,7 +48,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { private final PlotAreaManager plotAreaManager; - @Inject public SingleWorldGenerator(@NotNull final PlotAreaManager plotAreaManager) { + @Inject public SingleWorldGenerator(@Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; } 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 c73d28246..41edc7603 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java @@ -34,7 +34,7 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.RegionManager; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Iterator; @@ -48,7 +48,7 @@ public abstract class SquarePlotManager extends GridPlotManager { private final SquarePlotWorld squarePlotWorld; private final RegionManager regionManager; - public SquarePlotManager(@NotNull final SquarePlotWorld squarePlotWorld, @NotNull final RegionManager regionManager) { + public SquarePlotManager(@Nonnull final SquarePlotWorld squarePlotWorld, @Nonnull final RegionManager regionManager) { super(squarePlotWorld); this.squarePlotWorld = squarePlotWorld; this.regionManager = regionManager; 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 940669fb0..3d25ae1db 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java @@ -32,8 +32,8 @@ import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.EconHandler; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public abstract class SquarePlotWorld extends GridPlotWorld { @@ -44,11 +44,11 @@ public abstract class SquarePlotWorld extends GridPlotWorld { public SquarePlotWorld(final String worldName, @Nullable final String id, - @NotNull final IndependentPlotGenerator generator, + @Nonnull final IndependentPlotGenerator generator, @Nullable final PlotId min, @Nullable final PlotId max, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @NotNull final GlobalBlockQueue blockQueue, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @Nonnull final GlobalBlockQueue blockQueue, @Nullable final EconHandler econHandler) { super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler); } diff --git a/Core/src/main/java/com/plotsquared/core/inject/annotations/BackgroundPipeline.java b/Core/src/main/java/com/plotsquared/core/inject/annotations/BackgroundPipeline.java index 28f9f0ed0..60c6f475e 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/annotations/BackgroundPipeline.java +++ b/Core/src/main/java/com/plotsquared/core/inject/annotations/BackgroundPipeline.java @@ -25,6 +25,8 @@ */ package com.plotsquared.core.inject.annotations; +import com.google.inject.BindingAnnotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,5 +34,6 @@ import java.lang.annotation.Target; @Target({ElementType.PARAMETER, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) +@BindingAnnotation public @interface BackgroundPipeline { } diff --git a/Core/src/main/java/com/plotsquared/core/inject/annotations/ConfigFile.java b/Core/src/main/java/com/plotsquared/core/inject/annotations/ConfigFile.java index 69d5bc1fd..6a8f950f8 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/annotations/ConfigFile.java +++ b/Core/src/main/java/com/plotsquared/core/inject/annotations/ConfigFile.java @@ -25,6 +25,8 @@ */ package com.plotsquared.core.inject.annotations; +import com.google.inject.BindingAnnotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,5 +34,6 @@ import java.lang.annotation.Target; @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) +@BindingAnnotation public @interface ConfigFile { } diff --git a/Core/src/main/java/com/plotsquared/core/inject/annotations/ConsoleActor.java b/Core/src/main/java/com/plotsquared/core/inject/annotations/ConsoleActor.java index 74ed7e2af..41213cc4f 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/annotations/ConsoleActor.java +++ b/Core/src/main/java/com/plotsquared/core/inject/annotations/ConsoleActor.java @@ -25,6 +25,8 @@ */ package com.plotsquared.core.inject.annotations; +import com.google.inject.BindingAnnotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,5 +34,6 @@ import java.lang.annotation.Target; @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) +@BindingAnnotation public @interface ConsoleActor { } diff --git a/Core/src/main/java/com/plotsquared/core/inject/annotations/DefaultGenerator.java b/Core/src/main/java/com/plotsquared/core/inject/annotations/DefaultGenerator.java index 69d1c0192..26060efd6 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/annotations/DefaultGenerator.java +++ b/Core/src/main/java/com/plotsquared/core/inject/annotations/DefaultGenerator.java @@ -25,6 +25,8 @@ */ package com.plotsquared.core.inject.annotations; +import com.google.inject.BindingAnnotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,5 +34,6 @@ import java.lang.annotation.Target; @Target({ElementType.PARAMETER, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) +@BindingAnnotation public @interface DefaultGenerator { } diff --git a/Core/src/main/java/com/plotsquared/core/inject/annotations/ImpromptuPipeline.java b/Core/src/main/java/com/plotsquared/core/inject/annotations/ImpromptuPipeline.java index c218b4580..76caa547e 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/annotations/ImpromptuPipeline.java +++ b/Core/src/main/java/com/plotsquared/core/inject/annotations/ImpromptuPipeline.java @@ -25,6 +25,8 @@ */ package com.plotsquared.core.inject.annotations; +import com.google.inject.BindingAnnotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,5 +34,6 @@ import java.lang.annotation.Target; @Target({ElementType.PARAMETER, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) +@BindingAnnotation public @interface ImpromptuPipeline { } diff --git a/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldConfig.java b/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldConfig.java index 115f71d48..f7aeb5d54 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldConfig.java +++ b/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldConfig.java @@ -25,6 +25,8 @@ */ package com.plotsquared.core.inject.annotations; +import com.google.inject.BindingAnnotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,5 +34,6 @@ import java.lang.annotation.Target; @Target({ElementType.PARAMETER, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) +@BindingAnnotation public @interface WorldConfig { } diff --git a/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldFile.java b/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldFile.java index 47cfc932a..4a6518a08 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldFile.java +++ b/Core/src/main/java/com/plotsquared/core/inject/annotations/WorldFile.java @@ -25,6 +25,8 @@ */ package com.plotsquared.core.inject.annotations; +import com.google.inject.BindingAnnotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,5 +34,6 @@ import java.lang.annotation.Target; @Target({ElementType.PARAMETER, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) +@BindingAnnotation public @interface WorldFile { } diff --git a/Core/src/main/java/com/plotsquared/core/inject/factory/HybridPlotWorldFactory.java b/Core/src/main/java/com/plotsquared/core/inject/factory/HybridPlotWorldFactory.java index 9dd2223dd..53c446949 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/factory/HybridPlotWorldFactory.java +++ b/Core/src/main/java/com/plotsquared/core/inject/factory/HybridPlotWorldFactory.java @@ -25,15 +25,19 @@ */ package com.plotsquared.core.inject.factory; +import com.google.inject.assistedinject.Assisted; import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.plot.PlotId; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public interface HybridPlotWorldFactory { - @NotNull HybridPlotWorld create(@NotNull String worldName, @Nullable String id, - @NotNull IndependentPlotGenerator plotGenerator, @Nullable PlotId min, @Nullable PlotId max); + @Nonnull HybridPlotWorld create(@Nonnull @Assisted("world") String worldName, + @Nullable @Assisted("id") String id, + @Nonnull IndependentPlotGenerator plotGenerator, + @Nullable @Assisted("min") PlotId min, + @Nullable @Assisted("max") PlotId max); } diff --git a/Core/src/main/java/com/plotsquared/core/inject/factory/PlayerBackupProfileFactory.java b/Core/src/main/java/com/plotsquared/core/inject/factory/PlayerBackupProfileFactory.java index b9497aa02..512a6256f 100644 --- a/Core/src/main/java/com/plotsquared/core/inject/factory/PlayerBackupProfileFactory.java +++ b/Core/src/main/java/com/plotsquared/core/inject/factory/PlayerBackupProfileFactory.java @@ -27,12 +27,12 @@ package com.plotsquared.core.inject.factory; import com.plotsquared.core.backup.PlayerBackupProfile; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.UUID; public interface PlayerBackupProfileFactory { - @NotNull PlayerBackupProfile create(@NotNull UUID uuid, @NotNull Plot plot); + @Nonnull PlayerBackupProfile create(@Nonnull UUID uuid, @Nonnull Plot plot); } diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index 46c1747aa..f01253053 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -65,7 +65,7 @@ import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import java.util.HashMap; import java.util.Iterator; 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 fb1324ad7..5d9de3ba3 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java @@ -44,7 +44,7 @@ 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.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.util.HashMap; @@ -64,7 +64,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { private Extent parent; private Map tileEntityCount = new HashMap<>(); - public ProcessedWEExtent(String world, Set mask, int max, Extent child, Extent parent, @NotNull final WorldUtil worldUtil) { + public ProcessedWEExtent(String world, Set mask, int max, Extent child, Extent parent, @Nonnull final WorldUtil worldUtil) { super(child); this.mask = mask; this.world = world; diff --git a/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java b/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java index bac7bd5ec..4ae1c5c1f 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java +++ b/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java @@ -45,7 +45,7 @@ import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.EventHandler.Priority; import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.World; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Set; @@ -54,7 +54,7 @@ public class WESubscriber { private final PlotAreaManager plotAreaManager; private final WorldUtil worldUtil; - @Inject public WESubscriber(@NotNull final PlotAreaManager plotAreaManager, @NotNull final WorldUtil worldUtil) { + @Inject public WESubscriber(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final WorldUtil worldUtil) { this.plotAreaManager = plotAreaManager; this.worldUtil = worldUtil; } diff --git a/Core/src/main/java/com/plotsquared/core/location/Location.java b/Core/src/main/java/com/plotsquared/core/location/Location.java index b3a72c237..53db29ed7 100644 --- a/Core/src/main/java/com/plotsquared/core/location/Location.java +++ b/Core/src/main/java/com/plotsquared/core/location/Location.java @@ -33,11 +33,12 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import lombok.EqualsAndHashCode; import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.khelekore.prtree.MBR; import org.khelekore.prtree.SimpleMBR; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * An unmodifiable 6-tuple (world,x,y,z,yaw,pitch) */ @@ -49,7 +50,7 @@ public final class Location implements Comparable { @Getter private final BlockVector3 blockVector3; private final World world; - private Location(@NotNull final World world, @NotNull final BlockVector3 blockVector3, + private Location(@Nonnull final World world, @Nonnull final BlockVector3 blockVector3, final float yaw, final float pitch) { this.world = Preconditions.checkNotNull(world, "World may not be null"); this.blockVector3 = Preconditions.checkNotNull(blockVector3, "Vector may not be null"); @@ -57,7 +58,7 @@ public final class Location implements Comparable { this.pitch = pitch; } - private Location(@NotNull final String worldName, @NotNull final BlockVector3 blockVector3, + private Location(@Nonnull final String worldName, @Nonnull final BlockVector3 blockVector3, final float yaw, final float pitch) { Preconditions.checkNotNull(worldName, "World name may not be null"); if (worldName.isEmpty()) { @@ -79,8 +80,8 @@ public final class Location implements Comparable { * @param pitch pitch * @return New location */ - @NotNull public static Location at(@NotNull final String world, - @NotNull final BlockVector3 blockVector3, final float yaw, final float pitch) { + @Nonnull public static Location at(@Nonnull final String world, + @Nonnull final BlockVector3 blockVector3, final float yaw, final float pitch) { return new Location(world, blockVector3, yaw, pitch); } @@ -91,8 +92,8 @@ public final class Location implements Comparable { * @param blockVector3 (x,y,z) vector * @return New location */ - @NotNull public static Location at(@NotNull final String world, - @NotNull final BlockVector3 blockVector3) { + @Nonnull public static Location at(@Nonnull final String world, + @Nonnull final BlockVector3 blockVector3) { return at(world, blockVector3, 0f, 0f); } @@ -107,7 +108,7 @@ public final class Location implements Comparable { * @param pitch Pitch * @return New location */ - @NotNull public static Location at(@NotNull final String world, final int x, final int y, + @Nonnull public static Location at(@Nonnull final String world, final int x, final int y, final int z, final float yaw, final float pitch) { return at(world, BlockVector3.at(x, y, z), yaw, pitch); } @@ -121,7 +122,7 @@ public final class Location implements Comparable { * @param z Z coordinate * @return New location */ - @NotNull public static Location at(@NotNull final String world, final int x, final int y, + @Nonnull public static Location at(@Nonnull final String world, final int x, final int y, final int z) { return at(world, BlockVector3.at(x, y, z)); } @@ -135,8 +136,8 @@ public final class Location implements Comparable { * @param pitch pitch * @return New location */ - @NotNull public static Location at(@NotNull final World world, - @NotNull final BlockVector3 blockVector3, final float yaw, final float pitch) { + @Nonnull public static Location at(@Nonnull final World world, + @Nonnull final BlockVector3 blockVector3, final float yaw, final float pitch) { return new Location(world, blockVector3, yaw, pitch); } @@ -147,8 +148,8 @@ public final class Location implements Comparable { * @param blockVector3 (x,y,z) vector * @return New location */ - @NotNull public static Location at(@NotNull final World world, - @NotNull final BlockVector3 blockVector3) { + @Nonnull public static Location at(@Nonnull final World world, + @Nonnull final BlockVector3 blockVector3) { return at(world, blockVector3, 0f, 0f); } @@ -163,7 +164,7 @@ public final class Location implements Comparable { * @param pitch Pitch * @return New location */ - @NotNull public static Location at(@NotNull final World world, final int x, final int y, + @Nonnull public static Location at(@Nonnull final World world, final int x, final int y, final int z, final float yaw, final float pitch) { return at(world, BlockVector3.at(x, y, z), yaw, pitch); } @@ -177,7 +178,7 @@ public final class Location implements Comparable { * @param z Z coordinate * @return New location */ - @NotNull public static Location at(@NotNull final World world, final int x, final int y, + @Nonnull public static Location at(@Nonnull final World world, final int x, final int y, final int z) { return at(world, BlockVector3.at(x, y, z)); } @@ -187,7 +188,7 @@ public final class Location implements Comparable { * * @return World object */ - @NotNull public World getWorld() { + @Nonnull public World getWorld() { return this.world; } @@ -196,7 +197,7 @@ public final class Location implements Comparable { * * @return World name */ - @NotNull public String getWorldName() { + @Nonnull public String getWorldName() { return this.world.getName(); } @@ -326,7 +327,7 @@ public final class Location implements Comparable { * * @return Chunk coordinates */ - @NotNull public BlockVector2 getChunkLocation() { + @Nonnull public BlockVector2 getChunkLocation() { return BlockVector2.at(this.getX() >> 4, this.getZ() >> 4); } @@ -338,7 +339,7 @@ public final class Location implements Comparable { * @param z Z offset * @return New location */ - @NotNull public Location add(final int x, final int y, final int z) { + @Nonnull public Location add(final int x, final int y, final int z) { return new Location(this.world, this.blockVector3.add(x, y, z), this.yaw, this.pitch); } @@ -348,7 +349,7 @@ public final class Location implements Comparable { * @param x New X coordinate * @return New location */ - @NotNull public Location withX(final int x) { + @Nonnull public Location withX(final int x) { return new Location(this.world, this.blockVector3.withX(x), this.yaw, this.pitch); } @@ -358,7 +359,7 @@ public final class Location implements Comparable { * @param y New Y coordinate * @return New location */ - @NotNull public Location withY(final int y) { + @Nonnull public Location withY(final int y) { return new Location(this.world, this.blockVector3.withY(y), this.yaw, this.pitch); } @@ -368,7 +369,7 @@ public final class Location implements Comparable { * @param z New Z coordinate * @return New location */ - @NotNull public Location withZ(final int z) { + @Nonnull public Location withZ(final int z) { return new Location(this.world, this.blockVector3.withZ(z), this.yaw, this.pitch); } @@ -378,7 +379,7 @@ public final class Location implements Comparable { * @param yaw New yaw * @return New location */ - @NotNull public Location withYaw(final float yaw) { + @Nonnull public Location withYaw(final float yaw) { return new Location(this.world, this.blockVector3, yaw, this.pitch); } @@ -388,7 +389,7 @@ public final class Location implements Comparable { * @param pitch New pitch * @return New location */ - @NotNull public Location withPitch(final float pitch) { + @Nonnull public Location withPitch(final float pitch) { return new Location(this.world, this.blockVector3, this.yaw, pitch); } @@ -398,18 +399,18 @@ public final class Location implements Comparable { * @param world New world * @return New location */ - @NotNull public Location withWorld(@NotNull final String world) { + @Nonnull public Location withWorld(@Nonnull final String world) { return new Location(world, this.blockVector3, this.yaw, this.pitch); } - public double getEuclideanDistanceSquared(@NotNull final Location l2) { + public double getEuclideanDistanceSquared(@Nonnull final Location l2) { double x = getX() - l2.getX(); double y = getY() - l2.getY(); double z = getZ() - l2.getZ(); return x * x + y * y + z * z; } - public double getEuclideanDistance(@NotNull final Location l2) { + public double getEuclideanDistance(@Nonnull final Location l2) { return Math.sqrt(getEuclideanDistanceSquared(l2)); } @@ -421,7 +422,7 @@ public final class Location implements Comparable { * @param z Z offset * @return New location */ - @NotNull public Location subtract(int x, int y, int z) { + @Nonnull public Location subtract(int x, int y, int z) { return this.add(-x, -y, -z); } @@ -430,12 +431,12 @@ public final class Location implements Comparable { * * @return Minimum bounding rectangle */ - @NotNull public MBR toMBR() { + @Nonnull public MBR toMBR() { return new SimpleMBR(this.getX(), this.getX(), this.getY(), this.getY(), this.getZ(), this.getZ()); } - @Override public int compareTo(@NotNull final Location o) { + @Override public int compareTo(@Nonnull final Location o) { if (this.getX() == o.getX() && this.getY() == o.getY() || this.getZ() == o.getZ()) { return 0; } diff --git a/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java b/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java index 6181f9fad..8301f23a7 100644 --- a/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java +++ b/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java @@ -27,7 +27,7 @@ package com.plotsquared.core.location; import com.plotsquared.core.util.StringMan; import lombok.AllArgsConstructor; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; //todo better description needed diff --git a/Core/src/main/java/com/plotsquared/core/location/World.java b/Core/src/main/java/com/plotsquared/core/location/World.java index 588447dd9..2e4eb6c52 100644 --- a/Core/src/main/java/com/plotsquared/core/location/World.java +++ b/Core/src/main/java/com/plotsquared/core/location/World.java @@ -26,7 +26,7 @@ package com.plotsquared.core.location; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * PlotSquared representation of a platform world @@ -40,14 +40,14 @@ public interface World { * * @return Platform world */ - @NotNull T getPlatformWorld(); + @Nonnull T getPlatformWorld(); /** * Get the name of the world * * @return World name */ - @NotNull String getName(); + @Nonnull String getName(); /** * Get a {@link NullWorld} implementation @@ -63,11 +63,11 @@ public interface World { private NullWorld() { } - @NotNull @Override public T getPlatformWorld() { + @Nonnull @Override public T getPlatformWorld() { throw new UnsupportedOperationException("Cannot get platform world from NullWorld"); } - @Override public @NotNull String getName() { + @Override public @Nonnull String getName() { return ""; } diff --git a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java index 654678253..271a15e56 100644 --- a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java @@ -42,8 +42,8 @@ import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.UUID; @@ -53,9 +53,9 @@ public class ConsolePlayer extends PlotPlayer { private final Actor actor; - @Inject private ConsolePlayer(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final EventDispatcher eventDispatcher, - @ConsoleActor @NotNull final Actor actor, + @Inject private ConsolePlayer(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @ConsoleActor @Nonnull final Actor actor, @Nullable final EconHandler econHandler) { super(plotAreaManager, eventDispatcher, econHandler); this.actor = actor; @@ -73,7 +73,7 @@ public class ConsolePlayer extends PlotPlayer { region.getMinimumPoint().getX() + region.getMaximumPoint().getX() / 2, 0, region.getMinimumPoint().getZ() + region.getMaximumPoint().getZ() / 2); } else { - location = Location.at("world", 0, 0, 0); + location = Location.at("", 0, 0, 0); } setMeta("location", location); } @@ -94,7 +94,7 @@ public class ConsolePlayer extends PlotPlayer { return this.toActor(); } - @Override public boolean canTeleport(@NotNull Location location) { + @Override public boolean canTeleport(@Nonnull Location location) { return true; } @@ -102,7 +102,7 @@ public class ConsolePlayer extends PlotPlayer { public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { } - @NotNull @Override public Location getLocation() { + @Nonnull @Override public Location getLocation() { return this.getMeta("location"); } @@ -110,7 +110,7 @@ public class ConsolePlayer extends PlotPlayer { return getLocation(); } - @NotNull @Override public UUID getUUID() { + @Nonnull @Override public UUID getUUID() { return DBFunc.EVERYONE; } @@ -160,14 +160,14 @@ public class ConsolePlayer extends PlotPlayer { return RequiredType.CONSOLE; } - @Override public void setWeather(@NotNull PlotWeather weather) { + @Override public void setWeather(@Nonnull PlotWeather weather) { } - @Override public @NotNull GameMode getGameMode() { + @Override public @Nonnull GameMode getGameMode() { return GameModes.SPECTATOR; } - @Override public void setGameMode(@NotNull GameMode gameMode) { + @Override public void setGameMode(@Nonnull GameMode gameMode) { } @Override public void setTime(long time) { @@ -180,7 +180,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(@NotNull Location location, @NotNull ItemType id) { + @Override public void playMusic(@Nonnull Location location, @Nonnull ItemType id) { } @Override public void kick(String message) { 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 3f0fbbd30..9ce053985 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -54,9 +54,8 @@ import com.plotsquared.core.util.task.TaskManager; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.item.ItemType; -import lombok.NonNull; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.nio.ByteBuffer; import java.util.Collection; @@ -93,13 +92,13 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer private final EventDispatcher eventDispatcher; private final EconHandler econHandler; - public PlotPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) { + public PlotPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) { this.plotAreaManager = plotAreaManager; this.eventDispatcher = eventDispatcher; this.econHandler = econHandler; } - public static PlotPlayer from(@NonNull final T object) { + public static PlotPlayer from(@Nonnull final T object) { if (!converters.containsKey(object.getClass())) { throw new IllegalArgumentException(String .format("There is no registered PlotPlayer converter for type %s", @@ -108,7 +107,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer return converters.get(object.getClass()).convert(object); } - public static void registerConverter(@NonNull final Class clazz, + public static void registerConverter(@Nonnull final Class clazz, final PlotPlayerConverter converter) { converters.put(clazz, converter); } @@ -117,7 +116,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer return Collections.unmodifiableCollection(debugModeEnabled); } - public static Collection> getDebugModePlayersInPlot(@NotNull final Plot plot) { + public static Collection> getDebugModePlayersInPlot(@Nonnull final Plot plot) { if (debugModeEnabled.isEmpty()) { return Collections.emptyList(); } @@ -376,7 +375,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer * * @return The location */ - @NotNull public Location getLocation() { + @Nonnull public Location getLocation() { Location location = getMeta("location"); if (location != null) { return location; @@ -403,9 +402,9 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer * * @return UUID */ - @Override @NotNull public abstract UUID getUUID(); + @Override @Nonnull public abstract UUID getUUID(); - public boolean canTeleport(@NotNull final Location location) { + public boolean canTeleport(@Nonnull final Location location) { Preconditions.checkNotNull(location, "Specified location cannot be null"); final Location current = getLocationFull(); teleport(location); @@ -497,21 +496,21 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer * * @param weather the weather visible to the player */ - public abstract void setWeather(@NotNull PlotWeather weather); + public abstract void setWeather(@Nonnull PlotWeather weather); /** * Get this player's gamemode. * * @return the gamemode of the player. */ - public abstract @NotNull GameMode getGameMode(); + public abstract @Nonnull GameMode getGameMode(); /** * Set this player's gameMode. * * @param gameMode the gamemode to set */ - public abstract void setGameMode(@NotNull GameMode gameMode); + public abstract void setGameMode(@Nonnull GameMode gameMode); /** * Set this player's local time (ticks). @@ -540,7 +539,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer * @param location where to play the music * @param id the record item id */ - public abstract void playMusic(@NotNull Location location, @NotNull ItemType id); + public abstract void playMusic(@Nonnull Location location, @Nonnull ItemType id); /** * Check if this player is banned. 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 b5a6250ab..f467c595f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java +++ b/Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java @@ -38,8 +38,9 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import lombok.EqualsAndHashCode; import lombok.Getter; -import lombok.NonNull; + import lombok.RequiredArgsConstructor; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Map; @@ -81,28 +82,28 @@ public final class BlockBucket implements ConfigurationSerializable { this.input = new StringBuilder(); } - public static BlockBucket withSingle(@NonNull final BlockState block) { + public static BlockBucket withSingle(@Nonnull final BlockState block) { final BlockBucket blockBucket = new BlockBucket(); blockBucket.addBlock(block, 100); return blockBucket; } - public static BlockBucket deserialize(@NonNull final Map map) { + public static BlockBucket deserialize(@Nonnull final Map map) { if (!map.containsKey("blocks")) { return null; } return ConfigurationUtil.BLOCK_BUCKET.parseString(map.get("blocks").toString()); } - public void addBlock(@NonNull final BlockState block) { + public void addBlock(@Nonnull final BlockState block) { this.addBlock(block, -1); } - public void addBlock(@NonNull final BlockState block, final int chance) { + public void addBlock(@Nonnull final BlockState block, final int chance) { addBlock(block, (double) chance); } - private void addBlock(@NonNull final BlockState block, double chance) { + private void addBlock(@Nonnull final BlockState block, double chance) { if (chance == -1) chance = 1; String prefix = input.length() == 0 ? "" : ","; 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 2f5048964..885078f06 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -75,8 +75,8 @@ import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.awt.geom.Area; import java.awt.geom.PathIterator; @@ -126,7 +126,7 @@ public class Plot { private static Set connected_cache; private static Set regions_cache; - @NotNull private final PlotId id; + @Nonnull private final PlotId id; // These will be injected @Inject private EventDispatcher eventDispatcher; @@ -207,7 +207,7 @@ public class Plot { * @param owner the plot owner * @see Plot#getPlot(Location) for existing plots */ - public Plot(final PlotArea area, @NotNull final PlotId id, final UUID owner) { + public Plot(final PlotArea area, @Nonnull final PlotId id, final UUID owner) { this(area, id, owner, 0); } @@ -219,7 +219,7 @@ public class Plot { * @param id the plot id * @see Plot#getPlot(Location) for existing plots */ - public Plot(@NotNull final PlotArea area, @NotNull final PlotId id) { + public Plot(@Nonnull final PlotArea area, @Nonnull final PlotId id) { this(area, id, null, 0); } @@ -234,7 +234,7 @@ public class Plot { * @param temp Represents whatever the database manager needs it to * @see Plot#getPlot(Location) for existing plots */ - public Plot(final PlotArea area, @NotNull final PlotId id, final UUID owner, final int temp) { + public Plot(final PlotArea area, @Nonnull final PlotId id, final UUID owner, final int temp) { this.area = area; this.id = id; this.owner = owner; @@ -253,7 +253,7 @@ public class Plot { * @param merged an array giving merged plots * @see Plot#getPlot(Location) for existing plots */ - public Plot(@NotNull PlotId id, UUID owner, HashSet trusted, HashSet members, + public Plot(@Nonnull PlotId id, UUID owner, HashSet trusted, HashSet members, HashSet denied, String alias, BlockLoc position, Collection> flags, PlotArea area, boolean[] merged, long timestamp, int temp) { this.id = id; @@ -440,7 +440,7 @@ public class Plot { * @param uuid the player uuid * @return if the provided uuid is the owner of the plot */ - public boolean isOwner(@NotNull UUID uuid) { + public boolean isOwner(@Nonnull UUID uuid) { if (uuid.equals(this.getOwner())) { return true; } @@ -569,7 +569,7 @@ public class Plot { * * @return the PlotId for this plot */ - @NotNull public PlotId getId() { + @Nonnull public PlotId getId() { return this.id; } @@ -1079,7 +1079,7 @@ public class Plot { * * @param name name */ - public void setSign(@NotNull String name) { + public void setSign(@Nonnull String name) { if (!isLoaded()) { return; } @@ -1733,7 +1733,7 @@ public class Plot { return this.create(this.owner, true); } - public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic) { + public boolean claim(@Nonnull final PlotPlayer player, boolean teleport, String schematic) { if (!canClaim(player)) { PlotSquared.debug(Captions.PREFIX.getTranslated() + String .format("Player %s attempted to claim plot %s, but was not allowed", @@ -1743,7 +1743,7 @@ public class Plot { return claim(player, teleport, schematic, true); } - public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic, + public boolean claim(@Nonnull final PlotPlayer player, boolean teleport, String schematic, boolean updateDB) { if (updateDB) { @@ -1804,7 +1804,7 @@ public class Plot { * @param notify notify * @return true if plot was created successfully */ - public boolean create(@NotNull UUID uuid, final boolean notify) { + public boolean create(@Nonnull UUID uuid, final boolean notify) { this.setOwnerAbs(uuid); Plot existing = this.area.getOwnedPlotAbs(this.id); if (existing != null) { @@ -2366,7 +2366,7 @@ public class Plot { * * @param player the claiming player */ - public boolean canClaim(@NotNull PlotPlayer player) { + public boolean canClaim(@Nonnull PlotPlayer player) { PlotCluster cluster = this.getCluster(); if (cluster != null) { if (!cluster.isAdded(player.getUUID()) && !Permissions @@ -2758,7 +2758,7 @@ public class Plot { * * @return */ - @NotNull public Set getRegions() { + @Nonnull public Set getRegions() { if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) { return regions_cache; } @@ -2923,7 +2923,7 @@ public class Plot { }, 1); } - public void debug(@NotNull final String message) { + public void debug(@Nonnull final String message) { try { final Collection> players = PlotPlayer.getDebugModePlayersInPlot(this); if (players.isEmpty()) { 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 920b9b650..86bb07791 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -66,8 +66,8 @@ import com.sk89q.worldedit.world.gamemode.GameModes; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -88,13 +88,13 @@ import java.util.function.Consumer; public abstract class PlotArea { protected final ConcurrentHashMap plots = new ConcurrentHashMap<>(); - @Getter @NotNull private final String worldName; + @Getter @Nonnull private final String worldName; @Getter private final String id; - @Getter @NotNull private final PlotManager plotManager; + @Getter @Nonnull private final PlotManager plotManager; @Getter private final int worldHash; private final PlotId min; private final PlotId max; - @Getter @NotNull private final IndependentPlotGenerator generator; + @Getter @Nonnull private final IndependentPlotGenerator generator; @Getter private int maxPlotMembers = 128; @Getter private boolean autoMerge = false; @Setter private boolean allowSigns = true; @@ -139,11 +139,11 @@ public abstract class PlotArea { private final GlobalBlockQueue globalBlockQueue; private final EconHandler econHandler; - public PlotArea(@NotNull final String worldName, @Nullable final String id, - @NotNull IndependentPlotGenerator generator, @Nullable final PlotId min, + public PlotArea(@Nonnull final String worldName, @Nullable final String id, + @Nonnull IndependentPlotGenerator generator, @Nullable final PlotId min, @Nullable final PlotId max, @WorldConfig @Nullable final YamlConfiguration worldConfiguration, - @NotNull final GlobalBlockQueue blockQueue, + @Nonnull final GlobalBlockQueue blockQueue, @Nullable final EconHandler econHandler) { this.worldName = worldName; this.id = id; @@ -166,7 +166,7 @@ public abstract class PlotArea { this.econHandler = econHandler; } - @NotNull protected abstract PlotManager createManager(); + @Nonnull protected abstract PlotManager createManager(); public LocalBlockQueue getQueue(final boolean autoQueue) { return this.globalBlockQueue.getNewQueue(worldName, autoQueue); @@ -246,7 +246,7 @@ public abstract class PlotArea { * @param plotArea the {@code PlotArea} to compare * @return true if both areas are compatible */ - public boolean isCompatible(@NotNull final PlotArea plotArea) { + public boolean isCompatible(@Nonnull final PlotArea plotArea) { final ConfigurationSection section = this.worldConfiguration.getConfigurationSection("worlds"); for (ConfigurationNode setting : plotArea.getSettingNodes()) { Object constant = section.get(plotArea.worldName + '.' + setting.getConstant()); @@ -489,7 +489,7 @@ public abstract class PlotArea { } } - @NotNull @Override public String toString() { + @Nonnull @Override public String toString() { if (this.getId() == null) { return this.getWorldName(); } else { @@ -517,7 +517,7 @@ public abstract class PlotArea { * @param location the location * @return the {@code Plot} or null if none exists */ - @Nullable public Plot getPlotAbs(@NotNull final Location location) { + @Nullable public Plot getPlotAbs(@Nonnull final Location location) { final PlotId pid = this.getPlotManager().getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -532,7 +532,7 @@ public abstract class PlotArea { * @param location the location * @return base Plot */ - @Nullable public Plot getPlot(@NotNull final Location location) { + @Nullable public Plot getPlot(@Nonnull final Location location) { final PlotId pid = this.getPlotManager().getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -547,7 +547,7 @@ public abstract class PlotArea { * @param location the location * @return the base plot or null */ - @Nullable public Plot getOwnedPlot(@NotNull final Location location) { + @Nullable public Plot getOwnedPlot(@Nonnull final Location location) { final PlotId pid = this.getPlotManager().getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -563,7 +563,7 @@ public abstract class PlotArea { * @param location the location * @return Plot or null */ - @Nullable public Plot getOwnedPlotAbs(@NotNull final Location location) { + @Nullable public Plot getOwnedPlotAbs(@Nonnull final Location location) { final PlotId pid = this.getPlotManager().getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -578,11 +578,11 @@ public abstract class PlotArea { * @param id the {@code PlotId} * @return the plot or null */ - @Nullable public Plot getOwnedPlotAbs(@NotNull final PlotId id) { + @Nullable public Plot getOwnedPlotAbs(@Nonnull final PlotId id) { return this.plots.get(id); } - @Nullable public Plot getOwnedPlot(@NotNull final PlotId id) { + @Nullable public Plot getOwnedPlot(@Nonnull final PlotId id) { Plot plot = this.plots.get(id); return plot == null ? null : plot.getBasePlot(false); } @@ -591,17 +591,17 @@ public abstract class PlotArea { return this.getType() != PlotAreaType.PARTIAL || RegionUtil.contains(getRegionAbs(), x, z); } - public boolean contains(@NotNull final PlotId id) { + public boolean contains(@Nonnull final PlotId id) { return this.min == null || (id.x >= this.min.x && id.x <= this.max.x && id.y >= this.min.y && id.y <= this.max.y); } - public boolean contains(@NotNull final Location location) { + public boolean contains(@Nonnull final Location location) { return StringMan.isEqual(location.getWorldName(), this.getWorldName()) && ( getRegionAbs() == null || this.region.contains(location.getBlockVector3())); } - @NotNull public Set getPlotsAbs(final UUID uuid) { + @Nonnull public Set getPlotsAbs(final UUID uuid) { if (uuid == null) { return Collections.emptySet(); } @@ -614,7 +614,7 @@ public abstract class PlotArea { return myPlots; } - @NotNull public Set getPlots(@NotNull final UUID uuid) { + @Nonnull public Set getPlots(@Nonnull final UUID uuid) { return getPlots().stream().filter(plot -> plot.isBasePlot() && plot.isOwner(uuid)) .collect(ImmutableSet.toImmutableSet()); } @@ -628,7 +628,7 @@ public abstract class PlotArea { return this.plots.values(); } - public int getPlotCount(@NotNull final UUID uuid) { + public int getPlotCount(@Nonnull final UUID uuid) { if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { return (int) getPlotsAbs(uuid).stream().filter(plot -> !DoneFlag.isDone(plot)).count(); } @@ -640,11 +640,11 @@ public abstract class PlotArea { * * @deprecated Use {@link #getPlots(UUID)} */ - @Deprecated public Set getPlots(@NotNull final PlotPlayer player) { + @Deprecated public Set getPlots(@Nonnull final PlotPlayer player) { return getPlots(player.getUUID()); } - public boolean hasPlot(@NotNull final UUID uuid) { + public boolean hasPlot(@Nonnull final UUID uuid) { return this.plots.entrySet().stream().anyMatch(entry -> entry.getValue().isOwner(uuid)); } @@ -654,7 +654,7 @@ public abstract class PlotArea { return player != null ? getPlotCount(player.getUUID()) : 0; } - @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { + @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -666,7 +666,7 @@ public abstract class PlotArea { return plot; } - @Nullable public Plot getPlot(@NotNull final PlotId id) { + @Nullable public Plot getPlot(@Nonnull final PlotId id) { final Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -687,7 +687,7 @@ public abstract class PlotArea { return this.plots.size(); } - @Nullable public PlotCluster getCluster(@NotNull final Location location) { + @Nullable public PlotCluster getCluster(@Nonnull final Location location) { final Plot plot = getPlot(location); if (plot == null) { return null; @@ -696,8 +696,8 @@ public abstract class PlotArea { } @Nullable - public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1, - @NotNull final PlotId pos2) { + public PlotCluster getFirstIntersectingCluster(@Nonnull final PlotId pos1, + @Nonnull final PlotId pos2) { if (this.clusters == null) { return null; } @@ -709,7 +709,7 @@ public abstract class PlotArea { return null; } - @Nullable PlotCluster getCluster(@NotNull final PlotId id) { + @Nullable PlotCluster getCluster(@Nonnull final PlotId id) { return this.clusters != null ? this.clusters.get(id.x, id.y) : null; } @@ -718,14 +718,14 @@ public abstract class PlotArea { *
* For persistent metadata use the flag system */ - public void setMeta(@NotNull final String key, @Nullable final Object value) { + public void setMeta(@Nonnull final String key, @Nullable final Object value) { if (this.meta == null) { this.meta = new ConcurrentHashMap<>(); } this.meta.put(key, value); } - @NotNull public T getMeta(@NotNull final String key, @NotNull final T def) { + @Nonnull public T getMeta(@Nonnull final String key, @Nonnull final T def) { final Object v = getMeta(key); return v == null ? def : (T) v; } @@ -735,14 +735,14 @@ public abstract class PlotArea { *
* For persistent metadata use the flag system */ - @Nullable public Object getMeta(@NotNull final String key) { + @Nullable public Object getMeta(@Nonnull final String key) { if (this.meta != null) { return this.meta.get(key); } return null; } - @SuppressWarnings("unused") @NotNull public Set getBasePlots() { + @SuppressWarnings("unused") @Nonnull public Set getBasePlots() { final HashSet myPlots = new HashSet<>(getPlots()); myPlots.removeIf(plot -> !plot.isBasePlot()); return myPlots; @@ -775,15 +775,15 @@ public abstract class PlotArea { * @deprecated Use {@link #getPlotsMap()} */ //todo eventually remove - @Deprecated @NotNull public Map getPlotsRaw() { + @Deprecated @Nonnull public Map getPlotsRaw() { return ImmutableMap.copyOf(plots); } - @NotNull public Set> getPlotEntries() { + @Nonnull public Set> getPlotEntries() { return this.plots.entrySet(); } - public boolean addPlot(@NotNull final Plot plot) { + public boolean addPlot(@Nonnull final Plot plot) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); } @@ -821,7 +821,7 @@ public abstract class PlotArea { return null; } - public boolean addPlotIfAbsent(@NotNull final Plot plot) { + public boolean addPlotIfAbsent(@Nonnull final Plot plot) { if (this.plots.putIfAbsent(plot.getId(), plot) == null) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); @@ -831,7 +831,7 @@ public abstract class PlotArea { return false; } - public boolean addPlotAbs(@NotNull final Plot plot) { + public boolean addPlotAbs(@Nonnull final Plot plot) { return this.plots.put(plot.getId(), plot) == null; } @@ -876,14 +876,14 @@ public abstract class PlotArea { * * @param key Meta data key */ - public void deleteMeta(@NotNull final String key) { + public void deleteMeta(@Nonnull final String key) { if (this.meta != null) { this.meta.remove(key); } } - public boolean canClaim(@Nullable final PlotPlayer player, @NotNull final PlotId pos1, - @NotNull final PlotId pos2) { + public boolean canClaim(@Nullable final PlotPlayer player, @Nonnull final PlotId pos1, + @Nonnull final PlotId pos2) { if (pos1.x == pos2.x && pos1.y == pos2.y) { if (getOwnedPlot(pos1) != null) { return false; @@ -909,11 +909,11 @@ public abstract class PlotArea { return true; } - public boolean removePlot(@NotNull final PlotId id) { + public boolean removePlot(@Nonnull final PlotId id) { return this.plots.remove(id) != null; } - public boolean mergePlots(@NotNull final List plotIds, final boolean removeRoads) { + public boolean mergePlots(@Nonnull final List plotIds, final boolean removeRoads) { if (plotIds.size() < 2) { return false; } @@ -986,7 +986,7 @@ public abstract class PlotArea { * @param pos2 second corner of selection * @return the plots in the selection which are owned */ - public Set getPlotSelectionOwned(@NotNull final PlotId pos1, @NotNull final PlotId pos2) { + public Set getPlotSelectionOwned(@Nonnull final PlotId pos1, @Nonnull final PlotId pos2) { final int size = (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); final Set result = new HashSet<>(); if (size < 16 || size < getPlotCount()) { @@ -1048,7 +1048,7 @@ public abstract class PlotArea { * @param schematic the schematic to look for. * @return true if the schematic exists, false otherwise. */ - public boolean hasSchematic(@NotNull String schematic) { + public boolean hasSchematic(@Nonnull String schematic) { return getSchematics().contains(schematic.toLowerCase()); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java b/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java index 917259ef6..ea7484129 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java @@ -31,7 +31,7 @@ import com.plotsquared.core.location.Location; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.RegionUtil; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.HashSet; import java.util.UUID; @@ -152,7 +152,7 @@ public class PlotCluster { + this.pos2.y; } - public void getHome(@NotNull final Consumer result) { + public void getHome(@Nonnull final Consumer result) { final BlockLoc home = this.settings.getPosition(); Consumer locationConsumer = toReturn -> MainUtil.getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(), diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotId.java b/Core/src/main/java/com/plotsquared/core/plot/PlotId.java index 41016da1f..3327c1473 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotId.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotId.java @@ -26,8 +26,8 @@ package com.plotsquared.core.plot; import com.plotsquared.core.location.Direction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public class PlotId { @@ -53,14 +53,14 @@ public class PlotId { * @return the PlotId representation of the arguement * @throws IllegalArgumentException if the string does not contain a valid PlotId */ - @NotNull public static PlotId fromString(@NotNull String string) { + @Nonnull public static PlotId fromString(@Nonnull String string) { PlotId plot = fromStringOrNull(string); if (plot == null) throw new IllegalArgumentException("Cannot create PlotID. String invalid."); return plot; } - @Nullable public static PlotId fromStringOrNull(@NotNull String string) { + @Nullable public static PlotId fromStringOrNull(@Nonnull String string) { String[] parts = string.split("[;,.]"); if (parts.length < 2) { return null; diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java b/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java index 3ef2f1c74..df6155b4e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java @@ -28,8 +28,8 @@ package com.plotsquared.core.plot; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.InventoryUtil; -import lombok.NonNull; -import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; public class PlotInventory { @@ -41,7 +41,8 @@ public class PlotInventory { private boolean open = false; private final InventoryUtil inventoryUtil; - public PlotInventory(@NotNull final InventoryUtil inventoryUtil, PlotPlayer player, int size, String name) { + public PlotInventory(@Nonnull final InventoryUtil inventoryUtil, + PlotPlayer player, int size, String name) { this.size = size; this.title = name == null ? "" : name; this.player = player; @@ -49,20 +50,20 @@ public class PlotInventory { this.inventoryUtil = inventoryUtil; } - public static boolean hasPlotInventoryOpen(@NonNull final PlotPlayer plotPlayer) { + public static boolean hasPlotInventoryOpen(@Nonnull final PlotPlayer plotPlayer) { return getOpenPlotInventory(plotPlayer) != null; } - public static PlotInventory getOpenPlotInventory(@NonNull final PlotPlayer plotPlayer) { + public static PlotInventory getOpenPlotInventory(@Nonnull final PlotPlayer plotPlayer) { return plotPlayer.getMeta(META_KEY, null); } - public static void setPlotInventoryOpen(@NonNull final PlotPlayer plotPlayer, - @NonNull final PlotInventory plotInventory) { + public static void setPlotInventoryOpen(@Nonnull final PlotPlayer plotPlayer, + @Nonnull final PlotInventory plotInventory) { plotPlayer.setMeta(META_KEY, plotInventory); } - public static void removePlotInventoryOpen(@NonNull final PlotPlayerplotPlayer) { + public static void removePlotInventoryOpen(@Nonnull final PlotPlayerplotPlayer) { plotPlayer.deleteMeta(META_KEY); } 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 ed7b854c2..76f9d4c9f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java @@ -28,8 +28,8 @@ package com.plotsquared.core.plot; import com.plotsquared.core.location.Location; import com.sk89q.worldedit.regions.CuboidRegion; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Collection; @@ -46,7 +46,7 @@ public abstract class PlotWorld { * * @param world World name */ - protected PlotWorld(@NotNull final String world) { + protected PlotWorld(@Nonnull final String world) { this.world = world; } @@ -57,14 +57,14 @@ public abstract class PlotWorld { * @param location Location * @return Containing plot area, or null */ - @Nullable public abstract PlotArea getArea(@NotNull final Location location); + @Nullable public abstract PlotArea getArea(@Nonnull final Location location); /** * Get all plot areas in the world * * @return All plot areas in the world */ - @NotNull public abstract Collection getAreas(); + @Nonnull public abstract Collection getAreas(); /** * Get all plot areas in a specified region @@ -72,15 +72,15 @@ public abstract class PlotWorld { * @param region Region * @return All areas in the region */ - @NotNull public abstract Collection getAreasInRegion( - @NotNull final CuboidRegion region); + @Nonnull public abstract Collection getAreasInRegion( + @Nonnull final CuboidRegion region); /** * Register a new area in the world * * @param area Plot area */ - public void addArea(@NotNull final PlotArea area) { + public void addArea(@Nonnull final PlotArea area) { throw new UnsupportedOperationException("This world type does not allow adding new areas"); } @@ -89,7 +89,7 @@ public abstract class PlotWorld { * * @param area Plot area */ - public void removeArea(@NotNull final PlotArea area) { + public void removeArea(@Nonnull final PlotArea area) { throw new UnsupportedOperationException("This world type does not allow removing areas"); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java index 6eba78367..6448a1b6c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java @@ -48,7 +48,7 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayDeque; import java.util.ArrayList; @@ -76,7 +76,7 @@ public class ExpireManager { */ private int running; - public ExpireManager(@NotNull final EventDispatcher eventDispatcher) { + public ExpireManager(@Nonnull final EventDispatcher eventDispatcher) { this.tasks = new ArrayDeque<>(); this.dates_cache = new ConcurrentHashMap<>(); this.account_age_cache = new ConcurrentHashMap<>(); diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java index e1802d9b7..022a3dc93 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpiryTask.java @@ -30,7 +30,7 @@ import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.util.query.PlotQuery; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -47,7 +47,7 @@ public class ExpiryTask { private final PlotAreaManager plotAreaManager; private long cutoffThreshold = Long.MIN_VALUE; - public ExpiryTask(@NotNull final Settings.Auto_Clear settings, @NotNull final PlotAreaManager plotAreaManager) { + public ExpiryTask(final Settings.Auto_Clear settings, @Nonnull final PlotAreaManager plotAreaManager) { this.settings = settings; this.plotAreaManager = plotAreaManager; } 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 e0bb40fb8..5c11a258b 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 @@ -30,8 +30,8 @@ import com.google.common.collect.ImmutableMap; import com.plotsquared.core.PlotSquared; import lombok.EqualsAndHashCode; import lombok.Setter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -284,7 +284,7 @@ import java.util.Map; * @param plotFlagUpdateHandler The update handler which will react to changes. * @see PlotFlagUpdateType Plot flag update types */ - public void subscribe(@NotNull final PlotFlagUpdateHandler plotFlagUpdateHandler) { + public void subscribe(@Nonnull final PlotFlagUpdateHandler plotFlagUpdateHandler) { this.updateSubscribers.add(plotFlagUpdateHandler); } 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 af3306b25..1007726df 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 @@ -29,7 +29,7 @@ import com.google.common.base.Preconditions; import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -55,8 +55,8 @@ import java.util.Collections; * @param flagCategory The flag category * @param flagDescription A caption describing the flag functionality */ - protected PlotFlag(@NotNull final T value, @NotNull final Caption flagCategory, - @NotNull final Caption flagDescription) { + protected PlotFlag(@Nonnull final T value, @Nonnull final Caption flagCategory, + @Nonnull final Caption flagDescription) { this.value = Preconditions.checkNotNull(value, "flag value may not be null"); this.flagCategory = Preconditions.checkNotNull(flagCategory, "flag category may not be null"); @@ -82,7 +82,7 @@ import java.util.Collections; * * @return Non-nullable flag value */ - @NotNull public final T getValue() { + @Nonnull public final T getValue() { return this.value; } @@ -95,7 +95,7 @@ import java.util.Collections; * @return Parsed value, if valid. * @throws FlagParseException If the value could not be parsed. */ - public abstract F parse(@NotNull final String input) throws FlagParseException; + public abstract F parse(@Nonnull final String input) throws FlagParseException; /** * Merge this flag's value with another value and return an instance @@ -104,7 +104,7 @@ import java.util.Collections; * @param newValue New flag value. * @return Flag containing parsed flag value. */ - public abstract F merge(@NotNull final T newValue); + public abstract F merge(@Nonnull final T newValue); /** * Returns a string representation of the flag instance, that when @@ -154,7 +154,7 @@ import java.util.Collections; */ public abstract String getExample(); - protected abstract F flagOf(@NotNull T value); + protected abstract F flagOf(@Nonnull T value); /** * Create a new instance of the flag using a provided @@ -163,7 +163,7 @@ import java.util.Collections; * @param value The flag value * @return The created flag instance */ - public final F createFlagInstance(@NotNull final T value) { + public final F createFlagInstance(@Nonnull final T value) { return flagOf(Preconditions.checkNotNull(value)); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java index 133f56df9..173d8caf2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java @@ -29,7 +29,7 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.types.ListFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -40,7 +40,7 @@ public class AnalysisFlag extends ListFlag implements Int super(valueList, Captions.NONE, Captions.NONE); } - @Override public AnalysisFlag parse(@NotNull String input) throws FlagParseException { + @Override public AnalysisFlag parse(@Nonnull String input) throws FlagParseException { final String[] split = input.split(","); final List numbers = new ArrayList<>(); for (final String element : split) { @@ -53,7 +53,7 @@ public class AnalysisFlag extends ListFlag implements Int return ""; } - @Override protected AnalysisFlag flagOf(@NotNull List value) { + @Override protected AnalysisFlag flagOf(@Nonnull List value) { return new AnalysisFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java index 1ae0abc12..8eb750aa7 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class AnimalAttackFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class AnimalAttackFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_ANIMAL_ATTACK); } - @Override protected AnimalAttackFlag flagOf(@NotNull Boolean value) { + @Override protected AnimalAttackFlag flagOf(@Nonnull Boolean value) { return value ? ANIMAL_ATTACK_TRUE : ANIMAL_ATTACK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java index 228ea94aa..78bdf65b2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class AnimalCapFlag extends NonNegativeIntegerFlag { public static final AnimalCapFlag ANIMAL_CAP_UNLIMITED = new AnimalCapFlag(Integer.MAX_VALUE); @@ -36,7 +36,7 @@ public class AnimalCapFlag extends NonNegativeIntegerFlag { super(value, Captions.FLAG_DESCRIPTION_ANIMAL_CAP); } - @Override protected AnimalCapFlag flagOf(@NotNull Integer value) { + @Override protected AnimalCapFlag flagOf(@Nonnull Integer value) { return new AnimalCapFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java index f19a479d3..00c854f88 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class AnimalInteractFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class AnimalInteractFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_ANIMAL_INTERACT); } - @Override protected AnimalInteractFlag flagOf(@NotNull Boolean value) { + @Override protected AnimalInteractFlag flagOf(@Nonnull Boolean value) { return value ? ANIMAL_INTERACT_TRUE : ANIMAL_INTERACT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java index ac50b91b3..202513067 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class BlockBurnFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class BlockBurnFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_BLOCK_BURN); } - @Override protected BlockBurnFlag flagOf(@NotNull Boolean value) { + @Override protected BlockBurnFlag flagOf(@Nonnull Boolean value) { return value ? BLOCK_BURN_TRUE : BLOCK_BURN_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java index 4a2b7e205..add18aebf 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class BlockIgnitionFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class BlockIgnitionFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_BLOCK_IGNITION); } - @Override protected BlockIgnitionFlag flagOf(@NotNull Boolean value) { + @Override protected BlockIgnitionFlag flagOf(@Nonnull Boolean value) { return value ? BLOCK_IGNITION_TRUE : BLOCK_IGNITION_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java index d5b3eeca6..1bcdb39c2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java @@ -28,7 +28,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.types.ListFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Collections; @@ -44,7 +44,7 @@ public class BlockedCmdsFlag extends ListFlag { Captions.FLAG_DESCRIPTION_BLOCKED_CMDS); } - @Override public BlockedCmdsFlag parse(@NotNull String input) throws FlagParseException { + @Override public BlockedCmdsFlag parse(@Nonnull String input) throws FlagParseException { return flagOf(Arrays.asList(input.split(","))); } @@ -52,7 +52,7 @@ public class BlockedCmdsFlag extends ListFlag { return "gamemode survival, spawn"; } - @Override protected BlockedCmdsFlag flagOf(@NotNull List value) { + @Override protected BlockedCmdsFlag flagOf(@Nonnull List value) { return new BlockedCmdsFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java index 5acf7d489..c005efe5f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java @@ -28,7 +28,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BlockTypeListFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -41,7 +41,7 @@ public class BreakFlag extends BlockTypeListFlag { super(blockTypeList, Captions.FLAG_DESCRIPTION_BREAK); } - @Override protected BreakFlag flagOf(@NotNull List value) { + @Override protected BreakFlag flagOf(@Nonnull List value) { return new BreakFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java index 81da5294a..8975375b0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class ChatFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class ChatFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_CHAT); } - @Override protected ChatFlag flagOf(@NotNull Boolean value) { + @Override protected ChatFlag flagOf(@Nonnull Boolean value) { return value ? CHAT_FLAG_TRUE : CHAT_FLAG_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java index 84e98f9d6..da501eb6c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class CoralDryFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class CoralDryFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_CORAL_DRY); } - @Override protected CoralDryFlag flagOf(@NotNull Boolean value) { + @Override protected CoralDryFlag flagOf(@Nonnull Boolean value) { return value ? CORAL_DRY_TRUE : CORAL_DRY_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java index 17fe9f0e8..107cc360d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java @@ -27,7 +27,8 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; public class DenyExitFlag extends BooleanFlag { @@ -38,7 +39,7 @@ public class DenyExitFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_DENY_EXIT); } - @Override protected DenyExitFlag flagOf(@NotNull Boolean value) { + @Override protected DenyExitFlag flagOf(@Nonnull Boolean value) { return value ? DENY_EXIT_FLAG_TRUE : DENY_EXIT_FLAG_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java index ba923c396..e02a1b0e8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java @@ -30,8 +30,8 @@ import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collection; @@ -46,7 +46,7 @@ public class DenyTeleportFlag extends PlotFlag { public static final DescriptionFlag DESCRIPTION_FLAG_EMPTY = new DescriptionFlag(""); - protected DescriptionFlag(@NotNull String value) { + protected DescriptionFlag(@Nonnull String value) { super(value, Captions.FLAG_CATEGORY_STRING, Captions.FLAG_DESCRIPTION_DESCRIPTION); } - @Override public DescriptionFlag parse(@NotNull String input) { + @Override public DescriptionFlag parse(@Nonnull String input) { return flagOf(input); } - @Override public DescriptionFlag merge(@NotNull String newValue) { + @Override public DescriptionFlag merge(@Nonnull String newValue) { return flagOf(this.getValue() + " " + newValue); } @@ -53,7 +53,7 @@ public class DescriptionFlag extends PlotFlag { return "&6This is my plot!"; } - @Override protected DescriptionFlag flagOf(@NotNull String value) { + @Override protected DescriptionFlag flagOf(@Nonnull String value) { return new DescriptionFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java index f43e1e27a..981c4bfe4 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class DeviceInteractFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class DeviceInteractFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_DEVICE_INTERACT); } - @Override protected DeviceInteractFlag flagOf(@NotNull Boolean value) { + @Override protected DeviceInteractFlag flagOf(@Nonnull Boolean value) { return value ? DEVICE_INTERACT_TRUE : DEVICE_INTERACT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java index f1d952260..a0578b1fe 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class DisablePhysicsFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class DisablePhysicsFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_DISABLE_PHYSICS); } - @Override protected DisablePhysicsFlag flagOf(@NotNull Boolean value) { + @Override protected DisablePhysicsFlag flagOf(@Nonnull Boolean value) { return value ? DISABLE_PHYSICS_TRUE : DISABLE_PHYSICS_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java index 390ae4ba7..be94170fe 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java @@ -29,7 +29,7 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class DoneFlag extends PlotFlag implements InternalFlag { @@ -38,7 +38,7 @@ public class DoneFlag extends PlotFlag implements InternalFlag * * @param value Flag value */ - public DoneFlag(@NotNull String value) { + public DoneFlag(@Nonnull String value) { super(value, Captions.NONE, Captions.NONE); } @@ -46,11 +46,11 @@ public class DoneFlag extends PlotFlag implements InternalFlag return !plot.getFlag(DoneFlag.class).isEmpty(); } - @Override public DoneFlag parse(@NotNull String input) { + @Override public DoneFlag parse(@Nonnull String input) { return flagOf(input); } - @Override public DoneFlag merge(@NotNull String newValue) { + @Override public DoneFlag merge(@Nonnull String newValue) { return flagOf(newValue); } @@ -62,7 +62,7 @@ public class DoneFlag extends PlotFlag implements InternalFlag return ""; } - @Override protected DoneFlag flagOf(@NotNull String value) { + @Override protected DoneFlag flagOf(@Nonnull String value) { return new DoneFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java index a210af66e..785d29b6e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class DropProtectionFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class DropProtectionFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_DROP_PROTECTION); } - @Override protected DropProtectionFlag flagOf(@NotNull Boolean value) { + @Override protected DropProtectionFlag flagOf(@Nonnull Boolean value) { return value ? DROP_PROTECTION_TRUE : DROP_PROTECTION_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java index e20e2dded..13b7b4d21 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class EntityCapFlag extends NonNegativeIntegerFlag { public static final EntityCapFlag ENTITY_CAP_UNLIMITED = new EntityCapFlag(Integer.MAX_VALUE); @@ -36,7 +36,7 @@ public class EntityCapFlag extends NonNegativeIntegerFlag { super(value, Captions.FLAG_DESCRIPTION_ENTITY_CAP); } - @Override protected EntityCapFlag flagOf(@NotNull Integer value) { + @Override protected EntityCapFlag flagOf(@Nonnull Integer value) { return new EntityCapFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java index 0f1f04a54..ed611d57d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class ExplosionFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class ExplosionFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_EXPLOSION); } - @Override protected ExplosionFlag flagOf(@NotNull Boolean value) { + @Override protected ExplosionFlag flagOf(@Nonnull Boolean value) { return value ? EXPLOSION_TRUE : EXPLOSION_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java index 625f41cb8..1231d64a4 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java @@ -27,21 +27,21 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class FarewellFlag extends PlotFlag { public static final FarewellFlag FAREWELL_FLAG_EMPTY = new FarewellFlag(""); - protected FarewellFlag(@NotNull String value) { + protected FarewellFlag(@Nonnull String value) { super(value, Captions.FLAG_CATEGORY_STRING, Captions.FLAG_DESCRIPTION_FAREWELL); } - @Override public FarewellFlag parse(@NotNull String input) { + @Override public FarewellFlag parse(@Nonnull String input) { return flagOf(input); } - @Override public FarewellFlag merge(@NotNull String newValue) { + @Override public FarewellFlag merge(@Nonnull String newValue) { return flagOf(this.getValue() + " " + newValue); } @@ -53,7 +53,7 @@ public class FarewellFlag extends PlotFlag { return "&cBye :("; } - @Override protected FarewellFlag flagOf(@NotNull String value) { + @Override protected FarewellFlag flagOf(@Nonnull String value) { return new FarewellFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java index 11a0cac4a..05164b8d2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java @@ -28,12 +28,12 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.types.TimedFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class FeedFlag extends TimedFlag { public static final FeedFlag FEED_NOTHING = new FeedFlag(new Timed<>(0, 0)); - public FeedFlag(@NotNull Timed value) { + public FeedFlag(@Nonnull Timed value) { super(value, 1, Captions.FLAG_DESCRIPTION_FEED); } @@ -58,7 +58,7 @@ public class FeedFlag extends TimedFlag { return "10 5"; } - @Override protected FeedFlag flagOf(@NotNull Timed value) { + @Override protected FeedFlag flagOf(@Nonnull Timed value) { return new FeedFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java index ffe72a7b4..478e17858 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Collection; @@ -42,7 +42,7 @@ public class FlyFlag extends PlotFlag { super(value, Captions.FLAG_CATEGORY_BOOLEAN, Captions.FLAG_DESCRIPTION_FLIGHT); } - @Override public FlyFlag parse(@NotNull final String input) { + @Override public FlyFlag parse(@Nonnull final String input) { switch (input.toLowerCase()) { case "true": case "enabled": @@ -57,7 +57,7 @@ public class FlyFlag extends PlotFlag { } } - @Override public FlyFlag merge(@NotNull final FlyStatus newValue) { + @Override public FlyFlag merge(@Nonnull final FlyStatus newValue) { if (newValue == FlyStatus.ENABLED || this.getValue() == FlyStatus.ENABLED) { return FLIGHT_FLAG_ENABLED; } @@ -72,7 +72,7 @@ public class FlyFlag extends PlotFlag { return "true"; } - @Override protected FlyFlag flagOf(@NotNull final FlyStatus value) { + @Override protected FlyFlag flagOf(@Nonnull final FlyStatus value) { switch (value) { case ENABLED: return FLIGHT_FLAG_ENABLED; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java index f8c985238..98136a7b3 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class ForcefieldFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class ForcefieldFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_FORCEFIELD); } - @Override protected ForcefieldFlag flagOf(@NotNull Boolean value) { + @Override protected ForcefieldFlag flagOf(@Nonnull Boolean value) { return value ? FORCEFIELD_TRUE : FORCEFIELD_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java index 60fdb4a0a..4c6b60020 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java @@ -30,7 +30,7 @@ import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class GamemodeFlag extends PlotFlag { @@ -52,11 +52,11 @@ public class GamemodeFlag extends PlotFlag { * * @param value Flag value */ - protected GamemodeFlag(@NotNull GameMode value) { + protected GamemodeFlag(@Nonnull GameMode value) { super(value, Captions.FLAG_CATEGORY_GAMEMODE, Captions.FLAG_DESCRIPTION_GAMEMODE); } - @Override public GamemodeFlag parse(@NotNull String input) throws FlagParseException { + @Override public GamemodeFlag parse(@Nonnull String input) throws FlagParseException { switch (input) { case "creative": case "c": @@ -79,7 +79,7 @@ public class GamemodeFlag extends PlotFlag { } } - @Override public GamemodeFlag merge(@NotNull GameMode newValue) { + @Override public GamemodeFlag merge(@Nonnull GameMode newValue) { return flagOf(newValue); } @@ -91,7 +91,7 @@ public class GamemodeFlag extends PlotFlag { return "survival"; } - @Override protected GamemodeFlag flagOf(@NotNull GameMode value) { + @Override protected GamemodeFlag flagOf(@Nonnull GameMode value) { switch (value.getId()) { case "creative": return GAMEMODE_FLAG_CREATIVE; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java index 7cb823667..ad63de5ee 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class GrassGrowFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class GrassGrowFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_GRASS_GROW); } - @Override protected GrassGrowFlag flagOf(@NotNull Boolean value) { + @Override protected GrassGrowFlag flagOf(@Nonnull Boolean value) { return value ? GRASS_GROW_TRUE : GRASS_GROW_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java index 0097defa8..3c6cc0163 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java @@ -27,21 +27,21 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class GreetingFlag extends PlotFlag { public static final GreetingFlag GREETING_FLAG_EMPTY = new GreetingFlag(""); - protected GreetingFlag(@NotNull String value) { + protected GreetingFlag(@Nonnull String value) { super(value, Captions.FLAG_CATEGORY_STRING, Captions.FLAG_DESCRIPTION_GREETING); } - @Override public GreetingFlag parse(@NotNull String input) { + @Override public GreetingFlag parse(@Nonnull String input) { return flagOf(input); } - @Override public GreetingFlag merge(@NotNull String newValue) { + @Override public GreetingFlag merge(@Nonnull String newValue) { return flagOf(this.getValue() + " " + newValue); } @@ -53,7 +53,7 @@ public class GreetingFlag extends PlotFlag { return "&6Welcome to my plot!"; } - @Override protected GreetingFlag flagOf(@NotNull String value) { + @Override protected GreetingFlag flagOf(@Nonnull String value) { return new GreetingFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java index 8b320200e..090b056ea 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java @@ -30,7 +30,7 @@ import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class GuestGamemodeFlag extends PlotFlag { @@ -50,11 +50,11 @@ public class GuestGamemodeFlag extends PlotFlag { * * @param value Flag value */ - protected GuestGamemodeFlag(@NotNull GameMode value) { + protected GuestGamemodeFlag(@Nonnull GameMode value) { super(value, Captions.FLAG_CATEGORY_GAMEMODE, Captions.FLAG_DESCRIPTION_GUEST_GAMEMODE); } - @Override public GuestGamemodeFlag parse(@NotNull String input) throws FlagParseException { + @Override public GuestGamemodeFlag parse(@Nonnull String input) throws FlagParseException { switch (input) { case "creative": case "c": @@ -77,7 +77,7 @@ public class GuestGamemodeFlag extends PlotFlag { } } - @Override public GuestGamemodeFlag merge(@NotNull GameMode newValue) { + @Override public GuestGamemodeFlag merge(@Nonnull GameMode newValue) { return flagOf(newValue); } @@ -89,7 +89,7 @@ public class GuestGamemodeFlag extends PlotFlag { return "survival"; } - @Override protected GuestGamemodeFlag flagOf(@NotNull GameMode value) { + @Override protected GuestGamemodeFlag flagOf(@Nonnull GameMode value) { switch (value.getId()) { case "creative": return GUEST_GAMEMODE_FLAG_CREATIVE; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java index f7a07a28a..ca7f1fb37 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HangingBreakFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class HangingBreakFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_HANGING_BREAK); } - @Override protected HangingBreakFlag flagOf(@NotNull Boolean value) { + @Override protected HangingBreakFlag flagOf(@Nonnull Boolean value) { return value ? HANGING_BREAK_TRUE : HANGING_BREAK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java index 14923a319..eb3441ee1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HangingPlaceFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class HangingPlaceFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_HANGING_PLACE); } - @Override protected HangingPlaceFlag flagOf(@NotNull Boolean value) { + @Override protected HangingPlaceFlag flagOf(@Nonnull Boolean value) { return value ? HANGING_PLACE_TRUE : HANGING_PLACE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java index 90e5fbabb..e683b82a6 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java @@ -28,12 +28,12 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.types.TimedFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HealFlag extends TimedFlag { public static final HealFlag HEAL_NOTHING = new HealFlag(new Timed<>(0, 0)); - protected HealFlag(@NotNull Timed value) { + protected HealFlag(@Nonnull Timed value) { super(value, 1, Captions.FLAG_DESCRIPTION_HEAL); } @@ -58,7 +58,7 @@ public class HealFlag extends TimedFlag { return "20 2"; } - @Override protected HealFlag flagOf(@NotNull Timed value) { + @Override protected HealFlag flagOf(@Nonnull Timed value) { return new HealFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java index d382cac8f..81d85906f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HideInfoFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class HideInfoFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_HIDE_INFO); } - @Override protected HideInfoFlag flagOf(@NotNull Boolean value) { + @Override protected HideInfoFlag flagOf(@Nonnull Boolean value) { return value ? HIDE_INFO_TRUE : HIDE_INFO_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java index 9ec805814..da5e8e4af 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HostileAttackFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class HostileAttackFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_HOSTILE_ATTACK); } - @Override protected HostileAttackFlag flagOf(@NotNull Boolean value) { + @Override protected HostileAttackFlag flagOf(@Nonnull Boolean value) { return value ? HOSTILE_ATTACK_TRUE : HOSTILE_ATTACK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java index 017e3736a..9d442bb00 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HostileCapFlag extends NonNegativeIntegerFlag { public static final HostileCapFlag HOSTILE_CAP_UNLIMITED = @@ -37,7 +37,7 @@ public class HostileCapFlag extends NonNegativeIntegerFlag { super(value, Captions.FLAG_DESCRIPTION_HOSTILE_CAP); } - @Override protected HostileCapFlag flagOf(@NotNull Integer value) { + @Override protected HostileCapFlag flagOf(@Nonnull Integer value) { return new HostileCapFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java index 96ce742b9..e903cd76c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class HostileInteractFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class HostileInteractFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_HOSTILE_INTERACT); } - @Override protected HostileInteractFlag flagOf(@NotNull Boolean value) { + @Override protected HostileInteractFlag flagOf(@Nonnull Boolean value) { return value ? HOSTILE_INTERACT_TRUE : HOSTILE_INTERACT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java index a0f54097e..b380d0773 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class IceFormFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class IceFormFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_ICE_FORM); } - @Override protected IceFormFlag flagOf(@NotNull Boolean value) { + @Override protected IceFormFlag flagOf(@Nonnull Boolean value) { return value ? ICE_FORM_TRUE : ICE_FORM_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java index 0c1bf93a6..ef97c8964 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class IceMeltFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class IceMeltFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_ICE_MELT); } - @Override protected IceMeltFlag flagOf(@NotNull Boolean value) { + @Override protected IceMeltFlag flagOf(@Nonnull Boolean value) { return value ? ICE_MELT_TRUE : ICE_MELT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java index 7c87fcff4..90d5632f1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class InstabreakFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class InstabreakFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_INSTABREAK); } - @Override protected InstabreakFlag flagOf(@NotNull Boolean value) { + @Override protected InstabreakFlag flagOf(@Nonnull Boolean value) { return value ? INSTABREAK_TRUE : INSTABREAK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java index b19e0d393..e3328a6a2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class InvincibleFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class InvincibleFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_INVINCIBLE); } - @Override protected InvincibleFlag flagOf(@NotNull Boolean value) { + @Override protected InvincibleFlag flagOf(@Nonnull Boolean value) { return value ? INVINCIBLE_TRUE : INVINCIBLE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java index 1c71be3eb..654505a38 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class ItemDropFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class ItemDropFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_ITEM_DROP); } - @Override protected ItemDropFlag flagOf(@NotNull Boolean value) { + @Override protected ItemDropFlag flagOf(@Nonnull Boolean value) { return value ? ITEM_DROP_TRUE : ITEM_DROP_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java index ce23f2510..187237f2a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java @@ -30,7 +30,7 @@ import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class KeepFlag extends PlotFlag { @@ -41,11 +41,11 @@ public class KeepFlag extends PlotFlag { * * @param value Flag value */ - protected KeepFlag(@NotNull Object value) { + protected KeepFlag(@Nonnull Object value) { super(value, Captions.FLAG_CATEGORY_MIXED, Captions.FLAG_DESCRIPTION_KEEP); } - @Override public KeepFlag parse(@NotNull String input) throws FlagParseException { + @Override public KeepFlag parse(@Nonnull String input) throws FlagParseException { if (MathMan.isInteger(input)) { final long value = Long.parseLong(input); if (value < 0) { @@ -64,7 +64,7 @@ public class KeepFlag extends PlotFlag { } } - @Override public KeepFlag merge(@NotNull Object newValue) { + @Override public KeepFlag merge(@Nonnull Object newValue) { if (newValue.equals(true)) { return flagOf(true); } else if (newValue.equals(false)) { @@ -93,7 +93,7 @@ public class KeepFlag extends PlotFlag { return "3w 4d 2h"; } - @Override protected KeepFlag flagOf(@NotNull Object value) { + @Override protected KeepFlag flagOf(@Nonnull Object value) { return new KeepFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java index 872c3157d..40592bfd3 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class KeepInventoryFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class KeepInventoryFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_KEEP_INVENTORY); } - @Override protected KeepInventoryFlag flagOf(@NotNull final Boolean value) { + @Override protected KeepInventoryFlag flagOf(@Nonnull final Boolean value) { return value ? KEEP_INVENTORY_TRUE : KEEP_INVENTORY_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java index 495db4160..43bcb5398 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class KelpGrowFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class KelpGrowFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_KELP_GROW); } - @Override protected KelpGrowFlag flagOf(@NotNull Boolean value) { + @Override protected KelpGrowFlag flagOf(@Nonnull Boolean value) { return value ? KELP_GROW_TRUE : KELP_GROW_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java index c200ed6a9..c0c0e4f17 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Collection; @@ -43,7 +43,7 @@ public class LiquidFlowFlag extends PlotFlag { @@ -38,7 +38,7 @@ public class MiscBreakFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_MISC_BREAK); } - @Override protected MiscBreakFlag flagOf(@NotNull Boolean value) { + @Override protected MiscBreakFlag flagOf(@Nonnull Boolean value) { return value ? MISC_BREAK_TRUE : MISC_BREAK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java index 2291d6343..dfe55373e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MiscCapFlag extends NonNegativeIntegerFlag { public static final MiscCapFlag MISC_CAP_UNLIMITED = new MiscCapFlag(Integer.MAX_VALUE); @@ -36,7 +36,7 @@ public class MiscCapFlag extends NonNegativeIntegerFlag { super(value, Captions.FLAG_DESCRIPTION_MISC_CAP); } - @Override protected MiscCapFlag flagOf(@NotNull Integer value) { + @Override protected MiscCapFlag flagOf(@Nonnull Integer value) { return new MiscCapFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java index a70191a9d..a64116119 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MiscInteractFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class MiscInteractFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_MISC_INTERACT); } - @Override protected MiscInteractFlag flagOf(@NotNull Boolean value) { + @Override protected MiscInteractFlag flagOf(@Nonnull Boolean value) { return value ? MISC_INTERACT_TRUE : MISC_INTERACT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java index 8579d33df..2cf52f8e0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MiscPlaceFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class MiscPlaceFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_MISC_PLACE); } - @Override protected MiscPlaceFlag flagOf(@NotNull Boolean value) { + @Override protected MiscPlaceFlag flagOf(@Nonnull Boolean value) { return value ? MISC_PLACE_TRUE : MISC_PLACE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java index fd8db8c69..e0d8e88e5 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MobBreakFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class MobBreakFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_MOB_BREAK); } - @Override protected MobBreakFlag flagOf(@NotNull Boolean value) { + @Override protected MobBreakFlag flagOf(@Nonnull Boolean value) { return value ? MOB_BREAK_TRUE : MOB_BREAK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java index f05f2699a..a1e202984 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MobCapFlag extends NonNegativeIntegerFlag { public static final MobCapFlag MOB_CAP_UNLIMITED = new MobCapFlag(Integer.MAX_VALUE); @@ -36,7 +36,7 @@ public class MobCapFlag extends NonNegativeIntegerFlag { super(value, Captions.FLAG_DESCRIPTION_MOB_CAP); } - @Override protected MobCapFlag flagOf(@NotNull Integer value) { + @Override protected MobCapFlag flagOf(@Nonnull Integer value) { return new MobCapFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java index b0f85914c..ae54d6321 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MobPlaceFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class MobPlaceFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_MOB_PLACE); } - @Override protected MobPlaceFlag flagOf(@NotNull Boolean value) { + @Override protected MobPlaceFlag flagOf(@Nonnull Boolean value) { return value ? MOB_PLACE_TRUE : MOB_PLACE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java index 175c22c1e..d03a212cd 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java @@ -31,7 +31,7 @@ import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.ItemUtil; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MusicFlag extends PlotFlag { @@ -46,7 +46,7 @@ public class MusicFlag extends PlotFlag { super(value, Captions.FLAG_CATEGORY_MUSIC, Captions.FLAG_DESCRIPTION_MUSIC); } - @Override public MusicFlag parse(@NotNull String input) throws FlagParseException { + @Override public MusicFlag parse(@Nonnull String input) throws FlagParseException { if (!input.isEmpty() && !input.contains("music_disc_")) { input = "music_disc_" + input; } @@ -59,7 +59,7 @@ public class MusicFlag extends PlotFlag { } } - @Override public MusicFlag merge(@NotNull ItemType newValue) { + @Override public MusicFlag merge(@Nonnull ItemType newValue) { if (getValue().equals(ItemTypes.AIR)) { return new MusicFlag(newValue); } else if (newValue.equals(ItemTypes.AIR)) { @@ -77,7 +77,7 @@ public class MusicFlag extends PlotFlag { return "ward"; } - @Override protected MusicFlag flagOf(@NotNull ItemType value) { + @Override protected MusicFlag flagOf(@Nonnull ItemType value) { return new MusicFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java index 42c69c0da..c54fe938b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class MycelGrowFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class MycelGrowFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_MYCEL_GROW); } - @Override protected MycelGrowFlag flagOf(@NotNull Boolean value) { + @Override protected MycelGrowFlag flagOf(@Nonnull Boolean value) { return value ? MYCEL_GROW_TRUE : MYCEL_GROW_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java index 926ddbf81..e3760ee1a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class NoWorldeditFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class NoWorldeditFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_NO_WORLDEDIT); } - @Override protected NoWorldeditFlag flagOf(@NotNull Boolean value) { + @Override protected NoWorldeditFlag flagOf(@Nonnull Boolean value) { return value ? NO_WORLDEDIT_TRUE : NO_WORLDEDIT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java index 55deec66d..7cb4c3422 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class NotifyEnterFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class NotifyEnterFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_NOTIFY_ENTER); } - @Override protected NotifyEnterFlag flagOf(@NotNull Boolean value) { + @Override protected NotifyEnterFlag flagOf(@Nonnull Boolean value) { return value ? NOTIFY_ENTER_TRUE : NOTIFY_ENTER_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java index 521401f82..55734a57a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class NotifyLeaveFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class NotifyLeaveFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_NOTIFY_LEAVE); } - @Override protected NotifyLeaveFlag flagOf(@NotNull Boolean value) { + @Override protected NotifyLeaveFlag flagOf(@Nonnull Boolean value) { return value ? NOTIFY_LEAVE_TRUE : NOTIFY_LEAVE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java index ae5fb6e2a..25c3ae0d6 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java @@ -28,7 +28,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BlockTypeListFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -41,7 +41,7 @@ public class PlaceFlag extends BlockTypeListFlag { super(blockTypeList, Captions.FLAG_DESCRIPTION_PLACE); } - @Override protected PlaceFlag flagOf(@NotNull List value) { + @Override protected PlaceFlag flagOf(@Nonnull List value) { return new PlaceFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java index 3743826a5..859cd98f9 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class PlayerInteractFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class PlayerInteractFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_PLAYER_INTERACT); } - @Override protected PlayerInteractFlag flagOf(@NotNull Boolean value) { + @Override protected PlayerInteractFlag flagOf(@Nonnull Boolean value) { return value ? PLAYER_INTERACT_TRUE : PLAYER_INTERACT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java index f86e84ecb..fd74c9f30 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class PreventCreativeCopyFlag extends BooleanFlag { @@ -36,11 +36,11 @@ public class PreventCreativeCopyFlag extends BooleanFlag { public static final PriceFlag PRICE_NOT_BUYABLE = new PriceFlag(0D); - protected PriceFlag(@NotNull Double value) { + protected PriceFlag(@Nonnull Double value) { super(value, Double.MIN_NORMAL, Double.MAX_VALUE, Captions.FLAG_DESCRIPTION_PRICE); } - @Override protected PriceFlag flagOf(@NotNull Double value) { + @Override protected PriceFlag flagOf(@Nonnull Double value) { return new PriceFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java index 9d46f63fb..3fafa389a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class PveFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class PveFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_PVE); } - @Override protected PveFlag flagOf(@NotNull Boolean value) { + @Override protected PveFlag flagOf(@Nonnull Boolean value) { return value ? PVE_TRUE : PVE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java index 3c07c9d1c..98d7bea46 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class PvpFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class PvpFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_PVP); } - @Override protected PvpFlag flagOf(@NotNull Boolean value) { + @Override protected PvpFlag flagOf(@Nonnull Boolean value) { return value ? PVP_TRUE : PVP_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java index e46df3616..c31105a46 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class RedstoneFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class RedstoneFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_REDSTONE); } - @Override protected RedstoneFlag flagOf(@NotNull Boolean value) { + @Override protected RedstoneFlag flagOf(@Nonnull Boolean value) { return value ? REDSTONE_TRUE : REDSTONE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java index db05dcdfa..a3ca35bdf 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class ServerPlotFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class ServerPlotFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_SERVER_PLOT); } - @Override protected ServerPlotFlag flagOf(@NotNull Boolean value) { + @Override protected ServerPlotFlag flagOf(@Nonnull Boolean value) { return value ? SERVER_PLOT_TRUE : SERVER_PLOT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java index 33f21f1e6..74da52ee7 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class SnowFormFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class SnowFormFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_SNOW_FORM); } - @Override protected SnowFormFlag flagOf(@NotNull Boolean value) { + @Override protected SnowFormFlag flagOf(@Nonnull Boolean value) { return value ? SNOW_FORM_TRUE : SNOW_FORM_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java index 7a948ed39..1384ebcba 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class SnowMeltFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class SnowMeltFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_SNOW_MELT); } - @Override protected SnowMeltFlag flagOf(@NotNull Boolean value) { + @Override protected SnowMeltFlag flagOf(@Nonnull Boolean value) { return value ? SNOW_MELT_TRUE : SNOW_MELT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java index 3096850bf..6787bbc07 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class SoilDryFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class SoilDryFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_SOIL_DRY); } - @Override protected SoilDryFlag flagOf(@NotNull Boolean value) { + @Override protected SoilDryFlag flagOf(@Nonnull Boolean value) { return value ? SOIL_DRY_TRUE : SOIL_DRY_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java index e2b3ba806..03ad2ab4f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class TamedAttackFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class TamedAttackFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_TAMED_ATTACK); } - @Override protected TamedAttackFlag flagOf(@NotNull Boolean value) { + @Override protected TamedAttackFlag flagOf(@Nonnull Boolean value) { return value ? TAMED_ATTACK_TRUE : TAMED_ATTACK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java index c6c555501..0c10d9c82 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class TamedInteractFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class TamedInteractFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_TAMED_INTERACT); } - @Override protected TamedInteractFlag flagOf(@NotNull Boolean value) { + @Override protected TamedInteractFlag flagOf(@Nonnull Boolean value) { return value ? TAMED_INTERACT_TRUE : TAMED_INTERACT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java index 7b21b554b..f1e16d435 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java @@ -27,16 +27,16 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.LongFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class TimeFlag extends LongFlag { public static final TimeFlag TIME_DISABLED = new TimeFlag(Long.MIN_VALUE); - protected TimeFlag(@NotNull Long value) { + protected TimeFlag(@Nonnull Long value) { super(value, Captions.FLAG_DESCRIPTION_TIME); } - @Override protected TimeFlag flagOf(@NotNull Long value) { + @Override protected TimeFlag flagOf(@Nonnull Long value) { return new TimeFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java index 0b160dae5..18cdd907f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java @@ -28,8 +28,8 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collection; @@ -45,7 +45,7 @@ public class TitlesFlag extends PlotFlag super(value, Captions.FLAG_CATEGORY_ENUM, Captions.FLAG_DESCRIPTION_TITLES); } - @Override public TitlesFlag parse(@NotNull final String input) throws FlagParseException { + @Override public TitlesFlag parse(@Nonnull final String input) throws FlagParseException { final TitlesFlagValue titlesFlagValue = TitlesFlagValue.fromString(input); if (titlesFlagValue == null) { throw new FlagParseException(this, input, Captions.FLAG_ERROR_ENUM, @@ -54,7 +54,7 @@ public class TitlesFlag extends PlotFlag return flagOf(titlesFlagValue); } - @Override public TitlesFlag merge(@NotNull TitlesFlagValue newValue) { + @Override public TitlesFlag merge(@Nonnull TitlesFlagValue newValue) { if (newValue == TitlesFlagValue.TRUE || newValue == TitlesFlagValue.FALSE) { return flagOf(newValue); } @@ -69,7 +69,7 @@ public class TitlesFlag extends PlotFlag return "true"; } - @Override protected TitlesFlag flagOf(@NotNull TitlesFlagValue value) { + @Override protected TitlesFlag flagOf(@Nonnull TitlesFlagValue value) { if (value == TitlesFlagValue.TRUE) { return TITLES_TRUE; } else if (value == TitlesFlagValue.FALSE) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java index a85fdacf0..4f0014709 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class UntrustedVisitFlag extends BooleanFlag { @@ -37,7 +37,7 @@ public class UntrustedVisitFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_UNTRUSTED); } - @Override protected UntrustedVisitFlag flagOf(@NotNull Boolean value) { + @Override protected UntrustedVisitFlag flagOf(@Nonnull Boolean value) { return new UntrustedVisitFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java index 96d1630c8..76b62d1e3 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java @@ -28,7 +28,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BlockTypeListFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -41,7 +41,7 @@ public class UseFlag extends BlockTypeListFlag { super(blockTypeList, Captions.FLAG_DESCRIPTION_USE); } - @Override protected UseFlag flagOf(@NotNull List value) { + @Override protected UseFlag flagOf(@Nonnull List value) { return new UseFlag(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java index bf77b18a7..88ff325b5 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class VehicleBreakFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class VehicleBreakFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_VEHICLE_BREAK); } - @Override protected VehicleBreakFlag flagOf(@NotNull Boolean value) { + @Override protected VehicleBreakFlag flagOf(@Nonnull Boolean value) { return value ? VEHICLE_BREAK_TRUE : VEHICLE_BREAK_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java index 3a428bb8c..d221546ea 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class VehicleCapFlag extends NonNegativeIntegerFlag { public static final VehicleCapFlag VEHICLE_CAP_UNLIMITED = @@ -37,7 +37,7 @@ public class VehicleCapFlag extends NonNegativeIntegerFlag { super(value, Captions.FLAG_DESCRIPTION_VEHICLE_CAP); } - @Override protected VehicleCapFlag flagOf(@NotNull Integer value) { + @Override protected VehicleCapFlag flagOf(@Nonnull Integer value) { return new VehicleCapFlag(value); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java index 5bff06205..ce64a50c9 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class VehiclePlaceFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class VehiclePlaceFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_VEHICLE_PLACE); } - @Override protected VehiclePlaceFlag flagOf(@NotNull Boolean value) { + @Override protected VehiclePlaceFlag flagOf(@Nonnull Boolean value) { return value ? VEHICLE_PLACE_TRUE : VEHICLE_PLACE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java index b4386791b..a9d1b151c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class VehicleUseFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class VehicleUseFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_VEHICLE_USE); } - @Override protected VehicleUseFlag flagOf(@NotNull Boolean value) { + @Override protected VehicleUseFlag flagOf(@Nonnull Boolean value) { return value ? VEHICLE_USE_TRUE : VEHICLE_USE_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java index 2bcf6a2ed..6721afb08 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class VillagerInteractFlag extends BooleanFlag { @@ -40,7 +40,7 @@ public class VillagerInteractFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_VILLAGER_INTERACT); } - @Override protected VillagerInteractFlag flagOf(@NotNull Boolean value) { + @Override protected VillagerInteractFlag flagOf(@Nonnull Boolean value) { return value ? VILLAGER_INTERACT_TRUE : VILLAGER_INTERACT_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java index 5f90a069a..a19a7b361 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java @@ -27,7 +27,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.types.BooleanFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public class VineGrowFlag extends BooleanFlag { @@ -38,7 +38,7 @@ public class VineGrowFlag extends BooleanFlag { super(value, Captions.FLAG_DESCRIPTION_VINE_GROW); } - @Override protected VineGrowFlag flagOf(@NotNull Boolean value) { + @Override protected VineGrowFlag flagOf(@Nonnull Boolean value) { return value ? VINE_GROW_TRUE : VINE_GROW_FALSE; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java index 7b7ea495d..708833c9a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java @@ -28,7 +28,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.PlotWeather; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Collection; @@ -44,11 +44,11 @@ public class WeatherFlag extends PlotFlag { * * @param value Flag value */ - protected WeatherFlag(@NotNull PlotWeather value) { + protected WeatherFlag(@Nonnull PlotWeather value) { super(value, Captions.FLAG_CATEGORY_WEATHER, Captions.FLAG_DESCRIPTION_WEATHER); } - @Override public WeatherFlag parse(@NotNull String input) { + @Override public WeatherFlag parse(@Nonnull String input) { switch (input.toLowerCase()) { case "rain": case "storm": @@ -65,7 +65,7 @@ public class WeatherFlag extends PlotFlag { } } - @Override public WeatherFlag merge(@NotNull PlotWeather newValue) { + @Override public WeatherFlag merge(@Nonnull PlotWeather newValue) { return flagOf(newValue); } @@ -77,7 +77,7 @@ public class WeatherFlag extends PlotFlag { return "storm"; } - @Override protected WeatherFlag flagOf(@NotNull PlotWeather value) { + @Override protected WeatherFlag flagOf(@Nonnull PlotWeather value) { switch (value) { case RAIN: return PLOT_WEATHER_FLAG_RAIN; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java index 765e00f96..bc6317009 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java @@ -32,7 +32,7 @@ import com.plotsquared.core.util.BlockUtil; import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -48,7 +48,7 @@ public abstract class BlockTypeListFlag> super(blockTypeList, Captions.FLAG_CATEGORY_BLOCK_LIST, description); } - @Override public F parse(@NotNull String input) throws FlagParseException { + @Override public F parse(@Nonnull String input) throws FlagParseException { final List parsedBlocks = new ArrayList<>(); final String[] split = input.replaceAll("\\s+", "").split(",(?![^\\(\\[]*[\\]\\)])"); if (split.length == 0) { 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 9af840d4c..4228ef7ad 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 @@ -32,8 +32,8 @@ import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; @@ -50,19 +50,19 @@ public class BlockTypeWrapper { @Nullable private final String blockCategoryId; @Nullable private BlockCategory blockCategory; - private BlockTypeWrapper(@NotNull final BlockType blockType) { + private BlockTypeWrapper(@Nonnull final BlockType blockType) { this.blockType = Preconditions.checkNotNull(blockType); this.blockCategory = null; this.blockCategoryId = null; } - private BlockTypeWrapper(@NotNull final BlockCategory blockCategory) { + private BlockTypeWrapper(@Nonnull final BlockCategory blockCategory) { this.blockType = null; this.blockCategory = Preconditions.checkNotNull(blockCategory); this.blockCategoryId = blockCategory.getId(); // used in toString()/equals()/hashCode() } - private BlockTypeWrapper(@NotNull final String blockCategoryId) { + private BlockTypeWrapper(@Nonnull final String blockCategoryId) { this.blockType = null; this.blockCategory = null; this.blockCategoryId = Preconditions.checkNotNull(blockCategoryId); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java index 578204ff6..463e31e8f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java @@ -29,7 +29,7 @@ import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Collection; @@ -62,7 +62,7 @@ public abstract class BooleanFlag> extends PlotFl this(false, description); } - @Override public F parse(@NotNull String input) throws FlagParseException { + @Override public F parse(@Nonnull String input) throws FlagParseException { if (positiveValues.contains(input.toLowerCase(Locale.ENGLISH))) { return this.flagOf(true); } else if (negativeValues.contains(input.toLowerCase(Locale.ENGLISH))) { @@ -72,7 +72,7 @@ public abstract class BooleanFlag> extends PlotFl } } - @Override public F merge(@NotNull Boolean newValue) { + @Override public F merge(@Nonnull Boolean newValue) { return this.flagOf(getValue() || newValue); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java index a7a9b88fd..1ee9f8ed8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java @@ -28,20 +28,20 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public abstract class DoubleFlag> extends NumberFlag { - protected DoubleFlag(@NotNull Double value, Double minimum, Double maximum, - @NotNull Caption flagDescription) { + protected DoubleFlag(@Nonnull Double value, Double minimum, Double maximum, + @Nonnull Caption flagDescription) { super(value, minimum, maximum, Captions.FLAG_CATEGORY_DOUBLES, flagDescription); } - protected DoubleFlag(@NotNull Double value, @NotNull Caption flagDescription) { + protected DoubleFlag(@Nonnull Double value, @Nonnull Caption flagDescription) { this(value, Double.MIN_VALUE, Double.MAX_VALUE, flagDescription); } - @Override public F merge(@NotNull Double newValue) { + @Override public F merge(@Nonnull Double newValue) { return flagOf(getValue() + newValue); } @@ -53,7 +53,7 @@ public abstract class DoubleFlag> extends Number return getValue().toString(); } - @NotNull @Override protected Double parseNumber(String input) throws FlagParseException { + @Nonnull @Override protected Double parseNumber(String input) throws FlagParseException { try { return Double.parseDouble(input); } catch (Throwable throwable) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java index efae07579..2968ef52e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java @@ -28,20 +28,20 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public abstract class IntegerFlag> extends NumberFlag { protected IntegerFlag(final int value, int minimum, int maximum, - @NotNull Caption flagDescription) { + @Nonnull Caption flagDescription) { super(value, minimum, maximum, Captions.FLAG_CATEGORY_INTEGERS, flagDescription); } - protected IntegerFlag(@NotNull Caption flagDescription) { + protected IntegerFlag(@Nonnull Caption flagDescription) { this(0, Integer.MIN_VALUE, Integer.MAX_VALUE, flagDescription); } - @Override public F merge(@NotNull Integer newValue) { + @Override public F merge(@Nonnull Integer newValue) { return flagOf(getValue() + newValue); } @@ -53,7 +53,7 @@ public abstract class IntegerFlag> extends Numb return "10"; } - @NotNull @Override protected Integer parseNumber(String input) throws FlagParseException { + @Nonnull @Override protected Integer parseNumber(String input) throws FlagParseException { try { return Integer.parseInt(input); } catch (Throwable throwable) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/ListFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/ListFlag.java index 746a769aa..ef6e11cc8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/ListFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/ListFlag.java @@ -29,7 +29,7 @@ import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.StringMan; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; @@ -41,7 +41,7 @@ public abstract class ListFlag, F>> extends PlotFl super(Collections.unmodifiableList(valueList), category, description); } - @Override public F merge(@NotNull List newValue) { + @Override public F merge(@Nonnull List newValue) { final List mergedList = new ArrayList<>(); mergedList.addAll(getValue()); mergedList.addAll(newValue); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java index c684457a0..8d25aa830 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java @@ -28,20 +28,20 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public abstract class LongFlag> extends NumberFlag { - protected LongFlag(@NotNull Long value, Long minimum, Long maximum, - @NotNull Caption flagDescription) { + protected LongFlag(@Nonnull Long value, Long minimum, Long maximum, + @Nonnull Caption flagDescription) { super(value, minimum, maximum, Captions.FLAG_CATEGORY_INTEGERS, flagDescription); } - protected LongFlag(@NotNull Long value, @NotNull Caption flagDescription) { + protected LongFlag(@Nonnull Long value, @Nonnull Caption flagDescription) { this(value, Long.MIN_VALUE, Long.MAX_VALUE, flagDescription); } - @Override public F merge(@NotNull Long newValue) { + @Override public F merge(@Nonnull Long newValue) { return flagOf(getValue() + newValue); } @@ -53,7 +53,7 @@ public abstract class LongFlag> extends NumberFlag return "123456789"; } - @NotNull @Override protected Long parseNumber(String input) throws FlagParseException { + @Nonnull @Override protected Long parseNumber(String input) throws FlagParseException { try { return Long.parseLong(input); } catch (Throwable throwable) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/NonNegativeIntegerFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/NonNegativeIntegerFlag.java index 699e2f018..d2ae43232 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/NonNegativeIntegerFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/NonNegativeIntegerFlag.java @@ -26,15 +26,15 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.Caption; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public abstract class NonNegativeIntegerFlag> extends IntegerFlag { - protected NonNegativeIntegerFlag(int value, @NotNull Caption flagDescription) { + protected NonNegativeIntegerFlag(int value, @Nonnull Caption flagDescription) { super(value, 0, Integer.MAX_VALUE, flagDescription); } - public NonNegativeIntegerFlag(int value, int maximum, @NotNull Caption flagDescription) { + public NonNegativeIntegerFlag(int value, int maximum, @Nonnull Caption flagDescription) { super(value, 0, maximum, flagDescription); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java index 43068a85a..ea7b491ed 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java @@ -29,15 +29,15 @@ import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public abstract class NumberFlag, F extends PlotFlag> extends PlotFlag { protected final N minimum; protected final N maximum; - protected NumberFlag(@NotNull N value, N minimum, N maximum, @NotNull Caption flagCategory, - @NotNull Caption flagDescription) { + protected NumberFlag(@Nonnull N value, N minimum, N maximum, @Nonnull Caption flagCategory, + @Nonnull Caption flagDescription) { super(value, flagCategory, flagDescription); if (maximum.compareTo(minimum) < 0) { throw new IllegalArgumentException( @@ -47,7 +47,7 @@ public abstract class NumberFlag, F extends Plo this.maximum = maximum; } - @Override public F parse(@NotNull String input) throws FlagParseException { + @Override public F parse(@Nonnull String input) throws FlagParseException { final N parsed = parseNumber(input); if (parsed.compareTo(minimum) < 0 || parsed.compareTo(maximum) > 0) { throw new FlagParseException(this, input, Captions.NUMBER_NOT_IN_RANGE, minimum, @@ -64,5 +64,5 @@ public abstract class NumberFlag, F extends Plo * @param input the string to parse the number from. * @return the parsed number. */ - @NotNull protected abstract N parseNumber(String input) throws FlagParseException; + @Nonnull protected abstract N parseNumber(String input) throws FlagParseException; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java index d00504989..22d6e859f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java @@ -29,18 +29,18 @@ import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public abstract class TimedFlag, F>> extends PlotFlag, F> { private final T defaultValue; - protected TimedFlag(@NotNull Timed value, T defaultValue, @NotNull Caption flagDescription) { + protected TimedFlag(@Nonnull Timed value, T defaultValue, @Nonnull Caption flagDescription) { super(value, Captions.FLAG_CATEGORY_INTERVALS, flagDescription); this.defaultValue = defaultValue; } - @Override public F parse(@NotNull String input) throws FlagParseException { + @Override public F parse(@Nonnull String input) throws FlagParseException { String[] split = input.split(" ", 2); int interval; try { @@ -58,7 +58,7 @@ public abstract class TimedFlag, F>> return flagOf(new Timed<>(interval, parsedValue)); } - @Override public F merge(@NotNull Timed newValue) { + @Override public F merge(@Nonnull Timed newValue) { return flagOf( new Timed<>(getValue().interval + newValue.interval, mergeValue(newValue.value))); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java index ded21d507..56b39f252 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java @@ -32,8 +32,8 @@ import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotWorld; import com.plotsquared.core.util.StringMan; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashMap; @@ -47,7 +47,7 @@ import java.util.Set; final PlotArea[] noPlotAreas = new PlotArea[0]; private final Map plotWorlds = new HashMap<>(); - @Override @NotNull public PlotArea[] getAllPlotAreas() { + @Override @Nonnull public PlotArea[] getAllPlotAreas() { final Set area = new HashSet<>(); for (final PlotWorld world : plotWorlds.values()) { area.addAll(world.getAreas()); @@ -66,7 +66,7 @@ import java.util.Set; return world.getArea(location); } - @Override public void addPlotArea(@NotNull final PlotArea plotArea) { + @Override public void addPlotArea(@Nonnull final PlotArea plotArea) { PlotWorld world = this.plotWorlds.get(plotArea.getWorldName()); if (world != null) { if (world instanceof StandardPlotWorld && world.getAreas().isEmpty()) { @@ -85,7 +85,7 @@ import java.util.Set; this.plotWorlds.put(plotArea.getWorldName(), world); } - @Override public void removePlotArea(@NotNull final PlotArea area) { + @Override public void removePlotArea(@Nonnull final PlotArea area) { final PlotWorld world = this.plotWorlds.get(area.getWorldName()); if (world == null) { return; @@ -100,7 +100,7 @@ import java.util.Set; } } - @Override public PlotArea getPlotArea(@NotNull final String world, @Nullable final String id) { + @Override public PlotArea getPlotArea(@Nonnull final String world, @Nullable final String id) { final PlotWorld plotWorld = this.plotWorlds.get(world); if (plotWorld == null) { return null; @@ -120,11 +120,11 @@ import java.util.Set; return null; } - @Override @Nullable public PlotArea getPlotArea(@NotNull final Location location) { + @Override @Nullable public PlotArea getPlotArea(@Nonnull final Location location) { return this.getApplicablePlotArea(location); } - @Override @NotNull public PlotArea[] getPlotAreas(@NotNull final String world, @Nullable final CuboidRegion region) { + @Override @Nonnull public PlotArea[] getPlotAreas(@Nonnull final String world, @Nullable final CuboidRegion region) { final PlotWorld plotWorld = this.plotWorlds.get(world); if (plotWorld == null) { return noPlotAreas; @@ -135,7 +135,7 @@ import java.util.Set; return plotWorld.getAreasInRegion(region).toArray(new PlotArea[0]); } - @Override public void addWorld(@NotNull final String worldName) { + @Override public void addWorld(@Nonnull final String worldName) { PlotWorld world = this.plotWorlds.get(worldName); if (world != null) { return; @@ -146,11 +146,11 @@ import java.util.Set; this.plotWorlds.put(worldName, world); } - @Override public void removeWorld(@NotNull final String worldName) { + @Override public void removeWorld(@Nonnull final String worldName) { this.plotWorlds.remove(worldName); } - @Override @NotNull public String[] getAllWorlds() { + @Override @Nonnull public String[] getAllWorlds() { return this.plotWorlds.keySet().toArray(new String[0]); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java index 3023a936c..2529bf1be 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java @@ -30,9 +30,9 @@ import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.util.StringMan; import com.sk89q.worldedit.regions.CuboidRegion; -import lombok.NonNull; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Collections; import java.util.HashSet; @@ -63,7 +63,7 @@ public interface PlotAreaManager { * @param location The location * @return The area if found, else {@code null} */ - @Nullable PlotArea getPlotArea(@NotNull Location location); + @Nullable PlotArea getPlotArea(@Nonnull Location location); /** * Get the plot area in a world with an (optional ID). @@ -75,7 +75,7 @@ public interface PlotAreaManager { * @param id Area ID * @return Plot area matching the criteria */ - @Nullable PlotArea getPlotArea(@NotNull String world, @Nullable String id); + @Nullable PlotArea getPlotArea(@Nonnull String world, @Nullable String id); /** * Get all plot areas in a world, with an optional region constraint @@ -84,49 +84,49 @@ public interface PlotAreaManager { * @param region Optional region * @return All plots in the region */ - @NotNull PlotArea[] getPlotAreas(@NotNull String world, @Nullable CuboidRegion region); + @Nonnull PlotArea[] getPlotAreas(@Nonnull String world, @Nullable CuboidRegion region); /** * Get all plot areas recognized by PlotSquared * * @return All plot areas */ - @NotNull PlotArea[] getAllPlotAreas(); + @Nonnull PlotArea[] getAllPlotAreas(); /** * Get all worlds recognized by PlotSquared * * @return All world names */ - @NotNull String[] getAllWorlds(); + @Nonnull String[] getAllWorlds(); /** * Add a plot area * * @param area Area */ - void addPlotArea(@NotNull PlotArea area); + void addPlotArea(@Nonnull PlotArea area); /** * Remove a plot area * * @param area Area */ - void removePlotArea(@NotNull PlotArea area); + void removePlotArea(@Nonnull PlotArea area); /** * Add a world * * @param worldName Name of the world to add */ - void addWorld(@NotNull String worldName); + void addWorld(@Nonnull String worldName); /** * Remove a world * * @param worldName Name of the world to remove */ - void removeWorld(@NotNull String worldName); + void removeWorld(@Nonnull String worldName); /** * Method that delegates to {@link #getPlotAreas(String, CuboidRegion)} but returns an @@ -136,7 +136,7 @@ public interface PlotAreaManager { * @param region Optional region * @return All areas in the world (and region) */ - @NotNull default Set getPlotAreasSet(@NotNull final String world, + @Nonnull default Set getPlotAreasSet(@Nonnull final String world, @Nullable final CuboidRegion region) { final PlotArea[] areas = this.getPlotAreas(world, region); final Set set = new HashSet<>(); @@ -151,7 +151,7 @@ public interface PlotAreaManager { * @param world World name * @return Modifiable set containing all plot areas in the specified world */ - @NotNull default Set getPlotAreasSet(@NotNull final String world) { + @Nonnull default Set getPlotAreasSet(@Nonnull final String world) { final Set set = new HashSet<>(); Collections.addAll(set, this.getPlotAreas(world, null)); return set; @@ -164,7 +164,7 @@ public interface PlotAreaManager { * @param search Search string * @return An area that matches the search string, or {@code null} */ - @Nullable default PlotArea getPlotAreaByString(@NotNull final String search) { + @Nullable default PlotArea getPlotAreaByString(@Nonnull final String search) { String[] split = search.split("[;,]"); PlotArea[] areas = this.getPlotAreas(split[0], null); if (areas == null) { @@ -199,7 +199,7 @@ public interface PlotAreaManager { * @return if a plot world is registered * @see #getPlotAreaByString(String) to get the PlotArea object */ - default boolean hasPlotArea(@NotNull final String world) { + default boolean hasPlotArea(@Nonnull final String world) { return this.getPlotAreas(world, null).length != 0; } @@ -209,7 +209,7 @@ public interface PlotAreaManager { * @param world World name * @return {@code true} if the world is augmented plot world, {@code false} if not */ - default boolean isAugmented(@NonNull final String world) { + default boolean isAugmented(@Nonnull final String world) { final PlotArea[] areas = this.getPlotAreas(world, null); return areas != null && (areas.length > 1 || areas[0].getType() != PlotAreaType.NORMAL); } @@ -219,7 +219,7 @@ public interface PlotAreaManager { * * @param action Action to perform */ - default void forEachPlotArea(@NotNull final Consumer action) { + default void forEachPlotArea(@Nonnull final Consumer action) { for (final PlotArea area : this.getAllPlotAreas()) { action.accept(area); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java b/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java index 40707a8e5..992f8330b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java @@ -32,8 +32,8 @@ import com.plotsquared.core.util.PlotAreaConverter; import com.plotsquared.core.util.RegionUtil; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.khelekore.prtree.MBR; import org.khelekore.prtree.PRTree; import org.khelekore.prtree.SimpleMBR; @@ -60,11 +60,11 @@ public class ScatteredPlotWorld extends PlotWorld { * * @param world World name */ - public ScatteredPlotWorld(@NotNull final String world) { + public ScatteredPlotWorld(@Nonnull final String world) { super(world); } - @Override @Nullable public PlotArea getArea(@NotNull final Location location) { + @Override @Nullable public PlotArea getArea(@Nonnull final Location location) { if (this.areas.isEmpty()) { return null; } @@ -78,21 +78,21 @@ public class ScatteredPlotWorld extends PlotWorld { return null; } - @Override @NotNull public Collection getAreas() { + @Override @Nonnull public Collection getAreas() { return Collections.unmodifiableCollection(this.areas); } - @Override public void addArea(@NotNull final PlotArea area) { + @Override public void addArea(@Nonnull final PlotArea area) { this.areas.add(area); this.buildTree(); } - @Override public void removeArea(@NotNull final PlotArea area) { + @Override public void removeArea(@Nonnull final PlotArea area) { this.areas.remove(area); this.buildTree(); } - @Override @NotNull public Collection getAreasInRegion(@NotNull final CuboidRegion region) { + @Override @Nonnull public Collection getAreasInRegion(@Nonnull final CuboidRegion region) { if (this.areas.isEmpty()) { return Collections.emptyList(); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java index 196474280..f0e2dfbdf 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java @@ -33,7 +33,7 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.flag.PlotFlag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -48,7 +48,7 @@ public class SinglePlot extends Plot { new CuboidRegion(BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE), BlockVector3.at(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE))); - public SinglePlot(@NotNull final PlotArea area, @NotNull final PlotId id) { + public SinglePlot(@Nonnull final PlotArea area, @Nonnull final PlotId id) { super(area, id); } @@ -76,7 +76,7 @@ public class SinglePlot extends Plot { return super.isLoaded(); } - @NotNull @Override public Set getRegions() { + @Nonnull @Override public Set getRegions() { return regions; } 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 796c8d824..a7dcd8f22 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 @@ -49,8 +49,8 @@ import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.io.IOException; @@ -63,21 +63,21 @@ public class SinglePlotArea extends GridPlotWorld { private final EventDispatcher eventDispatcher; private final PlotListener plotListener; - public SinglePlotArea(@NotNull final PlotAreaManager plotAreaManager, - @NotNull final EventDispatcher eventDispatcher, - @NotNull final PlotListener plotListener, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @NotNull final GlobalBlockQueue globalBlockQueue, - @NotNull final EconHandler econHandler) { + public SinglePlotArea(@Nonnull final PlotAreaManager plotAreaManager, + @Nonnull final EventDispatcher eventDispatcher, + @Nonnull final PlotListener plotListener, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @Nonnull final GlobalBlockQueue globalBlockQueue, + @Nonnull final EconHandler econHandler) { super("*", null, new SingleWorldGenerator(plotAreaManager), null, null, - eventDispatcher, plotListener, worldConfiguration, globalBlockQueue, econHandler); + worldConfiguration, globalBlockQueue, econHandler); this.eventDispatcher = eventDispatcher; this.plotListener = plotListener; this.setAllowSigns(false); this.setDefaultHome(new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE)); } - @NotNull @Override protected PlotManager createManager() { + @Nonnull @Override protected PlotManager createManager() { return new SinglePlotManager(this); } @@ -169,38 +169,38 @@ public class SinglePlotArea extends GridPlotWorld { new ConfigurationNode("void", this.VOID, "Void world", ConfigurationUtil.BOOLEAN)}; } - @Nullable @Override public Plot getOwnedPlot(@NotNull final Location location) { + @Nullable @Override public Plot getOwnedPlot(@Nonnull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorldName()); Plot plot = pid == null ? null : this.plots.get(pid); return plot == null ? null : plot.getBasePlot(false); } - @Nullable @Override public Plot getOwnedPlotAbs(@NotNull Location location) { + @Nullable @Override public Plot getOwnedPlotAbs(@Nonnull Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorldName()); return pid == null ? null : plots.get(pid); } - @Nullable @Override public Plot getPlot(@NotNull final Location location) { + @Nullable @Override public Plot getPlot(@Nonnull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorldName()); return pid == null ? null : getPlot(pid); } - @Nullable @Override public Plot getPlotAbs(@NotNull final Location location) { + @Nullable @Override public Plot getPlotAbs(@Nonnull final Location location) { final PlotId pid = PlotId.fromStringOrNull(location.getWorldName()); return pid == null ? null : getPlotAbs(pid); } - public boolean addPlot(@NotNull Plot plot) { + public boolean addPlot(@Nonnull Plot plot) { plot = adapt(plot); return super.addPlot(plot); } - @Override public boolean addPlotAbs(@NotNull Plot plot) { + @Override public boolean addPlotAbs(@Nonnull Plot plot) { plot = adapt(plot); return super.addPlotAbs(plot); } - @Override public boolean addPlotIfAbsent(@NotNull Plot plot) { + @Override public boolean addPlotIfAbsent(@Nonnull Plot plot) { plot = adapt(plot); return super.addPlotIfAbsent(plot); } @@ -214,25 +214,25 @@ public class SinglePlotArea extends GridPlotWorld { final FlagContainer oldContainer = p.getFlagContainer(); p = new SinglePlot(p.getId(), p.getOwnerAbs(), p.getTrusted(), p.getMembers(), p.getDenied(), s.getAlias(), s.getPosition(), null, this, s.getMerged(), - p.getTimestamp(), p.temp, this.eventDispatcher, this.plotListener); + p.getTimestamp(), p.temp); p.getFlagContainer().addAll(oldContainer); return p; } - @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { + @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { - return new SinglePlot(this, id, this.eventDispatcher, this.plotListener); + return new SinglePlot(this, id); } return plot; } - @Nullable public Plot getPlot(@NotNull PlotId id) { + @Nullable public Plot getPlot(@Nonnull PlotId id) { // TODO Plot plot = getOwnedPlotAbs(id); if (plot == null) { - return new SinglePlot(this, id, this.eventDispatcher, this.plotListener); + return new SinglePlot(this, id); } return plot.getBasePlot(false); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java index 36e53cb73..fc48f8900 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java @@ -38,8 +38,8 @@ import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.SetupUtils; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import javax.inject.Inject; @@ -49,11 +49,11 @@ import javax.inject.Inject; private SinglePlotArea area; private PlotArea[] all; - @Inject public SinglePlotAreaManager(@NotNull final EventDispatcher eventDispatcher, - @NotNull final PlotListener plotListener, - @WorldConfig @NotNull final YamlConfiguration worldConfiguration, - @NotNull final GlobalBlockQueue blockQueue, - @NotNull final EconHandler econHandler) { + @Inject public SinglePlotAreaManager(@Nonnull final EventDispatcher eventDispatcher, + @Nonnull final PlotListener plotListener, + @WorldConfig @Nonnull final YamlConfiguration worldConfiguration, + @Nonnull final GlobalBlockQueue blockQueue, + @Nonnull final EconHandler econHandler) { this.area = new SinglePlotArea(this, eventDispatcher, plotListener, worldConfiguration, blockQueue, econHandler); this.array = new SinglePlotArea[] {area}; @@ -66,13 +66,13 @@ import javax.inject.Inject; return area; } - public void setArea(@NotNull final SinglePlotArea area) { + public void setArea(@Nonnull final SinglePlotArea area) { this.area = area; array[0] = area; all = ArrayUtil.concatAll(super.getAllPlotAreas(), array); } - public boolean isWorld(@NotNull final String id) { + public boolean isWorld(@Nonnull final String id) { char[] chars = id.toCharArray(); if (chars.length == 1 && chars[0] == '*') { return true; @@ -119,7 +119,7 @@ import javax.inject.Inject; super.getApplicablePlotArea(location); } - @Override @Nullable public PlotArea getPlotArea(@NotNull final String world, @NotNull final String id) { + @Override @Nullable public PlotArea getPlotArea(@Nonnull final String world, @Nonnull final String id) { PlotArea found = super.getPlotArea(world, id); if (found != null) { return found; @@ -127,7 +127,7 @@ import javax.inject.Inject; return isWorld(world) || world.equals("*") ? area : super.getPlotArea(world, id); } - @Override @Nullable public PlotArea getPlotArea(@NotNull final Location location) { + @Override @Nullable public PlotArea getPlotArea(@Nonnull final Location location) { PlotArea found = super.getPlotArea(location); if (found != null) { return found; @@ -135,7 +135,7 @@ import javax.inject.Inject; return isWorld(location.getWorldName()) || location.getWorldName().equals("*") ? area : null; } - @Override @NotNull public PlotArea[] getPlotAreas(@NotNull final String world, @NotNull final CuboidRegion region) { + @Override @Nonnull public PlotArea[] getPlotAreas(@Nonnull final String world, @Nonnull final CuboidRegion region) { PlotArea[] found = super.getPlotAreas(world, region); if (found != null && found.length != 0) { return found; @@ -145,15 +145,15 @@ import javax.inject.Inject; all.length == 0 ? noPlotAreas : super.getPlotAreas(world, region); } - @Override @NotNull public PlotArea[] getAllPlotAreas() { + @Override @Nonnull public PlotArea[] getAllPlotAreas() { return all; } - @Override @NotNull public String[] getAllWorlds() { + @Override @Nonnull public String[] getAllWorlds() { return super.getAllWorlds(); } - @Override public void addPlotArea(@NotNull final PlotArea area) { + @Override public void addPlotArea(@Nonnull final PlotArea area) { if (area == this.area) { return; } @@ -161,18 +161,18 @@ import javax.inject.Inject; all = ArrayUtil.concatAll(super.getAllPlotAreas(), array); } - @Override public void removePlotArea(@NotNull final PlotArea area) { + @Override public void removePlotArea(@Nonnull final PlotArea area) { if (area == this.area) { throw new UnsupportedOperationException("Cannot remove base area!"); } super.removePlotArea(area); } - @Override public void addWorld(@NotNull final String worldName) { + @Override public void addWorld(@Nonnull final String worldName) { super.addWorld(worldName); } - @Override public void removeWorld(@NotNull final String worldName) { + @Override public void removeWorld(@Nonnull final String worldName) { super.removeWorld(worldName); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java index dbb54a854..096f3f6c8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java @@ -34,14 +34,14 @@ import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.worldedit.function.pattern.Pattern; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.util.List; public class SinglePlotManager extends PlotManager { - public SinglePlotManager(@NotNull final PlotArea plotArea) { + public SinglePlotManager(@Nonnull final PlotArea plotArea) { super(plotArea); } @@ -53,11 +53,11 @@ public class SinglePlotManager extends PlotManager { return new PlotId(0, 0); } - @Override public Location getPlotBottomLocAbs(@NotNull final PlotId plotId) { + @Override public Location getPlotBottomLocAbs(@Nonnull final PlotId plotId) { return Location.at(plotId.toCommaSeparatedString(), -30000000, 0, -30000000); } - @Override public Location getPlotTopLocAbs(@NotNull final PlotId plotId) { + @Override public Location getPlotTopLocAbs(@Nonnull final PlotId plotId) { return Location.at(plotId.toCommaSeparatedString(), 30000000, 0, 30000000); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/StandardPlotWorld.java b/Core/src/main/java/com/plotsquared/core/plot/world/StandardPlotWorld.java index 162cf0e9f..b0c5290da 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/StandardPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/StandardPlotWorld.java @@ -29,8 +29,8 @@ import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotWorld; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Collection; import java.util.Collections; @@ -42,23 +42,23 @@ public class StandardPlotWorld extends PlotWorld { private final PlotArea area; - public StandardPlotWorld(@NotNull final String world, @Nullable final PlotArea area) { + public StandardPlotWorld(@Nonnull final String world, @Nullable final PlotArea area) { super(world); this.area = area; } - @Override @Nullable public PlotArea getArea(@NotNull final Location location) { + @Override @Nullable public PlotArea getArea(@Nonnull final Location location) { return this.area; } - @Override @NotNull public Collection getAreas() { + @Override @Nonnull public Collection getAreas() { if (this.area == null) { return Collections.emptyList(); } return Collections.singletonList(this.area); } - @Override @NotNull public Collection getAreasInRegion(@NotNull final CuboidRegion region) { + @Override @Nonnull public Collection getAreasInRegion(@Nonnull final CuboidRegion region) { return this.getAreas(); } diff --git a/Core/src/main/java/com/plotsquared/core/queue/AreaBoundDelegateLocalBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/AreaBoundDelegateLocalBlockQueue.java index 7ac07db57..75de960f1 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/AreaBoundDelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/AreaBoundDelegateLocalBlockQueue.java @@ -31,7 +31,7 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Objects; @@ -40,7 +40,7 @@ public class AreaBoundDelegateLocalBlockQueue extends DelegateLocalBlockQueue { @Getter private final PlotArea area; - public AreaBoundDelegateLocalBlockQueue(@NotNull final PlotArea area, + public AreaBoundDelegateLocalBlockQueue(@Nonnull final PlotArea area, @Nullable final LocalBlockQueue parent) { super(parent); this.area = Objects.requireNonNull(area); diff --git a/Core/src/main/java/com/plotsquared/core/queue/BasicLocalBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/BasicLocalBlockQueue.java index c65baab8e..e2bdd37e6 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/BasicLocalBlockQueue.java @@ -34,7 +34,7 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -90,7 +90,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return false; } - public final boolean execute(@NotNull LocalChunk lc) + public final boolean execute(@Nonnull LocalChunk lc) throws ExecutionException, InterruptedException { this.setComponents(lc); return true; @@ -116,7 +116,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { this.modified = modified; } - @Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) { + @Override public boolean setBlock(int x, int y, int z, @Nonnull Pattern pattern) { return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); } diff --git a/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java index 84b40b64b..fcd40d26e 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java @@ -31,8 +31,8 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Arrays; @@ -114,7 +114,7 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue { return null; } - @Override @NotNull public String getWorld() { + @Override @Nonnull public String getWorld() { return ""; } diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java index dbfc7452a..1f2ccb995 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java @@ -41,8 +41,8 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; import lombok.Setter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public abstract class LocalBlockQueue { @@ -95,7 +95,7 @@ public abstract class LocalBlockQueue { public abstract boolean setBlock(final int x, final int y, final int z, final BaseBlock id); - public boolean setBlock(final int x, final int y, final int z, @NotNull final Pattern pattern) { + public boolean setBlock(final int x, final int y, final int z, @Nonnull final Pattern pattern) { return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); } 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 bdc6876c3..2535a0e1f 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java +++ b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java @@ -39,8 +39,8 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.StringMan; import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collection; @@ -66,7 +66,7 @@ public enum CommonSetupSteps implements SetupStep { return CommonSetupSteps.CHOOSE_PLOT_AREA_TYPE; // proceed with next step } - @NotNull @Override public Collection getSuggestions() { + @Nonnull @Override public Collection getSuggestions() { return Collections.unmodifiableSet(SetupUtils.generators.keySet()); } @@ -243,7 +243,7 @@ public enum CommonSetupSteps implements SetupStep { } }; - @Getter @NotNull private final Collection suggestions; + @Getter @Nonnull private final Collection suggestions; private final Caption description; /** @@ -251,17 +251,17 @@ public enum CommonSetupSteps implements SetupStep { * @param suggestions the input suggestions for this step * @param description the caption describing this step */ - CommonSetupSteps(@NotNull Collection suggestions, @NotNull Caption description) { + CommonSetupSteps(@Nonnull Collection suggestions, @Nonnull Caption description) { this.suggestions = suggestions; this.description = description; } - CommonSetupSteps(@NotNull Caption description) { + CommonSetupSteps(@Nonnull Caption description) { this.description = description; this.suggestions = Collections.emptyList(); } - > CommonSetupSteps(@NotNull Class argumentType, Caption description) { + > CommonSetupSteps(@Nonnull Class argumentType, Caption description) { this(enumToStrings(argumentType), description); } diff --git a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java index d216f067c..f53359f5d 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java +++ b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java @@ -33,8 +33,8 @@ import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.TabCompletions; import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Collection; import java.util.Collections; @@ -64,7 +64,7 @@ public class SettingsNodeStep implements SetupStep { return this.next; } - @NotNull @Override public Collection getSuggestions() { + @Nonnull @Override public Collection getSuggestions() { return this.configurationNode.getSuggestions(); } diff --git a/Core/src/main/java/com/plotsquared/core/setup/SetupStep.java b/Core/src/main/java/com/plotsquared/core/setup/SetupStep.java index 5befafc81..308757c0d 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/SetupStep.java +++ b/Core/src/main/java/com/plotsquared/core/setup/SetupStep.java @@ -28,8 +28,8 @@ package com.plotsquared.core.setup; import com.plotsquared.core.command.Command; import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.player.PlotPlayer; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -47,7 +47,7 @@ public interface SetupStep { */ SetupStep handleInput(final PlotPlayer plotPlayer, PlotAreaBuilder builder, String argument); - @NotNull Collection getSuggestions(); + @Nonnull Collection getSuggestions(); @Nullable String getDefaultValue(); 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 2eef1e3f6..a0f4e4f50 100644 --- a/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java @@ -35,7 +35,7 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.FuzzyBlockState; import com.sk89q.worldedit.world.registry.LegacyMapper; -import lombok.NonNull; +import javax.annotation.Nonnull; import java.util.Map; @@ -99,7 +99,7 @@ public final class BlockUtil { return result; } - public static BlockState deserialize(@NonNull final Map map) { + public static BlockState deserialize(@Nonnull final Map map) { if (map.containsKey("material")) { final Object object = map.get("material"); return get(object.toString()); diff --git a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java index 9bbc4e1aa..098604597 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java @@ -29,8 +29,8 @@ import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag; -import lombok.NonNull; import lombok.experimental.UtilityClass; +import javax.annotation.Nonnull; import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL; import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY; @@ -45,7 +45,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE; @UtilityClass public final class EntityUtil { - private static int capNumeral(@NonNull final String flagName) { + private static int capNumeral(@Nonnull final String flagName) { int i; switch (flagName) { case "mob-cap": diff --git a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java index c70ed6002..2dc715a09 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java +++ b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java @@ -72,8 +72,8 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; @@ -105,7 +105,7 @@ public class EventDispatcher { } } - public void callEvent(@NotNull final PlotEvent event) { + public void callEvent(@Nonnull final PlotEvent event) { eventBus.post(event); } @@ -263,7 +263,7 @@ public class EventDispatcher { } } - public boolean checkPlayerBlockEvent(PlotPlayer player, @NotNull PlayerBlockEventType type, + public boolean checkPlayerBlockEvent(PlotPlayer player, @Nonnull PlayerBlockEventType type, Location location, BlockType blockType, boolean notifyPerms) { PlotArea area = location.getPlotArea(); assert area != null; 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 49b5fc70d..fdff6c4a2 100644 --- a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java +++ b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java @@ -32,7 +32,7 @@ import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.plot.BlockBucket; import com.sk89q.worldedit.world.block.BlockState; -import lombok.NonNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.HashMap; @@ -59,24 +59,24 @@ public final class LegacyConverter { private final ConfigurationSection configuration; - public LegacyConverter(@NonNull final ConfigurationSection configuration) { + public LegacyConverter(@Nonnull final ConfigurationSection configuration) { this.configuration = configuration; } - private BlockBucket blockToBucket(@NonNull final String block) { + private BlockBucket blockToBucket(@Nonnull final String block) { final BlockState plotBlock = PlotSquared.platform().getWorldUtil().getClosestBlock(block).best; return BlockBucket.withSingle(plotBlock); } - private void setString(@NonNull final ConfigurationSection section, - @NonNull final String string, @NonNull final BlockBucket blocks) { + private void setString(@Nonnull final ConfigurationSection section, + @Nonnull final String string, @Nonnull final BlockBucket blocks) { if (!section.contains(string)) { throw new IllegalArgumentException(String.format("No such key: %s", string)); } section.set(string, blocks.toString()); } - private BlockBucket blockListToBucket(@NonNull final BlockState[] blocks) { + private BlockBucket blockListToBucket(@Nonnull final BlockState[] blocks) { final Map counts = new HashMap<>(); for (final BlockState block : blocks) { counts.putIfAbsent(block, 0); @@ -100,13 +100,13 @@ public final class LegacyConverter { return bucket; } - private BlockState[] splitBlockList(@NonNull final List list) { + private BlockState[] splitBlockList(@Nonnull final List list) { return list.stream().map(s -> PlotSquared.platform().getWorldUtil().getClosestBlock(s).best) .toArray(BlockState[]::new); } - private void convertBlock(@NonNull final ConfigurationSection section, - @NonNull final String key, @NonNull final String block) { + private void convertBlock(@Nonnull final ConfigurationSection section, + @Nonnull final String key, @Nonnull final String block) { final BlockBucket bucket = this.blockToBucket(block); this.setString(section, key, bucket); PlotSquared.log(CaptionUtility @@ -114,8 +114,8 @@ public final class LegacyConverter { block, bucket.toString())); } - private void convertBlockList(@NonNull final ConfigurationSection section, - @NonNull final String key, @NonNull final List blockList) { + private void convertBlockList(@Nonnull final ConfigurationSection section, + @Nonnull final String key, @Nonnull final List blockList) { final BlockState[] blocks = this.splitBlockList(blockList); final BlockBucket bucket = this.blockListToBucket(blocks); this.setString(section, key, bucket); @@ -124,7 +124,7 @@ public final class LegacyConverter { plotBlockArrayString(blocks), bucket.toString())); } - private String plotBlockArrayString(@NonNull final BlockState[] blocks) { + private String plotBlockArrayString(@Nonnull final BlockState[] blocks) { final StringBuilder builder = new StringBuilder(); for (int i = 0; i < blocks.length; i++) { builder.append(blocks[i].toString()); diff --git a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java index e86d3e8da..f8834a696 100644 --- a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java @@ -55,8 +55,8 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.io.IOException; @@ -375,7 +375,7 @@ public class MainUtil { * @param owner Owner UUID * @return The player's name, None, Everyone or Unknown */ - @NotNull public static String getName(@Nullable UUID owner) { + @Nonnull public static String getName(@Nullable UUID owner) { return getName(owner, true); } @@ -386,7 +386,7 @@ public class MainUtil { * @param blocking Whether or not the operation can be blocking * @return The player's name, None, Everyone or Unknown */ - @NotNull public static String getName(@Nullable final UUID owner, final boolean blocking) { + @Nonnull public static String getName(@Nullable final UUID owner, final boolean blocking) { if (owner == null) { return Captions.NONE.getTranslated(); } @@ -417,7 +417,7 @@ public class MainUtil { return plot.getFlag(ServerPlotFlag.class); } - @NotNull public static Location[] getCorners(@NotNull final String world, @NotNull final CuboidRegion region) { + @Nonnull public static Location[] getCorners(@Nonnull final String world, @Nonnull final CuboidRegion region) { final BlockVector3 min = region.getMinimumPoint(); final BlockVector3 max = region.getMaximumPoint(); return new Location[] {Location.at(world, min), Location.at(world, max)}; @@ -431,7 +431,7 @@ public class MainUtil { * @return * @see Plot#getCorners() */ - @NotNull public static Location[] getCorners(String world, Collection regions) { + @Nonnull public static Location[] getCorners(String world, Collection regions) { Location min = null; Location max = null; for (CuboidRegion region : regions) { @@ -657,7 +657,7 @@ public class MainUtil { * @param prefix If the message should be prefixed with the configured prefix * @return */ - public static boolean sendMessage(PlotPlayer player, @NotNull String msg, boolean prefix) { + public static boolean sendMessage(PlotPlayer player, @Nonnull String msg, boolean prefix) { if (!msg.isEmpty()) { if (player == null) { String message = CaptionUtility @@ -924,7 +924,7 @@ public class MainUtil { } /* - @NotNull public static String getName(UUID owner) { + @Nonnull public static String getName(UUID owner) { if (owner == null) { return Captions.NONE.getTranslated(); } diff --git a/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java b/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java index 1bf55bfac..d4eda5ff4 100644 --- a/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/OperationUtil.java @@ -37,8 +37,8 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.world.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; import java.util.concurrent.Future; @@ -74,7 +74,7 @@ public class OperationUtil { if (actor instanceof Player) { weWorld = ((Player) actor).getWorld(); } else { - @NotNull Location loc = plotPlayer.getLocation(); + @Nonnull Location loc = plotPlayer.getLocation(); String world = loc.getWorldName(); weWorld = getWorld(world); } @@ -106,8 +106,8 @@ public class OperationUtil { return editSession; } - public Future withEditSession(@NotNull PlotPlayer plotPlayer, - @NotNull Consumer consumer, @Nullable Consumer exceptionHandler) { + public Future withEditSession(@Nonnull PlotPlayer plotPlayer, + @Nonnull Consumer consumer, @Nullable Consumer exceptionHandler) { if (ASYNC) { ListeningExecutorService exec = WorldEdit.getInstance().getExecutorService(); return exec diff --git a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java index c8d18c136..5f2487dbc 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java @@ -41,14 +41,14 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; public class PatternUtil { - public static BaseBlock apply(@NotNull Pattern pattern, int x, int y, int z) { + public static BaseBlock apply(@Nonnull Pattern pattern, int x, int y, int z) { Preconditions.checkNotNull(pattern, "Pattern may not be null"); if (pattern instanceof BlockPattern || pattern instanceof RandomPattern || pattern instanceof BlockState || pattern instanceof BlockType diff --git a/Core/src/main/java/com/plotsquared/core/util/PlatformWorldManager.java b/Core/src/main/java/com/plotsquared/core/util/PlatformWorldManager.java index c304ff04c..68a2be439 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PlatformWorldManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/PlatformWorldManager.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.util; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Collection; @@ -54,7 +54,7 @@ public interface PlatformWorldManager { * @param generator World generator * @return Created world */ - @Nullable T handleWorldCreation(@NotNull final String worldName, + @Nullable T handleWorldCreation(@Nonnull final String worldName, @Nullable final String generator); /** 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 8c4ec1bea..4cba66d9a 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java @@ -27,8 +27,8 @@ package com.plotsquared.core.util; import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.PlotPlayer; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -50,7 +50,7 @@ public abstract class PlayerManager

, T> { * * @param plotPlayer Player to remove */ - public void removePlayer(@NotNull final PlotPlayer plotPlayer) { + public void removePlayer(@Nonnull final PlotPlayer plotPlayer) { synchronized (playerLock) { this.playerMap.remove(plotPlayer.getUUID()); } @@ -61,7 +61,7 @@ public abstract class PlayerManager

, T> { * * @param uuid Player to remove */ - public void removePlayer(@NotNull final UUID uuid) { + public void removePlayer(@Nonnull final UUID uuid) { synchronized (playerLock) { this.playerMap.remove(uuid); } @@ -99,7 +99,7 @@ public abstract class PlayerManager

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

, T> { * @param uuid Player UUID * @return Player object */ - @NotNull public P getPlayer(@NotNull final UUID uuid) { + @Nonnull public P getPlayer(@Nonnull final UUID uuid) { synchronized (playerLock) { P player = this.playerMap.get(uuid); if (player == null) { @@ -122,7 +122,7 @@ public abstract class PlayerManager

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

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

, T> { public static final class NoSuchPlayerException extends IllegalArgumentException { - public NoSuchPlayerException(@NotNull final UUID uuid) { + public NoSuchPlayerException(@Nonnull final UUID uuid) { super(String.format("There is no online player with UUID '%s'", uuid.toString())); } diff --git a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java index c6502ed26..c7bbb3b5a 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java @@ -37,7 +37,7 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.File; import java.util.Collection; @@ -54,7 +54,7 @@ public abstract class RegionManager { private final ChunkManager chunkManager; - public RegionManager(@NotNull final ChunkManager chunkManager) { + public RegionManager(@Nonnull final ChunkManager chunkManager) { this.chunkManager = chunkManager; } diff --git a/Core/src/main/java/com/plotsquared/core/util/RegionUtil.java b/Core/src/main/java/com/plotsquared/core/util/RegionUtil.java index 6c16c4a9e..ffce29963 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RegionUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/RegionUtil.java @@ -29,7 +29,7 @@ import com.plotsquared.core.plot.Plot; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.awt.geom.Rectangle2D; @@ -58,7 +58,7 @@ public class RegionUtil { .getY() && y <= max.getY(); } - @NotNull public static Rectangle2D toRectangle(@NotNull final CuboidRegion region) { + @Nonnull public static Rectangle2D toRectangle(@Nonnull final CuboidRegion region) { final BlockVector2 min = region.getMinimumPoint().toBlockVector2(); final BlockVector2 max = region.getMaximumPoint().toBlockVector2(); return new Rectangle2D.Double(min.getX(), min.getZ(), max.getX(), max.getZ()); 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 c2c063e17..29f5d0013 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -58,7 +58,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.json.JSONArray; import org.json.JSONException; @@ -98,7 +98,7 @@ public abstract class SchematicHandler { private final WorldUtil worldUtil; - public SchematicHandler(@NotNull final WorldUtil worldUtil) { + public SchematicHandler(@Nonnull final WorldUtil worldUtil) { this.worldUtil = worldUtil; } @@ -384,7 +384,7 @@ public abstract class SchematicHandler { return null; } - public Schematic getSchematic(@NotNull URL url) { + public Schematic getSchematic(@Nonnull URL url) { try { ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream()); InputStream inputStream = Channels.newInputStream(readableByteChannel); @@ -395,7 +395,7 @@ public abstract class SchematicHandler { return null; } - public Schematic getSchematic(@NotNull InputStream is) { + public Schematic getSchematic(@Nonnull InputStream is) { try { SpongeSchematicReader schematicReader = new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is))); diff --git a/Core/src/main/java/com/plotsquared/core/util/StringMan.java b/Core/src/main/java/com/plotsquared/core/util/StringMan.java index c5c215d67..791a27783 100644 --- a/Core/src/main/java/com/plotsquared/core/util/StringMan.java +++ b/Core/src/main/java/com/plotsquared/core/util/StringMan.java @@ -26,7 +26,7 @@ package com.plotsquared.core.util; import com.plotsquared.core.configuration.Caption; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.lang.reflect.Array; import java.util.Arrays; @@ -266,7 +266,7 @@ public class StringMan { return false; } - public static boolean isEqualIgnoreCaseToAny(@NotNull String a, String... args) { + public static boolean isEqualIgnoreCaseToAny(@Nonnull String a, String... args) { for (String arg : args) { if (a.equalsIgnoreCase(arg)) { return true; diff --git a/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java b/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java index fbca485cd..158818719 100644 --- a/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java +++ b/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java @@ -37,7 +37,7 @@ import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.uuid.UUIDMapping; import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Arrays; @@ -74,8 +74,8 @@ public class TabCompletions { * @param existing Players that should not be included in completions * @return List of completions */ - @NotNull public List completePlayers(@NotNull final String input, - @NotNull final List existing) { + @Nonnull public List completePlayers(@Nonnull final String input, + @Nonnull final List existing) { return completePlayers("players", input, existing, uuid -> true); } @@ -87,16 +87,16 @@ public class TabCompletions { * @param existing Players that should not be included in completions * @return List of completions */ - @NotNull public List completeAddedPlayers(@NotNull final Plot plot, @NotNull final String input, - @NotNull final List existing) { + @Nonnull public List completeAddedPlayers(@Nonnull final Plot plot, @Nonnull final String input, + @Nonnull final List existing) { return completePlayers("added" + plot, input, existing, uuid -> plot.getMembers().contains(uuid) || plot.getTrusted().contains(uuid) || plot.getDenied().contains(uuid)); } - @NotNull public List completePlayersInPlot(@NotNull final Plot plot, @NotNull final String input, - @NotNull final List existing) { + @Nonnull public List completePlayersInPlot(@Nonnull final Plot plot, @Nonnull final String input, + @Nonnull final List existing) { List players = cachedCompletionValues.getIfPresent("inPlot" + plot); if (players == null) { final List> inPlot = plot.getPlayersInPlot(); @@ -116,7 +116,7 @@ public class TabCompletions { * @param input Command input * @return List of completions */ - @NotNull public List completePatterns(@NotNull final String input) { + @Nonnull public List completePatterns(@Nonnull final String input) { return PatternUtil.getSuggestions(input.trim()).stream() .map(value -> value.toLowerCase(Locale.ENGLISH).replace("minecraft:", "")) .filter(value -> value.startsWith(input.toLowerCase(Locale.ENGLISH))) @@ -124,7 +124,7 @@ public class TabCompletions { }).collect(Collectors.toList()); } - @NotNull public List completeBoolean(@NotNull final String input) { + @Nonnull public List completeBoolean(@Nonnull final String input) { if (input.isEmpty()) { return Arrays.asList(booleanTrueCompletion, booleanFalseCompletion); } @@ -146,7 +146,7 @@ public class TabCompletions { * @param highestLimit Highest number to include * @return Unmodifiable list of number completions */ - @NotNull public List completeNumbers(@NotNull final String input, + @Nonnull public List completeNumbers(@Nonnull final String input, final int amountLimit, final int highestLimit) { if (input.isEmpty() || input.length() > highestLimit || !MathMan.isInteger(input)) { return Collections.emptyList(); @@ -171,7 +171,7 @@ public class TabCompletions { * @param input Input to filter with * @return Unmodifiable list of area completions */ - @NotNull public List completeAreas(@NotNull final String input) { + @Nonnull public List completeAreas(@Nonnull final String input) { final List completions = new ArrayList<>(); for (final PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) { String areaName = area.getWorldName(); @@ -187,7 +187,7 @@ public class TabCompletions { return Collections.unmodifiableList(completions); } - @NotNull public List asCompletions(String... toFilter) { + @Nonnull public List asCompletions(String... toFilter) { final List completions = new ArrayList<>(); for (String completion : toFilter) { completions.add(new Command(null, false, completion, "", @@ -203,9 +203,9 @@ public class TabCompletions { * @param uuidFilter Filter applied before caching values * @return List of completions */ - private List completePlayers(@NotNull final String cacheIdentifier, @NotNull final String input, - @NotNull final List existing, - @NotNull final Predicate uuidFilter) { + private List completePlayers(@Nonnull final String cacheIdentifier, @Nonnull final String input, + @Nonnull final List existing, + @Nonnull final Predicate uuidFilter) { List players; if (Settings.Enabled_Components.EXTENDED_USERNAME_COMPLETION) { players = cachedCompletionValues.getIfPresent(cacheIdentifier); 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 179bf3b91..5d58c1c19 100644 --- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java @@ -41,7 +41,7 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.entity.EntityType; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.ByteArrayOutputStream; import java.io.File; @@ -64,7 +64,7 @@ public abstract class WorldUtil { private final RegionManager regionManager; - public WorldUtil(@NotNull final RegionManager regionManager) { + public WorldUtil(@Nonnull final RegionManager regionManager) { this.regionManager = regionManager; } @@ -118,7 +118,7 @@ public abstract class WorldUtil { public abstract com.sk89q.worldedit.world.World getWeWorld(String world); - public void upload(@NotNull final Plot plot, UUID uuid, String file, + public void upload(@Nonnull final Plot plot, UUID uuid, String file, RunnableVal whenDone) { plot.getHome(home -> MainUtil.upload(uuid, file, "zip", new RunnableVal() { @Override public void run(OutputStream output) { diff --git a/Core/src/main/java/com/plotsquared/core/util/query/AliasFilter.java b/Core/src/main/java/com/plotsquared/core/util/query/AliasFilter.java index 808f34797..a4e40867c 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/AliasFilter.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/AliasFilter.java @@ -26,17 +26,17 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; class AliasFilter implements PlotFilter { private final String alias; - AliasFilter(@NotNull final String alias) { + AliasFilter(@Nonnull final String alias) { this.alias = alias; } - @Override public boolean accepts(@NotNull final Plot plot) { + @Override public boolean accepts(@Nonnull final Plot plot) { return this.alias.equalsIgnoreCase(plot.getAlias()); } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/FixedPlotProvider.java b/Core/src/main/java/com/plotsquared/core/util/query/FixedPlotProvider.java index 3bf79c783..a7b2f587a 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/FixedPlotProvider.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/FixedPlotProvider.java @@ -26,7 +26,7 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; @@ -35,7 +35,7 @@ class FixedPlotProvider implements PlotProvider { private final Plot plot; - FixedPlotProvider(@NotNull final Plot plot) { + FixedPlotProvider(@Nonnull final Plot plot) { this.plot = plot; } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/GlobalPlotProvider.java b/Core/src/main/java/com/plotsquared/core/util/query/GlobalPlotProvider.java index 734de0b1b..865ae323c 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/GlobalPlotProvider.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/GlobalPlotProvider.java @@ -28,7 +28,7 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.world.PlotAreaManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.HashSet; @@ -38,7 +38,7 @@ class GlobalPlotProvider implements PlotProvider { private final PlotAreaManager plotAreaManager; - GlobalPlotProvider(@NotNull final PlotAreaManager plotAreaManager) { + GlobalPlotProvider(@Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/MemberFilter.java b/Core/src/main/java/com/plotsquared/core/util/query/MemberFilter.java index 3f9670d08..fa050ed0c 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/MemberFilter.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/MemberFilter.java @@ -26,19 +26,19 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.UUID; class MemberFilter implements PlotFilter { - @NotNull private final UUID uuid; + @Nonnull private final UUID uuid; - MemberFilter(@NotNull final UUID uuid) { + MemberFilter(@Nonnull final UUID uuid) { this.uuid = uuid; } - @Override public boolean accepts(@NotNull final Plot plot) { + @Override public boolean accepts(@Nonnull final Plot plot) { return plot.isAdded(uuid); } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/OwnerFilter.java b/Core/src/main/java/com/plotsquared/core/util/query/OwnerFilter.java index cae258722..3d59a70c8 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/OwnerFilter.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/OwnerFilter.java @@ -26,7 +26,7 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Objects; import java.util.UUID; @@ -35,11 +35,11 @@ class OwnerFilter implements PlotFilter { private final UUID owner; - OwnerFilter(@NotNull final UUID owner) { + OwnerFilter(@Nonnull final UUID owner) { this.owner = owner; } - @Override public boolean accepts(@NotNull final Plot plot) { + @Override public boolean accepts(@Nonnull final Plot plot) { return plot.hasOwner() && Objects.equals(plot.getOwnerAbs(), this.owner); } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/PaginatedPlotResult.java b/Core/src/main/java/com/plotsquared/core/util/query/PaginatedPlotResult.java index 2c0ed9152..bb6531e49 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/PaginatedPlotResult.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/PaginatedPlotResult.java @@ -27,7 +27,7 @@ package com.plotsquared.core.util.query; import com.google.common.base.Preconditions; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -40,7 +40,7 @@ public final class PaginatedPlotResult { private final List plots; private final int pageSize; - PaginatedPlotResult(@NotNull final List plots, final int pageSize) { + PaginatedPlotResult(@Nonnull final List plots, final int pageSize) { this.plots = plots; this.pageSize = pageSize; } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/PlotFilter.java b/Core/src/main/java/com/plotsquared/core/util/query/PlotFilter.java index c017b21b0..4e93ff5e4 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/PlotFilter.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/PlotFilter.java @@ -26,16 +26,16 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.function.Predicate; @FunctionalInterface interface PlotFilter extends Predicate { - @Override default boolean test(@NotNull final Plot plot) { + @Override default boolean test(@Nonnull final Plot plot) { return this.accepts(plot); } - boolean accepts(@NotNull final Plot plot); + boolean accepts(@Nonnull final Plot plot); } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java b/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java index 81139dc09..03c41dd8e 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java @@ -34,7 +34,7 @@ import com.plotsquared.core.plot.Rating; import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.util.MathMan; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; @@ -66,7 +66,7 @@ public final class PlotQuery { private PlotArea priorityArea; private Comparator plotComparator; - private PlotQuery(@NotNull final PlotAreaManager plotAreaManager) { + private PlotQuery(@Nonnull final PlotAreaManager plotAreaManager) { this.plotAreaManager = plotAreaManager; this.plotProvider = new GlobalPlotProvider(plotAreaManager); } @@ -86,7 +86,7 @@ public final class PlotQuery { * @param area Area * @return The query instance */ - @NotNull public PlotQuery inArea(@NotNull final PlotArea area) { + @Nonnull public PlotQuery inArea(@Nonnull final PlotArea area) { Preconditions.checkNotNull(area, "Area may not be null"); this.plotProvider = new AreaLimitedPlotProvider(Collections.singletonList(area)); return this; @@ -98,7 +98,7 @@ public final class PlotQuery { * @param world World name * @return The query instance */ - @NotNull public PlotQuery inWorld(@NotNull final String world) { + @Nonnull public PlotQuery inWorld(@Nonnull final String world) { Preconditions.checkNotNull(world, "World may not be null"); this.plotProvider = new AreaLimitedPlotProvider(this.plotAreaManager.getPlotAreasSet(world)); return this; @@ -110,7 +110,7 @@ public final class PlotQuery { * @param areas Plot areas * @return The query instance */ - @NotNull public PlotQuery inAreas(@NotNull final Collection areas) { + @Nonnull public PlotQuery inAreas(@Nonnull final Collection areas) { Preconditions.checkNotNull(areas, "Areas may not be null"); Preconditions.checkState(!areas.isEmpty(), "At least one area must be provided"); this.plotProvider = new AreaLimitedPlotProvider(Collections.unmodifiableCollection(areas)); @@ -122,7 +122,7 @@ public final class PlotQuery { * * @return The query instance */ - @NotNull public PlotQuery expiredPlots() { + @Nonnull public PlotQuery expiredPlots() { this.plotProvider = new ExpiredPlotProvider(); return this; } @@ -132,7 +132,7 @@ public final class PlotQuery { * * @return The query instance */ - @NotNull public PlotQuery allPlots() { + @Nonnull public PlotQuery allPlots() { this.plotProvider = new GlobalPlotProvider(this.plotAreaManager); return this; } @@ -142,7 +142,7 @@ public final class PlotQuery { * * @return The query instance */ - @NotNull public PlotQuery noPlots() { + @Nonnull public PlotQuery noPlots() { this.plotProvider = new NullProvider(); return this; } @@ -152,7 +152,7 @@ public final class PlotQuery { * * @return The query instance */ - @NotNull public PlotQuery plotsBySearch(@NotNull final String searchTerm) { + @Nonnull public PlotQuery plotsBySearch(@Nonnull final String searchTerm) { Preconditions.checkNotNull(searchTerm, "Search term may not be null"); this.plotProvider = new SearchPlotProvider(searchTerm); return this; @@ -163,7 +163,7 @@ public final class PlotQuery { * * @return The query instance */ - @NotNull public PlotQuery withPlot(@NotNull final Plot plot) { + @Nonnull public PlotQuery withPlot(@Nonnull final Plot plot) { Preconditions.checkNotNull(plot, "Plot may not be null"); this.plotProvider = new FixedPlotProvider(plot); return this; @@ -174,7 +174,7 @@ public final class PlotQuery { * * @return The query instance */ - @NotNull public PlotQuery whereBasePlot() { + @Nonnull public PlotQuery whereBasePlot() { return this.addFilter(new PredicateFilter(Plot::isBasePlot)); } @@ -184,7 +184,7 @@ public final class PlotQuery { * @param owner Owner UUID * @return The query instance */ - @NotNull public PlotQuery ownedBy(@NotNull final UUID owner) { + @Nonnull public PlotQuery ownedBy(@Nonnull final UUID owner) { Preconditions.checkNotNull(owner, "Owner may not be null"); return this.addFilter(new OwnerFilter(owner)); } @@ -195,7 +195,7 @@ public final class PlotQuery { * @param owner Owner * @return The query instance */ - @NotNull public PlotQuery ownedBy(@NotNull final PlotPlayer owner) { + @Nonnull public PlotQuery ownedBy(@Nonnull final PlotPlayer owner) { Preconditions.checkNotNull(owner, "Owner may not be null"); return this.addFilter(new OwnerFilter(owner.getUUID())); } @@ -206,7 +206,7 @@ public final class PlotQuery { * @param alias Plot alias * @return The query instance */ - @NotNull public PlotQuery withAlias(@NotNull final String alias) { + @Nonnull public PlotQuery withAlias(@Nonnull final String alias) { Preconditions.checkNotNull(alias, "Alias may not be null"); return this.addFilter(new AliasFilter(alias)); } @@ -217,7 +217,7 @@ public final class PlotQuery { * @param member Member UUID * @return The query instance */ - @NotNull public PlotQuery withMember(@NotNull final UUID member) { + @Nonnull public PlotQuery withMember(@Nonnull final UUID member) { Preconditions.checkNotNull(member, "Member may not be null"); return this.addFilter(new MemberFilter(member)); } @@ -228,7 +228,7 @@ public final class PlotQuery { * @param predicate Predicate * @return The query instance */ - @NotNull public PlotQuery thatPasses(@NotNull final Predicate predicate) { + @Nonnull public PlotQuery thatPasses(@Nonnull final Predicate predicate) { Preconditions.checkNotNull(predicate, "Predicate may not be null"); return this.addFilter(new PredicateFilter(predicate)); } @@ -240,7 +240,7 @@ public final class PlotQuery { * @param strategy Strategy * @return The query instance */ - @NotNull public PlotQuery withSortingStrategy(@NotNull final SortingStrategy strategy) { + @Nonnull public PlotQuery withSortingStrategy(@Nonnull final SortingStrategy strategy) { Preconditions.checkNotNull(strategy, "Strategy may not be null"); this.sortingStrategy = strategy; return this; @@ -252,7 +252,7 @@ public final class PlotQuery { * @param comparator Comparator * @return The query instance */ - @NotNull public PlotQuery sorted(@NotNull final Comparator comparator) { + @Nonnull public PlotQuery sorted(@Nonnull final Comparator comparator) { Preconditions.checkNotNull(comparator, "Comparator may not be null"); this.sortingStrategy = SortingStrategy.COMPARATOR; this.plotComparator = comparator; @@ -266,7 +266,7 @@ public final class PlotQuery { * @param plotArea Plot area * @return The query instance */ - @NotNull public PlotQuery relativeToArea(@NotNull final PlotArea plotArea) { + @Nonnull public PlotQuery relativeToArea(@Nonnull final PlotArea plotArea) { Preconditions.checkNotNull(plotArea, "Area may not be null"); this.priorityArea = plotArea; return this; @@ -277,7 +277,7 @@ public final class PlotQuery { * * @return Matching plots */ - @NotNull public Stream asStream() { + @Nonnull public Stream asStream() { return this.asList().stream(); } @@ -286,7 +286,7 @@ public final class PlotQuery { * * @return Matching plots as a mutable */ - @NotNull public List asList() { + @Nonnull public List asList() { final List result; if (this.filters.isEmpty()) { result = new ArrayList<>(this.plotProvider.getPlots()); @@ -356,7 +356,7 @@ public final class PlotQuery { * * @return Matching plots as a mutable set */ - @NotNull public Set asSet() { + @Nonnull public Set asSet() { return new HashSet<>(this.asList()); } @@ -367,7 +367,7 @@ public final class PlotQuery { * @param pageSize The size of the pages. Must be positive. * @return Paginated plot result */ - @NotNull public PaginatedPlotResult getPaginated(final int pageSize) { + @Nonnull public PaginatedPlotResult getPaginated(final int pageSize) { Preconditions.checkState(pageSize > 0, "Page size must be greater than 0"); return new PaginatedPlotResult(this.asList(), pageSize); } @@ -377,7 +377,7 @@ public final class PlotQuery { * * @return Matching plots as an immutable collection */ - @NotNull public Collection asCollection() { + @Nonnull public Collection asCollection() { return this.asList(); } @@ -386,7 +386,7 @@ public final class PlotQuery { * * @param consumer Plot consumer */ - public void forEach(@NotNull final Consumer consumer) { + public void forEach(@Nonnull final Consumer consumer) { Preconditions.checkNotNull(consumer, "Consumer may not be null"); this.asCollection().forEach(consumer); } @@ -424,7 +424,7 @@ public final class PlotQuery { } } - @NotNull private PlotQuery addFilter(@NotNull final PlotFilter filter) { + @Nonnull private PlotQuery addFilter(@Nonnull final PlotFilter filter) { this.filters.add(filter); return this; } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/PredicateFilter.java b/Core/src/main/java/com/plotsquared/core/util/query/PredicateFilter.java index dd68f081d..fa07afe80 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/PredicateFilter.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/PredicateFilter.java @@ -26,7 +26,7 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.function.Predicate; @@ -34,11 +34,11 @@ class PredicateFilter implements PlotFilter { private final Predicate predicate; - PredicateFilter(@NotNull final Predicate predicate) { + PredicateFilter(@Nonnull final Predicate predicate) { this.predicate = predicate; } - @Override public boolean accepts(@NotNull final Plot plot) { + @Override public boolean accepts(@Nonnull final Plot plot) { return predicate.test(plot); } diff --git a/Core/src/main/java/com/plotsquared/core/util/query/SearchPlotProvider.java b/Core/src/main/java/com/plotsquared/core/util/query/SearchPlotProvider.java index 91193a79e..f838dc807 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/SearchPlotProvider.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/SearchPlotProvider.java @@ -27,7 +27,7 @@ package com.plotsquared.core.util.query; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.util.MainUtil; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collection; @@ -35,7 +35,7 @@ class SearchPlotProvider implements PlotProvider { private final String searchTerm; - SearchPlotProvider(@NotNull final String searchTerm) { + SearchPlotProvider(@Nonnull final String searchTerm) { this.searchTerm = searchTerm; } diff --git a/Core/src/main/java/com/plotsquared/core/uuid/CacheUUIDService.java b/Core/src/main/java/com/plotsquared/core/uuid/CacheUUIDService.java index 563618afa..d7aea4a92 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/CacheUUIDService.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/CacheUUIDService.java @@ -27,8 +27,8 @@ package com.plotsquared.core.uuid; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -57,13 +57,13 @@ public class CacheUUIDService implements UUIDService, Consumer this.uuidCache = CacheBuilder.newBuilder().maximumSize(size).build(); } - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { final List mappings = new ArrayList<>(uuids.size()); mappings.addAll(this.uuidCache.getAllPresent(uuids).values()); return mappings; } - @Override @NotNull public List getUUIDs(@NotNull final List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull final List usernames) { final List mappings = new ArrayList<>(usernames.size()); mappings.addAll(this.usernameCache.getAllPresent(usernames).values()); return mappings; @@ -76,7 +76,7 @@ public class CacheUUIDService implements UUIDService, Consumer } } - @Override @NotNull public Collection getImmediately() { + @Override @Nonnull public Collection getImmediately() { return this.usernameCache.asMap().values(); } @@ -84,7 +84,7 @@ public class CacheUUIDService implements UUIDService, Consumer return true; } - @Override @Nullable public UUIDMapping getImmediately(@NotNull final Object object) { + @Override @Nullable public UUIDMapping getImmediately(@Nonnull final Object object) { final List list; if (object instanceof String) { list = getUUIDs(Collections.singletonList((String) object)); diff --git a/Core/src/main/java/com/plotsquared/core/uuid/ServiceError.java b/Core/src/main/java/com/plotsquared/core/uuid/ServiceError.java index 0e248a2c5..74ad42422 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/ServiceError.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/ServiceError.java @@ -25,18 +25,18 @@ */ package com.plotsquared.core.uuid; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * Thrown by {@link ServiceError} when something goes wrong */ public class ServiceError extends RuntimeException { - public ServiceError(@NotNull final String message) { + public ServiceError(@Nonnull final String message) { super(message); } - public ServiceError(@NotNull final String message, @NotNull final Throwable cause) { + public ServiceError(@Nonnull final String message, @Nonnull final Throwable cause) { super(message, cause); } diff --git a/Core/src/main/java/com/plotsquared/core/uuid/UUIDMapping.java b/Core/src/main/java/com/plotsquared/core/uuid/UUIDMapping.java index 35a4c6c2c..bee1f2d4c 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/UUIDMapping.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/UUIDMapping.java @@ -26,7 +26,7 @@ package com.plotsquared.core.uuid; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.UUID; @@ -38,16 +38,16 @@ import java.util.UUID; private final UUID uuid; private final String username; - public UUIDMapping(@NotNull final UUID uuid, final String username) { + public UUIDMapping(@Nonnull final UUID uuid, final String username) { this.uuid = uuid; this.username = username; } - @NotNull public String getUsername() { + @Nonnull public String getUsername() { return this.username; } - @NotNull public UUID getUuid() { + @Nonnull public UUID getUuid() { return this.uuid; } 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 997cdfdc1..839de3e49 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java @@ -31,8 +31,8 @@ import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.util.ThreadUtils; import com.plotsquared.core.util.task.TaskManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -73,7 +73,7 @@ public class UUIDPipeline { * @param executor Executor that is used to run asynchronous tasks inside * of the pipeline */ - public UUIDPipeline(@NotNull final Executor executor) { + public UUIDPipeline(@Nonnull final Executor executor) { this.executor = executor; this.serviceList = Lists.newLinkedList(); this.consumerList = Lists.newLinkedList(); @@ -85,7 +85,7 @@ public class UUIDPipeline { * * @param uuidService UUID service to register */ - public void registerService(@NotNull final UUIDService uuidService) { + public void registerService(@Nonnull final UUIDService uuidService) { this.serviceList.add(uuidService); } @@ -94,7 +94,7 @@ public class UUIDPipeline { * * @param mappingConsumer Consumer to register */ - public void registerConsumer(@NotNull final Consumer> mappingConsumer) { + public void registerConsumer(@Nonnull final Consumer> mappingConsumer) { this.consumerList.add(mappingConsumer); } @@ -112,7 +112,7 @@ public class UUIDPipeline { * * @param mappings Mappings */ - public void consume(@NotNull final List mappings) { + public void consume(@Nonnull final List mappings) { final Runnable runnable = () -> { for (final Consumer> consumer : this.consumerList) { consumer.accept(mappings); @@ -130,7 +130,7 @@ public class UUIDPipeline { * * @param mapping Mapping to consume */ - public void consume(@NotNull final UUIDMapping mapping) { + public void consume(@Nonnull final UUIDMapping mapping) { this.consume(Collections.singletonList(mapping)); } @@ -143,7 +143,7 @@ public class UUIDPipeline { * @param username Player username * @param uuid Player uuid */ - public void storeImmediately(@NotNull final String username, @NotNull final UUID uuid) { + public void storeImmediately(@Nonnull final String username, @Nonnull final UUID uuid) { this.consume(new UUIDMapping(uuid, username)); } @@ -154,7 +154,7 @@ public class UUIDPipeline { * @param timeout Timeout in milliseconds * @return The mapped uuid. Will return null if the request timed out. */ - @Nullable public UUID getSingle(@NotNull final String username, final long timeout) { + @Nullable public UUID getSingle(@Nonnull final String username, final long timeout) { ThreadUtils.catchSync("Blocking UUID retrieval from the main thread"); try { final List mappings = this.getUUIDs(Collections.singletonList(username)).get(timeout, TimeUnit.MILLISECONDS); @@ -177,7 +177,7 @@ public class UUIDPipeline { * @param timeout Timeout in milliseconds * @return The mapped username. Will return null if the request timeout. */ - @Nullable public String getSingle(@NotNull final UUID uuid, final long timeout) { + @Nullable public String getSingle(@Nonnull final UUID uuid, final long timeout) { ThreadUtils.catchSync("Blocking username retrieval from the main thread"); try { final List mappings = this.getNames(Collections.singletonList(uuid)).get(timeout, TimeUnit.MILLISECONDS); @@ -199,8 +199,8 @@ public class UUIDPipeline { * @param username Username * @param uuid UUID consumer */ - public void getSingle(@NotNull final String username, - @NotNull final BiConsumer uuid) { + public void getSingle(@Nonnull final String username, + @Nonnull final BiConsumer uuid) { this.getUUIDs(Collections.singletonList(username)).applyToEither(timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), Function.identity()) .whenComplete((uuids, throwable) -> { if (throwable != null) { @@ -221,8 +221,8 @@ public class UUIDPipeline { * @param uuid UUID * @param username Username consumer */ - public void getSingle(@NotNull final UUID uuid, - @NotNull final BiConsumer username) { + public void getSingle(@Nonnull final UUID uuid, + @Nonnull final BiConsumer username) { this.getNames(Collections.singletonList(uuid)).applyToEither(timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), Function.identity()) .whenComplete((uuids, throwable) -> { if (throwable != null) { @@ -247,7 +247,7 @@ public class UUIDPipeline { * @param timeout Timeout in milliseconds * @return Mappings */ - public CompletableFuture> getNames(@NotNull final Collection requests, + public CompletableFuture> getNames(@Nonnull final Collection requests, final long timeout) { return this.getNames(requests).applyToEither(timeoutAfter(timeout), Function.identity()); } @@ -262,7 +262,7 @@ public class UUIDPipeline { * @param timeout Timeout in milliseconds * @return Mappings */ - public CompletableFuture> getUUIDs(@NotNull final Collection requests, + public CompletableFuture> getUUIDs(@Nonnull final Collection requests, final long timeout) { return this.getUUIDs(requests).applyToEither(timeoutAfter(timeout), Function.identity()); } @@ -279,7 +279,7 @@ public class UUIDPipeline { * @param requests UUIDs * @return Mappings */ - public CompletableFuture> getNames(@NotNull final Collection requests) { + public CompletableFuture> getNames(@Nonnull final Collection requests) { if (requests.isEmpty()) { return CompletableFuture.completedFuture(Collections.emptyList()); } @@ -342,7 +342,7 @@ public class UUIDPipeline { * @return Mappings */ public CompletableFuture> getUUIDs( - @NotNull final Collection requests) { + @Nonnull final Collection requests) { if (requests.isEmpty()) { return CompletableFuture.completedFuture(Collections.emptyList()); } @@ -397,7 +397,7 @@ public class UUIDPipeline { * * @return All mappings that could be provided immediately */ - @NotNull public final Collection getAllImmediately() { + @Nonnull public final Collection getAllImmediately() { final Set mappings = new LinkedHashSet<>(); for (final UUIDService service : this.getServiceListInstance()) { mappings.addAll(service.getImmediately()); @@ -411,7 +411,7 @@ public class UUIDPipeline { * @param object Username ({@link String}) or {@link UUID} * @return Mapping, if it could be found immediately */ - @Nullable public final UUIDMapping getImmediately(@NotNull final Object object) { + @Nullable public final UUIDMapping getImmediately(@Nonnull final Object object) { for (final UUIDService uuidService : this.getServiceListInstance()) { final UUIDMapping mapping = uuidService.getImmediately(object); if (mapping != null) { diff --git a/Core/src/main/java/com/plotsquared/core/uuid/UUIDService.java b/Core/src/main/java/com/plotsquared/core/uuid/UUIDService.java index f6fe86f11..fd766d2da 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/UUIDService.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/UUIDService.java @@ -25,8 +25,8 @@ */ package com.plotsquared.core.uuid; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Collection; import java.util.Collections; @@ -45,7 +45,7 @@ public interface UUIDService { * @param uuids Requests * @return Completed requests */ - @NotNull List getNames(@NotNull final List uuids); + @Nonnull List getNames(@Nonnull final List uuids); /** * Attempt to complete the given requests. Returns the mappings @@ -54,7 +54,7 @@ public interface UUIDService { * @param usernames Requests * @return Completed requests */ - @NotNull List getUUIDs(@NotNull final List usernames); + @Nonnull List getUUIDs(@Nonnull final List usernames); /** * Get as many UUID mappings as possible under the condition @@ -62,7 +62,7 @@ public interface UUIDService { * * @return All mappings that could be provided immediately */ - default @NotNull Collection getImmediately() { + default @Nonnull Collection getImmediately() { return Collections.emptyList(); } @@ -82,7 +82,7 @@ public interface UUIDService { * @param object Username ({@link String}) or {@link UUID} * @return Mapping, if it could be found immediately */ - default @Nullable UUIDMapping getImmediately(@NotNull final Object object) { + default @Nullable UUIDMapping getImmediately(@Nonnull final Object object) { return null; } diff --git a/Core/src/main/java/com/plotsquared/core/uuid/offline/OfflineModeUUIDService.java b/Core/src/main/java/com/plotsquared/core/uuid/offline/OfflineModeUUIDService.java index 49f038db8..15ffc98aa 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/offline/OfflineModeUUIDService.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/offline/OfflineModeUUIDService.java @@ -29,7 +29,7 @@ import com.google.common.base.Charsets; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDService; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; @@ -42,18 +42,18 @@ import java.util.UUID; */ public class OfflineModeUUIDService implements UUIDService { - @NotNull protected final UUID getFromUsername(@NotNull String username) { + @Nonnull protected final UUID getFromUsername(@Nonnull String username) { if (Settings.UUID.FORCE_LOWERCASE) { username = username.toLowerCase(Locale.ENGLISH); } return UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(Charsets.UTF_8)); } - @Override @NotNull public List getNames(@NotNull final List uuids) { + @Override @Nonnull public List getNames(@Nonnull final List uuids) { return Collections.emptyList(); } - @Override @NotNull public List getUUIDs(@NotNull List usernames) { + @Override @Nonnull public List getUUIDs(@Nonnull List usernames) { final List mappings = new ArrayList<>(usernames.size()); for (final String username : usernames) { mappings.add(new UUIDMapping(getFromUsername(username), username)); diff --git a/Core/src/test/java/com/plotsquared/core/database/AbstractDBTest.java b/Core/src/test/java/com/plotsquared/core/database/AbstractDBTest.java index d502bd520..0f268d3e4 100644 --- a/Core/src/test/java/com/plotsquared/core/database/AbstractDBTest.java +++ b/Core/src/test/java/com/plotsquared/core/database/AbstractDBTest.java @@ -32,7 +32,7 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.task.RunnableVal; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.HashMap; import java.util.List; @@ -192,7 +192,7 @@ public class AbstractDBTest implements AbstractDB { } @Override - public void getComments(@NotNull Plot plot, String inbox, + public void getComments(@Nonnull Plot plot, String inbox, RunnableVal> whenDone) { } diff --git a/build.gradle b/build.gradle index a0bae9c0c..eacbc0fc2 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ allprojects { } } -subprojects { +subprojects { subproject -> apply(plugin: "java") apply(plugin: "maven") apply(plugin: "eclipse") @@ -100,6 +100,8 @@ subprojects { annotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8") testImplementation("junit:junit:4.13") + + compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2' } configurations.all {