From 37f608258fcbc016e5603414d41cf698a1bba9a1 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 4 Nov 2019 19:55:55 +0000 Subject: [PATCH] Remove PlotBlock --- .../plotsquared/bukkit/BukkitMain.java | 19 +- .../plotsquared/bukkit/chat/ArrayWrapper.java | 2 + .../plotsquared/bukkit/chat/FancyMessage.java | 2 + .../bukkit/chat/JsonRepresentedObject.java | 2 + .../plotsquared/bukkit/chat/JsonString.java | 2 + .../plotsquared/bukkit/chat/MessagePart.java | 2 + .../plotsquared/bukkit/chat/Reflection.java | 10 + .../bukkit/chat/TextualComponent.java | 2 + .../bukkit/commands/DebugUUID.java | 2 + .../bukkit/events/PlayerClaimPlotEvent.java | 2 + .../bukkit/events/PlayerEnterPlotEvent.java | 2 + .../bukkit/events/PlayerLeavePlotEvent.java | 2 + .../bukkit/events/PlayerPlotDeniedEvent.java | 2 + .../bukkit/events/PlayerPlotHelperEvent.java | 2 + .../bukkit/events/PlayerPlotTrustedEvent.java | 2 + .../events/PlayerTeleportToPlotEvent.java | 2 + .../bukkit/events/PlotAutoMergeEvent.java | 2 + .../bukkit/events/PlotChangeOwnerEvent.java | 2 + .../bukkit/events/PlotClearEvent.java | 2 + .../bukkit/events/PlotComponentSetEvent.java | 2 + .../bukkit/events/PlotDeleteEvent.java | 2 + .../plotsquared/bukkit/events/PlotEvent.java | 2 + .../bukkit/events/PlotFlagAddEvent.java | 2 + .../bukkit/events/PlotFlagRemoveEvent.java | 2 + .../bukkit/events/PlotMergeEvent.java | 2 + .../bukkit/events/PlotRateEvent.java | 2 + .../bukkit/events/PlotUnlinkEvent.java | 2 + .../generator/BukkitAugmentedGenerator.java | 2 + .../bukkit/generator/BukkitPlotGenerator.java | 4 +- .../generator/DelegatePlotGenerator.java | 7 +- .../bukkit/generator/PlotBlockPopulator.java | 4 +- .../bukkit/listeners/ChunkListener.java | 2 + .../bukkit/listeners/EntitySpawnListener.java | 2 + .../bukkit/listeners/ForceFieldListener.java | 2 + .../bukkit/listeners/PlayerEvents.java | 47 +- .../bukkit/listeners/PlotPlusListener.java | 2 + .../bukkit/listeners/SingleWorldListener.java | 2 + .../bukkit/listeners/WorldEvents.java | 2 + .../bukkit/object/BukkitBlockUtil.java | 30 + .../bukkit/object/BukkitLazyBlock.java | 25 - .../bukkit/object/BukkitOfflinePlayer.java | 2 + .../bukkit/object/BukkitPlayer.java | 12 +- .../bukkit/object/entity/AgeableStats.java | 2 + .../bukkit/object/entity/ArmorStandStats.java | 2 + .../bukkit/object/entity/EntityBaseStats.java | 2 + .../bukkit/object/entity/EntityWrapper.java | 2 + .../bukkit/object/entity/HorseStats.java | 2 + .../object/entity/LivingEntityStats.java | 2 + .../entity/ReplicatingEntityWrapper.java | 2 + .../bukkit/object/entity/TameableStats.java | 2 + .../object/entity/TeleportEntityWrapper.java | 2 + .../bukkit/object/schematic/StateWrapper.java | 9 +- .../bukkit/util/BukkitBlockRegistry.java | 18 - .../bukkit/util/BukkitChatManager.java | 2 + .../bukkit/util/BukkitChunkManager.java | 6 +- .../bukkit/util/BukkitCommand.java | 2 + .../bukkit/util/BukkitEconHandler.java | 2 + .../bukkit/util/BukkitEventUtil.java | 2 + .../bukkit/util/BukkitHybridUtils.java | 42 +- .../bukkit/util/BukkitInventoryUtil.java | 4 +- .../bukkit/util/BukkitLegacyMappings.java | 871 ------------------ .../bukkit/util/BukkitSchematicHandler.java | 2 + .../bukkit/util/BukkitSetupUtils.java | 2 + .../bukkit/util/BukkitTaskManager.java | 2 + .../plotsquared/bukkit/util/BukkitUtil.java | 73 +- .../bukkit/util/BukkitVersion.java | 2 + .../plotsquared/bukkit/util/Metrics.java | 3 + .../plotsquared/bukkit/util/NbtFactory.java | 2 + .../bukkit/util/OfflinePlayerUtil.java | 2 + .../plotsquared/bukkit/util/SendChunk.java | 2 + .../plotsquared/bukkit/util/SetGenCB.java | 2 + .../bukkit/util/block/BukkitLocalQueue.java | 49 +- .../bukkit/util/block/GenChunk.java | 42 +- .../bukkit/uuid/DatFileFilter.java | 2 + .../bukkit/uuid/DefaultUUIDWrapper.java | 2 + .../bukkit/uuid/FileUUIDHandler.java | 2 + .../bukkit/uuid/LowerOfflineUUIDWrapper.java | 2 + .../bukkit/uuid/OfflineUUIDWrapper.java | 2 + .../bukkit/uuid/SQLUUIDHandler.java | 2 + .../plotsquared/api/PlotAPI.java | 2 + .../plotsquared/commands/Argument.java | 2 + .../plotsquared/commands/Command.java | 2 + .../plotsquared/commands/CommandCaller.java | 2 + .../commands/CommandDeclaration.java | 2 + .../configuration/Configuration.java | 2 + .../configuration/ConfigurationOptions.java | 2 + .../configuration/ConfigurationSection.java | 2 + .../InvalidConfigurationException.java | 2 + .../configuration/MemoryConfiguration.java | 2 + .../MemoryConfigurationOptions.java | 2 + .../configuration/MemorySection.java | 2 + .../configuration/file/FileConfiguration.java | 2 + .../file/FileConfigurationOptions.java | 2 + .../configuration/file/YamlConfiguration.java | 2 + .../file/YamlConfigurationOptions.java | 2 + .../configuration/file/YamlConstructor.java | 2 + .../configuration/file/YamlRepresenter.java | 2 + .../ConfigurationSerializable.java | 2 + .../ConfigurationSerialization.java | 2 + .../DelegateDeserialization.java | 2 + .../serialization/SerializableAs.java | 2 + .../plotsquared/json/JSONArray.java | 2 + .../plotsquared/json/JSONException.java | 2 + .../plotsquared/json/JSONObject.java | 2 + .../plotsquared/json/JSONString.java | 2 + .../plotsquared/json/JSONTokener.java | 2 + .../plotsquared/json/Property.java | 2 + .../plotsquared/json/XML.java | 2 + .../plotsquared/json/XMLTokener.java | 2 + .../plotsquared/plot/IPlotMain.java | 11 +- .../plotsquared/plot/Platform.java | 2 + .../plotsquared/plot/PlotSquared.java | 6 +- .../plotsquared/plot/PlotVersion.java | 2 + .../plotsquared/plot/commands/Add.java | 2 + .../plotsquared/plot/commands/Alias.java | 2 + .../plotsquared/plot/commands/Area.java | 2 + .../plotsquared/plot/commands/Auto.java | 2 + .../plotsquared/plot/commands/Biome.java | 2 + .../plotsquared/plot/commands/Buy.java | 2 + .../plotsquared/plot/commands/Chat.java | 2 + .../plotsquared/plot/commands/Claim.java | 2 + .../plotsquared/plot/commands/Clear.java | 2 + .../plotsquared/plot/commands/Cluster.java | 2 + .../plot/commands/CommandCategory.java | 2 + .../plotsquared/plot/commands/Comment.java | 2 + .../plotsquared/plot/commands/Condense.java | 2 + .../plotsquared/plot/commands/Confirm.java | 2 + .../plotsquared/plot/commands/Continue.java | 2 + .../plotsquared/plot/commands/Copy.java | 2 + .../plot/commands/CreateRoadSchematic.java | 2 + .../plotsquared/plot/commands/Database.java | 2 + .../plotsquared/plot/commands/Debug.java | 2 + .../plot/commands/DebugAllowUnsafe.java | 2 + .../plot/commands/DebugClaimTest.java | 2 + .../plotsquared/plot/commands/DebugExec.java | 6 +- .../plot/commands/DebugFixFlags.java | 2 + .../plot/commands/DebugImportWorlds.java | 2 + .../plot/commands/DebugLoadTest.java | 2 + .../plotsquared/plot/commands/DebugPaste.java | 2 + .../plot/commands/DebugRoadRegen.java | 2 + .../plot/commands/DebugSaveTest.java | 2 + .../plotsquared/plot/commands/Delete.java | 2 + .../plotsquared/plot/commands/Deny.java | 2 + .../plotsquared/plot/commands/Desc.java | 2 + .../plotsquared/plot/commands/Dislike.java | 2 + .../plotsquared/plot/commands/Done.java | 2 + .../plotsquared/plot/commands/Download.java | 2 + .../plotsquared/plot/commands/FlagCmd.java | 18 +- .../plot/commands/GenerateDocs.java | 2 + .../plotsquared/plot/commands/Grant.java | 2 + .../plotsquared/plot/commands/Help.java | 2 + .../plotsquared/plot/commands/Inbox.java | 2 + .../plotsquared/plot/commands/Info.java | 2 + .../plotsquared/plot/commands/Kick.java | 2 + .../plotsquared/plot/commands/Leave.java | 2 + .../plotsquared/plot/commands/Like.java | 2 + .../plotsquared/plot/commands/ListCmd.java | 2 + .../plotsquared/plot/commands/Load.java | 2 + .../plot/commands/MainCommand.java | 2 + .../plotsquared/plot/commands/Merge.java | 2 + .../plotsquared/plot/commands/Middle.java | 2 + .../plotsquared/plot/commands/Move.java | 2 + .../plotsquared/plot/commands/Music.java | 7 +- .../plotsquared/plot/commands/Near.java | 2 + .../plotsquared/plot/commands/Owner.java | 2 + .../plotsquared/plot/commands/PluginCmd.java | 2 + .../plotsquared/plot/commands/Purge.java | 2 + .../plotsquared/plot/commands/Rate.java | 2 + .../plot/commands/RegenAllRoads.java | 2 + .../plotsquared/plot/commands/Relight.java | 2 + .../plotsquared/plot/commands/Reload.java | 2 + .../plotsquared/plot/commands/Remove.java | 2 + .../plot/commands/RequiredType.java | 2 + .../plotsquared/plot/commands/Save.java | 2 + .../plot/commands/SchematicCmd.java | 2 + .../plotsquared/plot/commands/Set.java | 12 +- .../plotsquared/plot/commands/SetCommand.java | 2 + .../plotsquared/plot/commands/SetHome.java | 2 + .../plotsquared/plot/commands/Setup.java | 2 + .../plotsquared/plot/commands/SubCommand.java | 2 + .../plotsquared/plot/commands/Swap.java | 2 + .../plotsquared/plot/commands/Target.java | 2 + .../plotsquared/plot/commands/Template.java | 2 + .../plotsquared/plot/commands/Toggle.java | 2 + .../plotsquared/plot/commands/Trim.java | 2 + .../plotsquared/plot/commands/Trust.java | 2 + .../plotsquared/plot/commands/Unlink.java | 2 + .../plotsquared/plot/commands/Visit.java | 2 + .../plot/commands/WE_Anywhere.java | 2 + .../plotsquared/plot/config/Captions.java | 2 + .../plotsquared/plot/config/Config.java | 2 + .../plot/config/Configuration.java | 16 +- .../plot/config/ConfigurationNode.java | 6 +- .../plotsquared/plot/config/Settings.java | 2 + .../plotsquared/plot/config/Storage.java | 2 + .../plotsquared/plot/database/AbstractDB.java | 2 + .../plotsquared/plot/database/DBFunc.java | 2 + .../plotsquared/plot/database/Database.java | 2 + .../plotsquared/plot/database/MySQL.java | 2 + .../plotsquared/plot/database/SQLManager.java | 2 + .../plotsquared/plot/database/SQLite.java | 2 + .../plotsquared/plot/database/StmtMod.java | 2 + .../plot/flag/BlockStateListFlag.java | 40 + .../plotsquared/plot/flag/BooleanFlag.java | 2 + .../plotsquared/plot/flag/DoubleFlag.java | 2 + .../plotsquared/plot/flag/EnumFlag.java | 2 + .../plotsquared/plot/flag/Flag.java | 2 + .../plotsquared/plot/flag/FlagManager.java | 2 + .../plotsquared/plot/flag/Flags.java | 8 +- .../plotsquared/plot/flag/GameModeFlag.java | 2 + .../plotsquared/plot/flag/IntegerFlag.java | 2 + .../plot/flag/IntegerListFlag.java | 2 + .../plotsquared/plot/flag/IntervalFlag.java | 2 + .../plotsquared/plot/flag/ListFlag.java | 2 + .../plotsquared/plot/flag/LongFlag.java | 2 + .../plot/flag/PlotBlockListFlag.java | 33 - .../plot/flag/PlotWeatherFlag.java | 2 + .../plotsquared/plot/flag/StringFlag.java | 2 + .../plotsquared/plot/flag/StringListFlag.java | 2 + .../plot/flag/TeleportDenyFlag.java | 2 + .../plot/generator/AugmentedUtils.java | 13 +- .../plot/generator/ClassicPlotManager.java | 22 +- .../plot/generator/ClassicPlotWorld.java | 28 +- .../plot/generator/GeneratorWrapper.java | 2 + .../plot/generator/GridPlotManager.java | 2 + .../plot/generator/GridPlotWorld.java | 2 + .../plotsquared/plot/generator/HybridGen.java | 8 +- .../plot/generator/HybridPlotManager.java | 12 +- .../plot/generator/HybridPlotWorld.java | 12 +- .../plot/generator/HybridUtils.java | 12 +- .../generator/IndependentPlotGenerator.java | 2 + .../plot/generator/PlotGenerator.java | 2 + .../plot/generator/SquarePlotManager.java | 2 + .../plot/generator/SquarePlotWorld.java | 2 + .../plot/listener/ExtentWrapper.java | 2 + .../plot/listener/PlayerBlockEventType.java | 2 + .../plot/listener/PlotListener.java | 25 +- .../plot/listener/ProcessedWEExtent.java | 2 + .../plotsquared/plot/listener/WEExtent.java | 2 + .../plotsquared/plot/listener/WEManager.java | 2 + .../plot/listener/WESubscriber.java | 2 + .../plot/logger/DelegateLogger.java | 2 + .../plotsquared/plot/logger/ILogger.java | 2 + .../plotsquared/plot/object/BlockBucket.java | 51 +- .../plotsquared/plot/object/BlockLoc.java | 2 + .../plot/object/BlockRegistry.java | 34 - .../plotsquared/plot/object/ChunkWrapper.java | 2 + .../plotsquared/plot/object/CmdInstance.java | 2 + .../plot/object/ConsolePlayer.java | 7 +- .../plotsquared/plot/object/Direction.java | 2 + .../plotsquared/plot/object/Expression.java | 2 + .../plotsquared/plot/object/FileBytes.java | 2 + .../plotsquared/plot/object/LazyBlock.java | 7 +- .../plotsquared/plot/object/LazyResult.java | 2 + .../plot/object/LegacyPlotBlock.java | 71 -- .../plotsquared/plot/object/Location.java | 2 + .../plot/object/OfflinePlotPlayer.java | 2 + .../plotsquared/plot/object/Plot.java | 6 +- .../plotsquared/plot/object/PlotArea.java | 2 + .../plotsquared/plot/object/PlotBlock.java | 138 --- .../plotsquared/plot/object/PlotCluster.java | 2 + .../plotsquared/plot/object/PlotFilter.java | 2 + .../plotsquared/plot/object/PlotHandler.java | 2 + .../plotsquared/plot/object/PlotId.java | 2 + .../plot/object/PlotInventory.java | 2 + .../plot/object/PlotItemStack.java | 18 +- .../plotsquared/plot/object/PlotLoc.java | 2 + .../plotsquared/plot/object/PlotManager.java | 2 + .../plotsquared/plot/object/PlotMessage.java | 2 + .../plotsquared/plot/object/PlotPlayer.java | 6 +- .../plotsquared/plot/object/PlotSettings.java | 2 + .../plotsquared/plot/object/PseudoRandom.java | 2 + .../plotsquared/plot/object/Rating.java | 2 + .../plot/object/RegionWrapper.java | 2 + .../plotsquared/plot/object/RunnableVal.java | 2 + .../plotsquared/plot/object/RunnableVal2.java | 2 + .../plotsquared/plot/object/RunnableVal3.java | 2 + .../plotsquared/plot/object/SetupObject.java | 2 + .../plot/object/StringPlotBlock.java | 100 -- .../plot/object/StringWrapper.java | 2 + .../plot/object/chat/PlainChatManager.java | 2 + .../collection/FlatRandomCollection.java | 2 + .../object/collection/RandomCollection.java | 2 + .../collection/SimpleRandomCollection.java | 2 + .../plot/object/comment/CommentInbox.java | 2 + .../plot/object/comment/InboxOwner.java | 2 + .../plot/object/comment/InboxPublic.java | 2 + .../plot/object/comment/InboxReport.java | 2 + .../plot/object/comment/PlotComment.java | 2 + .../plot/object/schematic/ItemType.java | 307 ------ .../plot/object/schematic/PlotItem.java | 9 +- .../plot/object/schematic/Schematic.java | 8 +- .../plot/object/schematic/StoredEntity.java | 2 + .../stream/AbstractDelegateOutputStream.java | 2 + .../object/worlds/DefaultPlotAreaManager.java | 2 + .../plot/object/worlds/PlotAreaManager.java | 2 + .../plot/object/worlds/SinglePlot.java | 2 + .../plot/object/worlds/SinglePlotArea.java | 2 + .../object/worlds/SinglePlotAreaManager.java | 2 + .../plot/object/worlds/SinglePlotManager.java | 2 + .../object/worlds/SingleWorldGenerator.java | 18 +- .../plotsquared/plot/util/ArrayUtil.java | 2 + .../plot/util/ByteArrayUtilities.java | 2 + .../plotsquared/plot/util/ChatManager.java | 2 + .../plotsquared/plot/util/ChunkManager.java | 2 + .../plotsquared/plot/util/CmdConfirm.java | 2 + .../plotsquared/plot/util/CommentManager.java | 2 + .../plotsquared/plot/util/ConsoleColors.java | 2 + .../plotsquared/plot/util/EconHandler.java | 2 + .../plotsquared/plot/util/EntityUtil.java | 2 + .../plotsquared/plot/util/EventUtil.java | 98 +- .../plotsquared/plot/util/HttpUtil.java | 2 + .../plotsquared/plot/util/IncendoPaster.java | 2 + .../plotsquared/plot/util/InventoryUtil.java | 2 + .../plot/util/LegacyConverter.java | 22 +- .../plotsquared/plot/util/LegacyMappings.java | 15 - .../plotsquared/plot/util/MainUtil.java | 2 + .../plotsquared/plot/util/MathMan.java | 2 + .../plotsquared/plot/util/Permissions.java | 2 + .../plotsquared/plot/util/PlotGameMode.java | 2 + .../plotsquared/plot/util/PlotWeather.java | 2 + .../plot/util/ReflectionUtils.java | 2 + .../plotsquared/plot/util/RegExUtil.java | 2 + .../plot/util/SchematicHandler.java | 12 +- .../plotsquared/plot/util/SetupUtils.java | 2 + .../plot/util/StringComparison.java | 2 + .../plotsquared/plot/util/StringMan.java | 2 + .../plotsquared/plot/util/TaskManager.java | 2 + .../plotsquared/plot/util/UUIDHandler.java | 2 + .../plot/util/UUIDHandlerImplementation.java | 2 + .../plotsquared/plot/util/UpdateUtility.java | 2 + .../plotsquared/plot/util/WorldUtil.java | 14 +- .../plotsquared/plot/util/area/QuadMap.java | 2 + .../plot/util/block/BasicLocalBlockQueue.java | 16 +- .../plot/util/block/BlockUtil.java | 89 ++ .../util/block/DelegateLocalBlockQueue.java | 8 +- .../plot/util/block/GlobalBlockQueue.java | 2 + .../plotsquared/plot/util/block/ItemUtil.java | 30 + .../plot/util/block/LocalBlockQueue.java | 10 +- .../util/block/OffsetLocalBlockQueue.java | 2 + .../plot/util/block/QueueProvider.java | 2 + .../util/block/ScopedLocalBlockQueue.java | 6 +- .../plot/util/expiry/ExpireManager.java | 2 + .../plot/util/expiry/ExpirySettings.java | 2 + .../plot/util/expiry/ExpiryTask.java | 2 + .../plot/util/expiry/PlotAnalysis.java | 2 + .../plot/util/helpmenu/HelpMenu.java | 2 + .../plot/util/helpmenu/HelpObject.java | 2 + .../plot/util/helpmenu/HelpPage.java | 2 + .../plotsquared/plot/uuid/UUIDWrapper.java | 2 + .../plotsquared/plot/FlagTest.java | 12 +- .../plotsquared/plot/PlotVersionTest.java | 2 + .../plot/database/AbstractDBTest.java | 2 + .../plotsquared/plot/object/LocationTest.java | 2 + .../plotsquared/plot/util/EventUtilTest.java | 2 + .../util/UUIDHandlerImplementationTest.java | 2 + build.gradle | 8 + 357 files changed, 1254 insertions(+), 2020 deletions(-) create mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java delete mode 100644 Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java delete mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java create mode 100644 Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index a851207cd..08a8dc4be 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.bukkit.listeners.ChunkListener; import com.github.intellectualsites.plotsquared.bukkit.listeners.EntitySpawnListener; @@ -7,7 +9,6 @@ import com.github.intellectualsites.plotsquared.bukkit.listeners.PlayerEvents; import com.github.intellectualsites.plotsquared.bukkit.listeners.PlotPlusListener; import com.github.intellectualsites.plotsquared.bukkit.listeners.SingleWorldListener; import com.github.intellectualsites.plotsquared.bukkit.listeners.WorldEvents; -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitBlockRegistry; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChatManager; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChunkManager; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitCommand; @@ -15,7 +16,6 @@ import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEconHandler; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEventUtil; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitHybridUtils; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitInventoryUtil; -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitLegacyMappings; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSchematicHandler; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSetupUtils; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitTaskManager; @@ -38,7 +38,6 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.HybridGen; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; @@ -55,7 +54,6 @@ import com.github.intellectualsites.plotsquared.plot.util.ConsoleColors; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; -import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; @@ -69,6 +67,7 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider; import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.bukkit.BukkitBlockRegistry; import io.papermc.lib.PaperLib; import lombok.Getter; import lombok.NonNull; @@ -113,9 +112,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } - private final LegacyMappings legacyMappings = new BukkitLegacyMappings(); - private final BlockRegistry blockRegistry = - new BukkitBlockRegistry(Material.values()); private int[] version; @Getter private String pluginName; @Getter private SingleWorldListener singleWorldListener; @@ -831,13 +827,4 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } return names; } - - @Override public BlockRegistry getBlockRegistry() { - return this.blockRegistry; - } - - @Override public LegacyMappings getLegacyMappings() { - return this.legacyMappings; - } - } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java index 064d77d86..2b61b3d53 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/ArrayWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.apache.commons.lang.Validate; import java.lang.reflect.Array; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java index 348f50f9a..911ca6b3c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java index 04f036526..32c365171 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonRepresentedObject.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.gson.stream.JsonWriter; import java.io.IOException; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java index 7f8dd4d29..9d9d7ab9c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/JsonString.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.gson.stream.JsonWriter; import org.bukkit.configuration.serialization.ConfigurationSerializable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java index 64bdda48d..deeeea0b3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/MessagePart.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; import com.google.gson.stream.JsonWriter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java index f3f004284..3d9e731c1 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/Reflection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.Bukkit; import java.lang.reflect.Field; @@ -21,6 +23,8 @@ public final class Reflection { private static final Map> _loadedNMSClasses = new HashMap<>(); /** * Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages). + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; */ private static final Map> _loadedOBCClasses = new HashMap<>(); private static final Map, Map> _loadedFields = new HashMap<>(); @@ -37,7 +41,11 @@ public final class Reflection { /** * Gets the version string from the package name of the CraftBukkit server implementation. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * This is needed to bypass the JAR package name changing on each update. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * * @return The version string of the OBC and NMS packages, including the trailing dot. */ @@ -79,6 +87,8 @@ public final class Reflection { * The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously). * * @param className The name of the class, excluding the package, within OBC. This name may contain a subpackage name, such as {@code inventory.CraftItemStack}. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * @return The class instance representing the specified OBC class, or {@code null} if it could not be loaded. */ public synchronized static Class getOBCClass(String className) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java index 14e3d2305..c292f7d5f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/TextualComponent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.gson.stream.JsonWriter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java index 49d399da1..9765d38b9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.uuid.DatFileFilter; import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper; import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java index 269b64296..c8fbc78a4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerClaimPlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java index a40365b40..c0b0702e0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerEnterPlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java index 36482d44c..04ea1a344 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerLeavePlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java index c9c4d56b9..23c011e8f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java index 573d53ea8..174bd1673 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotHelperEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java index f2f9efe71..4ee2d9ca0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java index 79d43391e..6a4c4bccd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.entity.Player; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java index 059b296cf..8722d86b4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import lombok.Getter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java index 3fba03284..4c71093b3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotChangeOwnerEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.entity.Player; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java index b4ab469a2..e4354d4fe 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotClearEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java index 6911ccdd4..4c347657e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotComponentSetEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.HandlerList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java index 5199496ff..4720a0353 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotDeleteEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java index ae4b0c1d7..d8ea39fc3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Event; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java index e8c4ac63c..e55b33920 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagAddEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java index 3e3e48b55..b8617e361 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotFlagRemoveEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import org.bukkit.event.Cancellable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java index 55488011e..9e1822960 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotMergeEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import lombok.Getter; import lombok.Setter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java index b6ca46593..9e494ba1c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotRateEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Rating; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java index 5db7d04d4..00a4d39dc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.events; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import lombok.Getter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java index 03b0c8123..85872ca9c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import org.bukkit.Chunk; import org.bukkit.World; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 53a7dd358..4fc0618cd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -41,7 +43,7 @@ public class BukkitPlotGenerator extends ChunkGenerator this.plotGenerator = generator; this.platformGenerator = this; this.populators = new ArrayList<>(); - this.populators.add(new PlotBlockPopulator(this.plotGenerator)); + this.populators.add(new BlockStatePopulator(this.plotGenerator)); this.full = true; MainUtil.initCache(); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java index 6a2655d24..0ffcad59c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; @@ -7,7 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGe import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; @@ -45,7 +48,7 @@ import java.util.Random; for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { blockBuckets[0][(z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("bedrock")); + BlockBucket.withSingle(BlockUtil.get("bedrock")); } } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java index 9236e184a..3e24f900f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/PlotBlockPopulator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; @@ -15,7 +17,7 @@ import org.jetbrains.annotations.NotNull; import java.util.Random; -@RequiredArgsConstructor final class PlotBlockPopulator extends BlockPopulator { +@RequiredArgsConstructor final class BlockStatePopulator extends BlockPopulator { private final IndependentPlotGenerator plotGenerator; private LocalBlockQueue queue; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java index 046c0de8f..aa13e9dc5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index a982f39fd..2e5c8fcc8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java index d2d588970..86136afeb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index f70d7f46b..d622d6d71 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1,7 +1,9 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; -import com.github.intellectualsites.plotsquared.bukkit.object.BukkitLazyBlock; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -13,7 +15,8 @@ import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotHandler; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; @@ -29,6 +32,7 @@ import com.github.intellectualsites.plotsquared.plot.util.RegExUtil; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility; +import com.sk89q.worldedit.world.block.BlockType; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -37,7 +41,6 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Ageable; @@ -142,6 +145,7 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.function.Supplier; import java.util.regex.Pattern; /** @@ -1103,10 +1107,10 @@ import java.util.regex.Pattern; return; } if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(PlotBlock.get(block.getType().name()))) { + .contains(BukkitAdapter.asBlockType(block.getType()))) { return; } if (Permissions @@ -1388,10 +1392,10 @@ import java.util.regex.Pattern; } PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() - .contains(PlotBlock.get(block.getType().name())) || Permissions + .contains(BukkitBlockUtil.get(block)) || Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } @@ -1623,7 +1627,7 @@ import java.util.regex.Pattern; if (!PlotSquared.get().hasPlotArea(event.getWorld().getName())) { return; } - List blocks = event.getBlocks(); + List blocks = event.getBlocks(); if (blocks.isEmpty()) { return; } @@ -1737,7 +1741,7 @@ import java.util.regex.Pattern; } } Block block = player.getTargetBlock(null, 7); - BlockState state = block.getState(); + org.bukkit.block.BlockState state = block.getState(); if (state == null) { return; } @@ -1916,9 +1920,10 @@ import java.util.regex.Pattern; Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY); if (block != null && block.getType() != Material.AIR) { Location location = BukkitUtil.getLocation(block.getLocation()); + Material finalType = type; if (!EventUtil.manager - .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, - new BukkitLazyBlock(PlotBlock.get(type.toString())), true)) { + .checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, () -> BukkitAdapter.asBlockType( + finalType).getDefaultState(), true)) { event.setCancelled(true); event.setUseItemInHand(Event.Result.DENY); } @@ -1936,14 +1941,14 @@ import java.util.regex.Pattern; return; } PlayerBlockEventType eventType = null; - BukkitLazyBlock lb; + Supplier lb; Location location; Action action = event.getAction(); switch (action) { case PHYSICAL: { eventType = PlayerBlockEventType.TRIGGER_PHYSICAL; Block block = event.getClickedBlock(); - lb = new BukkitLazyBlock(block); + lb = BukkitBlockUtil.supply(block); location = BukkitUtil.getLocation(block.getLocation()); break; } @@ -2112,7 +2117,7 @@ import java.util.regex.Pattern; eventType = PlayerBlockEventType.INTERACT_BLOCK; } } - lb = new BukkitLazyBlock(PlotBlock.get(block.getType().toString())); + lb = BukkitBlockUtil.supply(block); if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK || !player.isSneaking())) { break; @@ -2131,7 +2136,7 @@ import java.util.regex.Pattern; type = offType; } // in the following, lb needs to have the material of the item in hand i.e. type - lb = new BukkitLazyBlock(PlotBlock.get(type.toString())); + lb = BukkitBlockUtil.supply(type); if (type.isBlock()) { location = BukkitUtil .getLocation(block.getRelative(event.getBlockFace()).getLocation()); @@ -2214,7 +2219,7 @@ import java.util.regex.Pattern; Block block = event.getClickedBlock(); location = BukkitUtil.getLocation(block.getLocation()); eventType = PlayerBlockEventType.BREAK_BLOCK; - lb = new BukkitLazyBlock(block); + lb = BukkitBlockUtil.supply(block); break; default: return; @@ -2473,7 +2478,7 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(pp.getUUID())) { - if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().name()))) { + if (Flags.USE.contains(plot, BukkitBlockUtil.get(block))) { return; } if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -2533,9 +2538,9 @@ import java.util.regex.Pattern; Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(plotPlayer.getUUID())) { - Optional> use = plot.getFlag(Flags.USE); + Optional> use = plot.getFlag(Flags.USE); Block block = event.getBlockClicked(); - if (use.isPresent() && use.get().contains(PlotBlock.get(block.getType().name()))) { + if (use.isPresent() && use.get().contains(BukkitBlockUtil.get(block))) { return; } if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { @@ -3091,10 +3096,10 @@ import java.util.regex.Pattern; return; } } else if (!plot.isAdded(pp.getUUID())) { - Set place = plot.getFlag(Flags.PLACE, null); + Set place = plot.getFlag(Flags.PLACE, null); if (place != null) { Block block = event.getBlock(); - if (place.contains(PlotBlock.get(block.getType().name()))) { + if (place.contains(BukkitBlockUtil.get(block))) { return; } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java index b103ed7de..a3a82441d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java index a53527fc9..47274c696 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java index afa821975..243e72dcb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java new file mode 100644 index 000000000..9c6672a49 --- /dev/null +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitBlockUtil.java @@ -0,0 +1,30 @@ +package com.github.intellectualsites.plotsquared.bukkit.object; + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.github.intellectualsites.plotsquared.plot.object.LazyBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockState; +import org.bukkit.Material; +import org.bukkit.block.Block; + +import java.util.function.Supplier; + +public class BukkitBlockUtil { + public static Supplier supply(Block block) { + return () -> BukkitAdapter.asBlockType(block.getType()).getDefaultState(); + } + + public static Supplier supply(Material type) { + return () -> BukkitAdapter.asBlockType(type).getDefaultState(); + } + + public static BlockState get(Block block) { + return get(block.getType()); + } + + public static BlockState get(Material material) { + return BukkitAdapter.asBlockType(material).getDefaultState(); + } +} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java deleted file mode 100644 index 0903e78d9..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitLazyBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.object; - -import com.github.intellectualsites.plotsquared.plot.object.LazyBlock; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; -import org.bukkit.block.Block; - -public class BukkitLazyBlock extends LazyBlock { - - private StringPlotBlock pb; - - public BukkitLazyBlock(Block block) { - this.pb = (StringPlotBlock) PlotBlock.get(block.getType().toString()); - } - - public BukkitLazyBlock(StringPlotBlock pb) { - this.pb = pb; - } - - public StringPlotBlock getPlotBlock() { - return this.pb; - } - - -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java index 7c52a25de..b26182f3f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitOfflinePlayer.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 918a5ab3b..80b4fb9c5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -1,10 +1,13 @@ package com.github.intellectualsites.plotsquared.bukkit.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -12,6 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; +import com.sk89q.worldedit.world.item.ItemType; import io.papermc.lib.PaperLib; import org.bukkit.GameMode; import org.bukkit.Material; @@ -277,8 +281,8 @@ public class BukkitPlayer extends PlotPlayer { this.player.setAllowFlight(fly); } - @Override public void playMusic(@NotNull final Location location, @NotNull final PlotBlock id) { - if (PlotBlock.isEverything(id) || id.isAir()) { + @Override public void playMusic(@NotNull final Location location, @NotNull final ItemType id) { + if (id.getBlockType().getMaterial().isAir()) { // Let's just stop all the discs because why not? for (final Sound sound : Arrays.stream(Sound.values()) .filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) { @@ -288,7 +292,7 @@ public class BukkitPlayer extends PlotPlayer { } else { // this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, id.to(Material.class)); this.player.playSound(BukkitUtil.getLocation(location), - Sound.valueOf(id.to(Material.class).name()), Float.MAX_VALUE, 1f); + Sound.valueOf(BukkitAdapter.adapt(id).name()), Float.MAX_VALUE, 1f); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java index 5769f0e46..b53edc5ea 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/AgeableStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + class AgeableStats { int age; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java index 56b36e2bb..44ebdb8b6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ArmorStandStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + class ArmorStandStats { final float[] head = new float[3]; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java index c36236a5d..94c93f1fb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityBaseStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + class EntityBaseStats { EntityWrapper passenger; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java index d0b6f28b5..b0e34a99c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/EntityWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import lombok.Getter; import lombok.NonNull; import org.bukkit.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java index 7fd976258..86c10e868 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/HorseStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.entity.Horse; class HorseStats { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java index c702ffaa7..e6f8411f2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/LivingEntityStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java index a237bf96a..5e7b8f2d2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import org.bukkit.Art; import org.bukkit.DyeColor; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java index f9e8ded36..4dfa1939b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TameableStats.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.entity.AnimalTamer; class TameableStats { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java index 7456ae10e..fcfbce2b8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/TeleportEntityWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import org.bukkit.Chunk; import org.bukkit.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java index 3d5c75edf..8f05a41f7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.schematic; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -12,7 +14,6 @@ import com.sk89q.jnbt.Tag; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; -import org.bukkit.block.BlockState; import org.bukkit.block.Container; import org.bukkit.block.Sign; import org.bukkit.enchantments.Enchantment; @@ -28,10 +29,10 @@ import java.util.Map.Entry; public class StateWrapper { - public BlockState state = null; + public org.bukkit.block.BlockState state = null; public CompoundTag tag = null; - public StateWrapper(BlockState state) { + public StateWrapper(org.bukkit.block.BlockState state) { this.state = state; } @@ -156,7 +157,7 @@ public class StateWrapper { if (block == null) { return false; } - BlockState state = block.getState(); + org.bukkit.block.BlockState state = block.getState(); switch (tileid) { case "chest": case "beacon": diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java deleted file mode 100644 index b5ac5f1fb..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitBlockRegistry.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.util; - -import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import lombok.NonNull; -import org.bukkit.Material; - -public class BukkitBlockRegistry extends BlockRegistry { - - public BukkitBlockRegistry(final Material... preInitializedItems) { - super(Material.class, preInitializedItems); - } - - @Override public PlotBlock getPlotBlock(@NonNull final Material item) { - return PlotBlock.get(item.name()); - } - -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java index ef3af32d9..5f5f50ddd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.chat.FancyMessage; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java index d768ac32b..c92bf2452 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.entity.EntityWrapper; import com.github.intellectualsites.plotsquared.bukkit.object.entity.ReplicatingEntityWrapper; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -8,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotLoc; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -369,7 +371,7 @@ public class BukkitChunkManager extends ChunkManager { if (id != null) { value.setBlock(x1, y, z1, id); } else { - value.setBlock(x1, y, z1, PlotBlock.get("air")); + value.setBlock(x1, y, z1, BlockUtil.get("air")); } } for (int y = Math.min(128, ids.length); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java index 190aa077a..49f6bf87a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitCommand.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.commands.DebugUUID; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java index a9978b76c..9dfb2c725 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEconHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java index 25ca0e16e..8fb7a41db 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java index 2d0e2cfa2..063c1363b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -8,10 +10,11 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -20,6 +23,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.World; @@ -28,6 +33,7 @@ import org.bukkit.block.data.Directional; import org.bukkit.generator.ChunkGenerator; import java.util.HashSet; +import java.util.Set; public class BukkitHybridUtils extends HybridUtils { @@ -36,7 +42,7 @@ public class BukkitHybridUtils extends HybridUtils { // int diff, int variety, int vertices, int rotation, int height_sd /* * diff: compare to base by looping through all blocks - * variety: add to HashSet for each PlotBlock + * variety: add to HashSet for each BlockState * height_sd: loop over all blocks and get top block * * vertices: store air map and compare with neighbours @@ -71,8 +77,8 @@ public class BukkitHybridUtils extends HybridUtils { System.gc(); System.gc(); final BlockBucket[][][] oldBlocks = new BlockBucket[256][width][length]; - final PlotBlock[][][] newBlocks = new PlotBlock[256][width][length]; - final BlockBucket airBucket = BlockBucket.withSingle(StringPlotBlock.EVERYTHING); + final BlockState[][][] newBlocks = new BlockState[256][width][length]; + final BlockBucket airBucket = BlockBucket.withSingle(BlockTypes.AIR.getDefaultState()); PlotArea area = PlotSquared.get().getPlotArea(world, null); @@ -128,7 +134,7 @@ public class BukkitHybridUtils extends HybridUtils { for (int y = 0; y < blocks.length; y++) { if (blocks[y] != null) { result[(minY + y) >> 4][(((minY + y) & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get(blocks[y])); + BlockBucket.withSingle(blocks[y].toImmutableState()); } } } @@ -183,45 +189,45 @@ public class BukkitHybridUtils extends HybridUtils { int i = 0; for (int x = 0; x < width; x++) { for (int z = 0; z < length; z++) { - HashSet types = new HashSet<>(); + Set types = new HashSet<>(); for (int y = 0; y < 256; y++) { BlockBucket old = oldBlocks[y][x][z]; try { if (old == null) { old = airBucket; } - PlotBlock now = newBlocks[y][x][z]; + BlockState now = newBlocks[y][x][z]; if (!old.getBlocks().contains(now)) { changes[i]++; } - if (now.isAir()) { + if (now.getBlockType().getMaterial().isAir()) { air[i]++; } else { // check vertices // modifications_adjacent if (x > 0 && z > 0 && y > 0 && x < width - 1 && z < length - 1 && y < 255) { - if (newBlocks[y - 1][x][z].isAir()) { + if (newBlocks[y - 1][x][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x - 1][z].isAir()) { + if (newBlocks[y][x - 1][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x][z - 1].isAir()) { + if (newBlocks[y][x][z - 1].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y + 1][x][z].isAir()) { + if (newBlocks[y + 1][x][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x + 1][z].isAir()) { + if (newBlocks[y][x + 1][z].getBlockType().getMaterial().isAir()) { faces[i]++; } - if (newBlocks[y][x][z + 1].isAir()) { + if (newBlocks[y][x][z + 1].getBlockType().getMaterial().isAir()) { faces[i]++; } } - Material material = now.to(Material.class); + Material material = BukkitAdapter.adapt(now.getBlockType()); if (material != null) { BlockData blockData = material.createBlockData(); if (blockData instanceof Directional) { @@ -230,7 +236,7 @@ public class BukkitHybridUtils extends HybridUtils { data[i]++; } } - types.add(now); + types.add(now.getBlockType()); } } catch (NullPointerException e) { e.printStackTrace(); @@ -303,7 +309,7 @@ public class BukkitHybridUtils extends HybridUtils { for (int z = minZ; z <= maxZ; z++) { int zz = cbz + z; for (int y = 0; y < 256; y++) { - PlotBlock block = queue.getBlock(xx, y, zz); + BlockState block = queue.getBlock(xx, y, zz); int xr = xb + x; int zr = zb + z; newBlocks[y][xr][zr] = block; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java index 2c66f8d3f..60408171b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitInventoryUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; @@ -56,7 +58,7 @@ public class BukkitInventoryUtil extends InventoryUtil { if (item == null) { return null; } - ItemStack stack = new ItemStack(BukkitUtil.getMaterial(item.getPlotBlock()), item.amount); + ItemStack stack = new ItemStack(BukkitUtil.getMaterial(item.getBlockState()), item.amount); ItemMeta meta = null; if (item.name != null) { meta = stack.getItemMeta(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java deleted file mode 100644 index c7d953ea7..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java +++ /dev/null @@ -1,871 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.util; - -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; -import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; -import com.github.intellectualsites.plotsquared.plot.util.StringComparison; -import lombok.AccessLevel; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; -import lombok.ToString; -import org.bukkit.Bukkit; -import org.bukkit.Material; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * Borrowed from https://github.com/Phoenix616/IDConverter/blob/master/mappings/src/main/java/de/themoep/idconverter/IdMappings.java - * Original License: - *

- * Minecraft ID mappings Copyright (C) 2017 Max Lee (https://github.com/Phoenix616) - *

- * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - *

- * You should have received a copy of the GNU General Public License along with this program. If - * not, see . - */ -public final class BukkitLegacyMappings extends LegacyMappings { - - private static final LegacyBlock[] BLOCKS = - new LegacyBlock[] {new LegacyBlock(0, "air"), new LegacyBlock(1, "stone"), - new LegacyBlock(1, 1, "stone", "granite"), - new LegacyBlock(1, 2, "stone", "polished_granite"), - new LegacyBlock(1, 3, "stone", "diorite"), - new LegacyBlock(1, 4, "stone", "polished_diorite"), - new LegacyBlock(1, 5, "stone", "andesite"), - new LegacyBlock(1, 6, "stone", "polished_andesite"), - new LegacyBlock(2, "grass", "grass_block"), new LegacyBlock(3, "dirt"), - new LegacyBlock(3, 1, "dirt", "coarse_dirt"), new LegacyBlock(3, 2, "dirt", "podzol"), - new LegacyBlock(4, "cobblestone"), new LegacyBlock(5, "wood", "oak_planks"), - new LegacyBlock(5, 1, "wood", "spruce_planks"), - new LegacyBlock(5, 2, "wood", "birch_planks"), - new LegacyBlock(5, 3, "wood", "jungle_planks"), - new LegacyBlock(5, 4, "wood", "acacia_planks"), - new LegacyBlock(5, 5, "wood", "dark_oak_planks"), - new LegacyBlock(6, "sapling", "oak_sapling"), - new LegacyBlock(6, 1, "sapling", "spruce_sapling"), - new LegacyBlock(6, 2, "sapling", "birch_sapling"), - new LegacyBlock(6, 3, "sapling", "jungle_sapling"), - new LegacyBlock(6, 4, "sapling", "acacia_sapling"), - new LegacyBlock(6, 5, "sapling", "dark_oak_sapling"), new LegacyBlock(7, "bedrock"), - new LegacyBlock(8, "water", "flowing_water"), - new LegacyBlock(9, "stationary_water", "water"), - new LegacyBlock(10, "lava", "flowing_lava"), - new LegacyBlock(11, "stationary_lava", "lava"), new LegacyBlock(12, "sand"), - new LegacyBlock(12, 1, "sand", "red_sand"), new LegacyBlock(13, "gravel"), - new LegacyBlock(14, "gold_ore"), new LegacyBlock(15, "iron_ore"), - new LegacyBlock(16, "coal_ore"), new LegacyBlock(17, "log", "oak_log"), - new LegacyBlock(17, 1, "log", "oak_log"), new LegacyBlock(17, 2, "log", "spruce_log"), - new LegacyBlock(17, 3, "log", "birch_log"), new LegacyBlock(17, 4, "log", "jungle_log"), - new LegacyBlock(17, 5, "log", "oak_bark"), new LegacyBlock(17, 6, "log", "spruce_bark"), - new LegacyBlock(17, 7, "log", "birch_bark"), - new LegacyBlock(17, 8, "log", "jungle_bark"), - new LegacyBlock(18, "leaves", "oak_leaves"), - new LegacyBlock(18, 1, "leaves", "spruce_leaves"), - new LegacyBlock(18, 2, "leaves", "birch_leaves"), - new LegacyBlock(18, 3, "leaves", "jungle_leaves"), new LegacyBlock(19, "sponge"), - new LegacyBlock(19, 1, "sponge", "wet_sponge"), new LegacyBlock(20, "glass"), - new LegacyBlock(21, "lapis_ore"), new LegacyBlock(22, "lapis_block"), - new LegacyBlock(23, "dispenser"), new LegacyBlock(24, "sandstone"), - new LegacyBlock(24, 1, "sandstone", "chiseled_sandstone"), - new LegacyBlock(24, 2, "sandstone", "cut_sandstone"), new LegacyBlock(25, "note_block"), - new LegacyBlock(26, "bed_block"), new LegacyBlock(27, "powered_rail"), - new LegacyBlock(28, "detector_rail"), - new LegacyBlock(29, "piston_sticky_base", "sticky_piston"), - new LegacyBlock(30, "web", "cobweb"), new LegacyBlock(31, "long_grass", "dead_bush"), - new LegacyBlock(31, 1, "long_grass", "grass"), - new LegacyBlock(31, 2, "long_grass", "fern"), new LegacyBlock(32, "dead_bush"), - new LegacyBlock(33, "piston_base", "piston"), - new LegacyBlock(34, "piston_extension", "piston_head"), - new LegacyBlock(35, "wool", "white_wool"), - new LegacyBlock(35, 1, "wool", "orange_wool"), - new LegacyBlock(35, 2, "wool", "magenta_wool"), - new LegacyBlock(35, 3, "wool", "light_blue_wool"), - new LegacyBlock(35, 4, "wool", "yellow_wool"), - new LegacyBlock(35, 5, "wool", "lime_wool"), - new LegacyBlock(35, 6, "wool", "pink_wool"), - new LegacyBlock(35, 7, "wool", "gray_wool"), - new LegacyBlock(35, 8, "wool", "light_gray_wool"), - new LegacyBlock(35, 9, "wool", "cyan_wool"), - new LegacyBlock(35, 10, "wool", "purple_wool"), - new LegacyBlock(35, 11, "wool", "blue_wool"), - new LegacyBlock(35, 12, "wool", "brown_wool"), - new LegacyBlock(35, 13, "wool", "green_wool"), - new LegacyBlock(35, 14, "wool", "red_wool"), - new LegacyBlock(35, 15, "wool", "black_wool"), - new LegacyBlock(36, "piston_moving_piece", "moving_piston"), - new LegacyBlock(37, "yellow_flower", "dandelion"), - new LegacyBlock(38, "red_rose", "poppy"), - new LegacyBlock(38, 1, "red_rose", "blue_orchid"), - new LegacyBlock(38, 2, "red_rose", "allium"), - new LegacyBlock(38, 3, "red_rose", "azure_bluet"), - new LegacyBlock(38, 4, "red_rose", "red_tulip"), - new LegacyBlock(38, 5, "red_rose", "orange_tulip"), - new LegacyBlock(38, 6, "red_rose", "white_tulip"), - new LegacyBlock(38, 7, "red_rose", "pink_tulip"), - new LegacyBlock(38, 8, "red_rose", "oxeye_daisy"), - new LegacyBlock(39, "brown_mushroom"), new LegacyBlock(40, "red_mushroom"), - new LegacyBlock(41, "gold_block"), new LegacyBlock(42, "iron_block"), - new LegacyBlock(43, "double_step"), - new LegacyBlock(43, 6, "double_step", "smooth_quartz"), - new LegacyBlock(43, 8, "double_step", "smooth_stone"), - new LegacyBlock(43, 9, "double_step", "smooth_sandstone"), - new LegacyBlock(44, "step", "stone_slab", "smooth_stone_slab"), - new LegacyBlock(44, 1, "step", "sandstone_slab"), - new LegacyBlock(44, 2, "step", "petrified_oak_slab"), - new LegacyBlock(44, 3, "step", "cobblestone_slab"), - new LegacyBlock(44, 4, "step", "brick_slab"), - new LegacyBlock(44, 5, "step", "stone_brick_slab"), - new LegacyBlock(44, 6, "step", "nether_brick_slab"), - new LegacyBlock(44, 7, "step", "quartz_slab"), new LegacyBlock(45, "brick", "bricks"), - new LegacyBlock(46, "tnt"), new LegacyBlock(47, "bookshelf"), - new LegacyBlock(48, "mossy_cobblestone"), new LegacyBlock(49, "obsidian"), - new LegacyBlock(50, "torch"), new LegacyBlock(50, 1, "torch", "wall_torch"), - new LegacyBlock(50, 2, "torch", "wall_torch"), - new LegacyBlock(50, 3, "torch", "wall_torch"), - new LegacyBlock(50, 4, "torch", "wall_torch"), new LegacyBlock(50, 5, "torch"), - new LegacyBlock(51, "fire"), new LegacyBlock(52, "mob_spawner"), - new LegacyBlock(53, "wood_stairs", "oak_stairs"), new LegacyBlock(54, "chest", "chest"), - new LegacyBlock(55, "redstone_wire"), new LegacyBlock(56, "diamond_ore"), - new LegacyBlock(57, "diamond_block"), - new LegacyBlock(58, "workbench", "crafting_table"), - new LegacyBlock(59, "crops", "wheat"), new LegacyBlock(60, "soil", "farmland"), - new LegacyBlock(61, "furnace"), new LegacyBlock(62, "burning_furnace"), - new LegacyBlock(63, "sign_post", "sign", "oak_sign"), - new LegacyBlock(64, "wooden_door", "oak_door"), new LegacyBlock(65, "ladder"), - new LegacyBlock(66, "rails", "rail"), new LegacyBlock(67, "cobblestone_stairs"), - new LegacyBlock(68, "wall_sign", "wall_sign", "oak_wall_sign"), - new LegacyBlock(69, "lever"), - new LegacyBlock(70, "stone_plate", "stone_pressure_plate"), - new LegacyBlock(71, "iron_door_block", "iron_door"), - new LegacyBlock(72, "wood_plate", "oak_pressure_plate"), - new LegacyBlock(73, "redstone_ore"), new LegacyBlock(74, "glowing_redstone_ore"), - new LegacyBlock(75, "redstone_torch_off"), - new LegacyBlock(76, "redstone_torch_on", "redstone_torch"), - new LegacyBlock(76, 1, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 2, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 3, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 4, "redstone_torch_on", "redstone_wall_torch"), - new LegacyBlock(76, 5, "redstone_torch_on", "redstone_torch"), - new LegacyBlock(77, "stone_button"), new LegacyBlock(78, "snow"), - new LegacyBlock(79, "ice"), new LegacyBlock(80, "snow_block"), - new LegacyBlock(81, "cactus"), new LegacyBlock(82, "clay"), - new LegacyBlock(83, "sugar_cane_block", "sugar_cane"), new LegacyBlock(84, "jukebox"), - new LegacyBlock(85, "fence", "oak_fence"), - new LegacyBlock(86, "pumpkin", "carved_pumpkin"), new LegacyBlock(87, "netherrack"), - new LegacyBlock(88, "soul_sand"), new LegacyBlock(89, "glowstone"), - new LegacyBlock(90, "portal"), new LegacyBlock(91, "jack_o_lantern"), - new LegacyBlock(92, "cake_block", "cake"), new LegacyBlock(93, "diode_block_off"), - new LegacyBlock(94, "diode_block_on", "repeater"), - new LegacyBlock(95, "stained_glass", "white_stained_glass"), - new LegacyBlock(95, 1, "stained_glass", "orange_stained_glass"), - new LegacyBlock(95, 2, "stained_glass", "magenta_stained_glass"), - new LegacyBlock(95, 3, "stained_glass", "light_blue_stained_glass"), - new LegacyBlock(95, 4, "stained_glass", "yellow_stained_glass"), - new LegacyBlock(95, 5, "stained_glass", "lime_stained_glass"), - new LegacyBlock(95, 6, "stained_glass", "pink_stained_glass"), - new LegacyBlock(95, 7, "stained_glass", "gray_stained_glass"), - new LegacyBlock(95, 8, "stained_glass", "light_gray_stained_glass"), - new LegacyBlock(95, 9, "stained_glass", "cyan_stained_glass"), - new LegacyBlock(95, 10, "stained_glass", "purple_stained_glass"), - new LegacyBlock(95, 11, "stained_glass", "blue_stained_glass"), - new LegacyBlock(95, 12, "stained_glass", "brown_stained_glass"), - new LegacyBlock(95, 13, "stained_glass", "green_stained_glass"), - new LegacyBlock(95, 14, "stained_glass", "red_stained_glass"), - new LegacyBlock(95, 15, "stained_glass", "black_stained_glass"), - new LegacyBlock(96, "trap_door", "oak_trapdoor"), - new LegacyBlock(97, "monster_eggs", "infested_stone"), - new LegacyBlock(97, 1, "monster_eggs", "infested_cobblestone"), - new LegacyBlock(97, 2, "monster_eggs", "infested_stone_bricks"), - new LegacyBlock(97, 3, "monster_eggs", "infested_mossy_stone_bricks"), - new LegacyBlock(97, 4, "monster_eggs", "infested_cracked_stone_bricks"), - new LegacyBlock(97, 5, "monster_eggs", "infested_chiseled_stone_bricks"), - new LegacyBlock(98, "smooth_brick", "stone_bricks"), - new LegacyBlock(98, 1, "smooth_brick", "mossy_stone_bricks"), - new LegacyBlock(98, 2, "smooth_brick", "cracked_stone_bricks"), - new LegacyBlock(98, 3, "smooth_brick", "chiseled_bricks"), - new LegacyBlock(99, "huge_mushroom_1", "brown_mushroom_block"), - new LegacyBlock(99, 1, "huge_mushroom_1"), new LegacyBlock(99, 2, "huge_mushroom_1"), - new LegacyBlock(99, 3, "huge_mushroom_1"), new LegacyBlock(99, 4, "huge_mushroom_1"), - new LegacyBlock(99, 5, "huge_mushroom_1"), new LegacyBlock(99, 6, "huge_mushroom_1"), - new LegacyBlock(99, 7, "huge_mushroom_1"), new LegacyBlock(99, 8, "huge_mushroom_1"), - new LegacyBlock(99, 9, "huge_mushroom_1"), - new LegacyBlock(99, 10, "huge_mushroom_1", "mushroom_stem"), - new LegacyBlock(99, 14, "huge_mushroom_1"), new LegacyBlock(99, 15, "huge_mushroom_1"), - new LegacyBlock(100, "huge_mushroom_2", "red_mushroom_block"), - new LegacyBlock(100, 1, "huge_mushroom_2"), new LegacyBlock(100, 2, "huge_mushroom_2"), - new LegacyBlock(100, 3, "huge_mushroom_2"), new LegacyBlock(100, 4, "huge_mushroom_2"), - new LegacyBlock(100, 5, "huge_mushroom_2"), new LegacyBlock(100, 6, "huge_mushroom_2"), - new LegacyBlock(100, 7, "huge_mushroom_2"), new LegacyBlock(100, 8, "huge_mushroom_2"), - new LegacyBlock(100, 9, "huge_mushroom_2"), - new LegacyBlock(100, 10, "huge_mushroom_2", "mushroom_stem"), - new LegacyBlock(100, 14, "huge_mushroom_2"), - new LegacyBlock(100, 15, "huge_mushroom_2"), - new LegacyBlock(101, "iron_fence", "iron_bars"), - new LegacyBlock(102, "thin_glass", "glass_pane"), new LegacyBlock(103, "melon_block"), - new LegacyBlock(104, "pumpkin_stem"), new LegacyBlock(105, "melon_stem"), - new LegacyBlock(106, "vine"), new LegacyBlock(107, "fence_gate", "oak_fence_gate"), - new LegacyBlock(108, "brick_stairs"), - new LegacyBlock(109, "smooth_stairs", "stone_brick_stairs"), - new LegacyBlock(110, "mycel", "mycelium"), - new LegacyBlock(111, "water_lily", "lily_pad"), - new LegacyBlock(112, "nether_brick", "nether_bricks"), - new LegacyBlock(113, "nether_fence", "nether_brick_fence"), - new LegacyBlock(114, "nether_brick_stairs"), - new LegacyBlock(115, "nether_warts", "nether_wart"), - new LegacyBlock(116, "enchantment_table", "enchanting_table"), - new LegacyBlock(117, "brewing_stand"), new LegacyBlock(118, "cauldron"), - new LegacyBlock(119, "ender_portal", "end_portal"), - new LegacyBlock(120, "ender_portal_frame", "end_portal_frame"), - new LegacyBlock(121, "ender_stone", "end_stone"), new LegacyBlock(122, "dragon_egg"), - new LegacyBlock(123, "redstone_lamp_off"), - new LegacyBlock(124, "redstone_lamp_on", "redstone_lamp"), - new LegacyBlock(125, "wood_double_step"), new LegacyBlock(125, 1, "wood_double_step"), - new LegacyBlock(125, 2, "wood_double_step"), - new LegacyBlock(125, 3, "wood_double_step"), - new LegacyBlock(125, 4, "wood_double_step"), - new LegacyBlock(125, 5, "wood_double_step"), - new LegacyBlock(126, "wood_step", "oak_slab"), - new LegacyBlock(126, 1, "wood_step", "spruce_slab"), - new LegacyBlock(126, 2, "wood_step", "birch_slab"), - new LegacyBlock(126, 3, "wood_step", "jungle_slab"), - new LegacyBlock(126, 4, "wood_step", "acacia_slab"), - new LegacyBlock(126, 5, "wood_step", "dark_oak_slab"), new LegacyBlock(127, "cocoa"), - new LegacyBlock(128, "sandstone_stairs"), new LegacyBlock(129, "emerald_ore"), - new LegacyBlock(130, "ender_chest"), new LegacyBlock(131, "tripwire_hook"), - new LegacyBlock(132, "tripwire"), new LegacyBlock(133, "emerald_block"), - new LegacyBlock(134, "spruce_wood_stairs", "spruce_stairs"), - new LegacyBlock(135, "birch_wood_stairs", "birch_stairs"), - new LegacyBlock(136, "jungle_wood_stairs", "jungle_stairs"), - new LegacyBlock(137, "command", "command_block"), new LegacyBlock(138, "beacon"), - new LegacyBlock(139, "cobble_wall", "cobblestone_wall"), - new LegacyBlock(139, 1, "cobble_wall", "mossy_cobblestone_wall"), - new LegacyBlock(140, "flower_pot"), new LegacyBlock(141, "carrot", "carrots"), - new LegacyBlock(142, "potato", "potatoes"), - new LegacyBlock(143, "wood_button", "oak_button"), - new LegacyBlock(144, "skull", "skeleton_skull"), - new LegacyBlock(144, 1, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 2, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 3, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 4, "skull", "skeleton_wall_skull"), - new LegacyBlock(144, 5, "skull", "skeleton_wall_skull"), new LegacyBlock(145, "anvil"), - new LegacyBlock(145, 1, "anvil", "chipped_anvil"), - new LegacyBlock(145, 2, "anvil", "damaged_anvil"), - new LegacyBlock(146, "trapped_chest"), - new LegacyBlock(147, "gold_plate", "light_weighted_pressure_plate"), - new LegacyBlock(148, "iron_plate", "heavy_weighted_pressure_plate"), - new LegacyBlock(149, "redstone_comparator_off"), - new LegacyBlock(150, "redstone_comparator_on", "comparator"), - new LegacyBlock(151, "daylight_detector"), new LegacyBlock(152, "redstone_block"), - new LegacyBlock(153, "quartz_ore", "nether_quartz_ore"), new LegacyBlock(154, "hopper"), - new LegacyBlock(155, "quartz_block"), new LegacyBlock(156, "quartz_stairs"), - new LegacyBlock(157, "activator_rail"), new LegacyBlock(158, "dropper"), - new LegacyBlock(159, "stained_clay", "white_terracotta"), - new LegacyBlock(159, 1, "stained_clay", "orange_terracotta"), - new LegacyBlock(159, 2, "stained_clay", "magenta_terracotta"), - new LegacyBlock(159, 3, "stained_clay", "light_blue_terracotta"), - new LegacyBlock(159, 4, "stained_clay", "yellow_terracotta"), - new LegacyBlock(159, 5, "stained_clay", "lime_terracotta"), - new LegacyBlock(159, 6, "stained_clay", "pink_terracotta"), - new LegacyBlock(159, 7, "stained_clay", "gray_terracotta"), - new LegacyBlock(159, 8, "stained_clay", "light_gray_terracotta"), - new LegacyBlock(159, 9, "stained_clay", "cyan_terracotta"), - new LegacyBlock(159, 10, "stained_clay", "purple_terracotta"), - new LegacyBlock(159, 11, "stained_clay", "blue_terracotta"), - new LegacyBlock(159, 12, "stained_clay", "brown_terracotta"), - new LegacyBlock(159, 13, "stained_clay", "green_terracotta"), - new LegacyBlock(159, 14, "stained_clay", "red_terracotta"), - new LegacyBlock(159, 15, "stained_clay", "black_terracotta"), - new LegacyBlock(160, "stained_glass_pane", "white_stained_glass_pane"), - new LegacyBlock(160, 1, "stained_glass_pane", "orange_stained_glass_pane"), - new LegacyBlock(160, 2, "stained_glass_pane", "magenta_stained_glass_pane"), - new LegacyBlock(160, 3, "stained_glass_pane", "light_blue_stained_glass_pane"), - new LegacyBlock(160, 4, "stained_glass_pane", "yellow_stained_glass_pane"), - new LegacyBlock(160, 5, "stained_glass_pane", "lime_stained_glass_pane"), - new LegacyBlock(160, 6, "stained_glass_pane", "pink_stained_glass_pane"), - new LegacyBlock(160, 7, "stained_glass_pane", "gray_stained_glass_pane"), - new LegacyBlock(160, 8, "stained_glass_pane", "light_gray_stained_glass_pane"), - new LegacyBlock(160, 9, "stained_glass_pane", "cyan_stained_glass_pane"), - new LegacyBlock(160, 10, "stained_glass_pane", "purple_stained_glass_pane"), - new LegacyBlock(160, 11, "stained_glass_pane", "blue_stained_glass_pane"), - new LegacyBlock(160, 12, "stained_glass_pane", "brown_stained_glass_pane"), - new LegacyBlock(160, 13, "stained_glass_pane", "green_stained_glass_pane"), - new LegacyBlock(160, 14, "stained_glass_pane", "red_stained_glass_pane"), - new LegacyBlock(160, 15, "stained_glass_pane", "black_stained_glass_pane"), - new LegacyBlock(161, "leaves_2", "acacia_leaves"), - new LegacyBlock(161, 1, "leaves_2", "dark_oak_leaves"), - new LegacyBlock(162, "log_2", "acacia_log"), - new LegacyBlock(162, 1, "log_2", "spruce_log"), - new LegacyBlock(162, 2, "log_2", "birch_log"), - new LegacyBlock(162, 3, "log_2", "jungle_log"), - new LegacyBlock(163, "acacia_stairs", "acacia_stairs"), - new LegacyBlock(164, "dark_oak_stairs", "dark_oak_stairs"), - new LegacyBlock(165, "slime_block", "slime_block"), - new LegacyBlock(166, "barrier", "barrier"), - new LegacyBlock(167, "iron_trapdoor", "iron_trapdoor"), - new LegacyBlock(168, "prismarine"), - new LegacyBlock(168, 1, "prismarine", "prismarine_bricks"), - new LegacyBlock(168, 2, "prismarine", "dark_prismarine"), - new LegacyBlock(169, "sea_lantern"), new LegacyBlock(170, "hay_block"), - new LegacyBlock(171, "carpet", "white_carpet"), - new LegacyBlock(171, 1, "carpet", "orange_carpet"), - new LegacyBlock(171, 2, "carpet", "magenta_carpet"), - new LegacyBlock(171, 3, "carpet", "light_blue_carpet"), - new LegacyBlock(171, 4, "carpet", "yellow_carpet"), - new LegacyBlock(171, 5, "carpet", "lime_carpet"), - new LegacyBlock(171, 6, "carpet", "pink_carpet"), - new LegacyBlock(171, 7, "carpet", "gray_carpet"), - new LegacyBlock(171, 8, "carpet", "light_gray_carpet"), - new LegacyBlock(171, 9, "carpet", "cyan_carpet"), - new LegacyBlock(171, 10, "carpet", "purple_carpet"), - new LegacyBlock(171, 11, "carpet", "blue_carpet"), - new LegacyBlock(171, 12, "carpet", "brown_carpet"), - new LegacyBlock(171, 13, "carpet", "green_carpet"), - new LegacyBlock(171, 14, "carpet", "red_carpet"), - new LegacyBlock(171, 15, "carpet", "black_carpet"), - new LegacyBlock(172, "hard_clay", "terracotta"), new LegacyBlock(173, "coal_block"), - new LegacyBlock(174, "packed_ice"), new LegacyBlock(175, "double_plant", "sunflower"), - new LegacyBlock(175, 1, "double_plant", "lilac"), - new LegacyBlock(175, 2, "double_plant", "tall_grass"), - new LegacyBlock(175, 3, "double_plant", "large_fern"), - new LegacyBlock(175, 4, "double_plant", "rose_bush"), - new LegacyBlock(175, 5, "double_plant", "peony"), - new LegacyBlock(176, "standing_banner"), new LegacyBlock(177, "wall_banner"), - new LegacyBlock(178, "daylight_detector_inverted"), - new LegacyBlock(179, "red_sandstone", "red_sandstone"), - new LegacyBlock(179, 1, "red_sandstone", "chiseled_red_sandstone"), - new LegacyBlock(179, 2, "red_sandstone", "cut_red_sandstone"), - new LegacyBlock(180, "red_sandstone_stairs"), - new LegacyBlock(181, "double_stone_slab2"), - new LegacyBlock(181, 8, "double_stone_slab2", "smooth_red_sandstone"), - new LegacyBlock(182, "stone_slab2", "red_sandstone_slab"), - new LegacyBlock(183, "spruce_fence_gate"), new LegacyBlock(184, "birch_fence_gate"), - new LegacyBlock(185, "jungle_fence_gate"), new LegacyBlock(186, "dark_oak_fence_gate"), - new LegacyBlock(187, "acacia_fence_gate"), new LegacyBlock(188, "spruce_fence"), - new LegacyBlock(189, "birch_fence"), new LegacyBlock(190, "jungle_fence"), - new LegacyBlock(191, "dark_oak_fence"), new LegacyBlock(192, "acacia_fence"), - new LegacyBlock(193, "spruce_door"), new LegacyBlock(194, "birch_door"), - new LegacyBlock(195, "jungle_door"), new LegacyBlock(196, "acacia_door"), - new LegacyBlock(197, "dark_oak_door"), new LegacyBlock(198, "end_rod"), - new LegacyBlock(199, "chorus_plant"), new LegacyBlock(200, "chorus_flower"), - new LegacyBlock(201, "purpur_block"), new LegacyBlock(202, "purpur_pillar"), - new LegacyBlock(203, "purpur_stairs"), new LegacyBlock(204, "purpur_double_slab"), - new LegacyBlock(205, "purpur_slab"), - new LegacyBlock(206, "end_bricks", "end_stone_bricks"), - new LegacyBlock(207, "beetroot_block", "beetroots"), new LegacyBlock(208, "grass_path"), - new LegacyBlock(209, "end_gateway"), - new LegacyBlock(210, "command_repeating", "repeating_command_block"), - new LegacyBlock(211, "command_chain", "chain_command_block"), - new LegacyBlock(212, "frosted_ice"), new LegacyBlock(213, "magma", "magma_block"), - new LegacyBlock(214, "nether_wart_block"), - new LegacyBlock(215, "red_nether_brick", "red_nether_bricks"), - new LegacyBlock(216, "bone_block"), new LegacyBlock(217, "structure_void"), - new LegacyBlock(218, "observer"), new LegacyBlock(219, "white_shulker_box"), - new LegacyBlock(220, "orange_shulker_box"), new LegacyBlock(221, "magenta_shulker_box"), - new LegacyBlock(222, "light_blue_shulker_box"), - new LegacyBlock(223, "yellow_shulker_box"), new LegacyBlock(224, "lime_shulker_box"), - new LegacyBlock(225, "pink_shulker_box"), new LegacyBlock(226, "gray_shulker_box"), - new LegacyBlock(227, "silver_shulker_box", "light_gray_shulker_box"), - new LegacyBlock(228, "cyan_shulker_box"), new LegacyBlock(229, "purple_shulker_box"), - new LegacyBlock(230, "blue_shulker_box"), new LegacyBlock(231, "brown_shulker_box"), - new LegacyBlock(232, "green_shulker_box"), new LegacyBlock(233, "red_shulker_box"), - new LegacyBlock(234, "black_shulker_box"), - new LegacyBlock(235, "white_glazed_terracotta"), - new LegacyBlock(236, "orange_glazed_terracotta"), - new LegacyBlock(237, "magenta_glazed_terracotta"), - new LegacyBlock(238, "light_blue_glazed_terracotta"), - new LegacyBlock(239, "yellow_glazed_terracotta"), - new LegacyBlock(240, "lime_glazed_terracotta"), - new LegacyBlock(241, "pink_glazed_terracotta"), - new LegacyBlock(242, "gray_glazed_terracotta"), - new LegacyBlock(243, "silver_glazed_terracotta", "light_gray_glazed_terracotta"), - new LegacyBlock(244, "cyan_glazed_terracotta"), - new LegacyBlock(245, "purple_glazed_terracotta"), - new LegacyBlock(246, "blue_glazed_terracotta"), - new LegacyBlock(247, "brown_glazed_terracotta"), - new LegacyBlock(248, "green_glazed_terracotta"), - new LegacyBlock(249, "red_glazed_terracotta"), - new LegacyBlock(250, "black_glazed_terracotta"), - new LegacyBlock(251, "concrete", "white_concrete"), - new LegacyBlock(251, 1, "concrete", "orange_concrete"), - new LegacyBlock(251, 2, "concrete", "magenta_concrete"), - new LegacyBlock(251, 3, "concrete", "light_blue_concrete"), - new LegacyBlock(251, 4, "concrete", "yellow_concrete"), - new LegacyBlock(251, 5, "concrete", "lime_concrete"), - new LegacyBlock(251, 6, "concrete", "pink_concrete"), - new LegacyBlock(251, 7, "concrete", "gray_concrete"), - new LegacyBlock(251, 8, "concrete", "light_gray_concrete"), - new LegacyBlock(251, 9, "concrete", "cyan_concrete"), - new LegacyBlock(251, 10, "concrete", "purple_concrete"), - new LegacyBlock(251, 11, "concrete", "blue_concrete"), - new LegacyBlock(251, 12, "concrete", "brown_concrete"), - new LegacyBlock(251, 13, "concrete", "green_concrete"), - new LegacyBlock(251, 14, "concrete", "red_concrete"), - new LegacyBlock(251, 15, "concrete", "black_concrete"), - new LegacyBlock(252, "concrete_powder", "white_concrete_powder"), - new LegacyBlock(252, 1, "concrete_powder", "orange_concrete_powder"), - new LegacyBlock(252, 2, "concrete_powder", "magenta_concrete_powder"), - new LegacyBlock(252, 3, "concrete_powder", "light_blue_concrete_powder"), - new LegacyBlock(252, 4, "concrete_powder", "yellow_concrete_powder"), - new LegacyBlock(252, 5, "concrete_powder", "lime_concrete_powder"), - new LegacyBlock(252, 6, "concrete_powder", "pink_concrete_powder"), - new LegacyBlock(252, 7, "concrete_powder", "gray_concrete_powder"), - new LegacyBlock(252, 8, "concrete_powder", "light_gray_concrete_powder"), - new LegacyBlock(252, 9, "concrete_powder", "cyan_concrete_powder"), - new LegacyBlock(252, 10, "concrete_powder", "purple_concrete_powder"), - new LegacyBlock(252, 11, "concrete_powder", "blue_concrete_powder"), - new LegacyBlock(252, 12, "concrete_powder", "brown_concrete_powder"), - new LegacyBlock(252, 13, "concrete_powder", "green_concrete_powder"), - new LegacyBlock(252, 14, "concrete_powder", "red_concrete_powder"), - new LegacyBlock(252, 15, "concrete_powder", "black_concrete_powder"), - new LegacyBlock(255, "structure_block"), - new LegacyBlock(256, "iron_spade", "iron_shovel"), new LegacyBlock(257, "iron_pickaxe"), - new LegacyBlock(258, "iron_axe"), new LegacyBlock(259, "flint_and_steel"), - new LegacyBlock(260, "apple"), new LegacyBlock(261, "bow"), - new LegacyBlock(262, "arrow"), new LegacyBlock(263, "coal"), - new LegacyBlock(263, 1, "coal", "charcoal"), new LegacyBlock(264, "diamond"), - new LegacyBlock(265, "iron_ingot"), new LegacyBlock(266, "gold_ingot"), - new LegacyBlock(267, "iron_sword"), new LegacyBlock(268, "wood_sword", "wooden_sword"), - new LegacyBlock(269, "wood_spade", "wooden_shovel"), - new LegacyBlock(270, "wood_pickaxe", "wooden_pickaxe"), - new LegacyBlock(271, "wood_axe", "wooden_axe"), new LegacyBlock(272, "stone_sword"), - new LegacyBlock(273, "stone_spade", "stone_shovel"), - new LegacyBlock(274, "stone_pickaxe"), new LegacyBlock(275, "stone_axe"), - new LegacyBlock(276, "diamond_sword"), - new LegacyBlock(277, "diamond_spade", "diamond_shovel"), - new LegacyBlock(278, "diamond_pickaxe"), new LegacyBlock(279, "diamond_axe"), - new LegacyBlock(280, "stick"), new LegacyBlock(281, "bowl"), - new LegacyBlock(282, "mushroom_soup", "mushroom_stew"), - new LegacyBlock(283, "gold_sword", "golden_sword"), - new LegacyBlock(284, "gold_spade", "golden_shovel"), - new LegacyBlock(285, "gold_pickaxe", "golden_pickaxe"), - new LegacyBlock(286, "gold_axe", "golden_axe"), new LegacyBlock(287, "string"), - new LegacyBlock(288, "feather"), new LegacyBlock(289, "sulphur", "gunpowder"), - new LegacyBlock(290, "wood_hoe", "wooden_hoe"), new LegacyBlock(291, "stone_hoe"), - new LegacyBlock(292, "iron_hoe"), new LegacyBlock(293, "diamond_hoe"), - new LegacyBlock(294, "gold_hoe", "golden_hoe"), - new LegacyBlock(295, "seeds", "wheat_seeds"), new LegacyBlock(296, "wheat"), - new LegacyBlock(297, "bread"), new LegacyBlock(298, "leather_helmet"), - new LegacyBlock(299, "leather_chestplate"), new LegacyBlock(300, "leather_leggings"), - new LegacyBlock(301, "leather_boots"), new LegacyBlock(302, "chainmail_helmet"), - new LegacyBlock(303, "chainmail_chestplate"), - new LegacyBlock(304, "chainmail_leggings"), new LegacyBlock(305, "chainmail_boots"), - new LegacyBlock(306, "iron_helmet"), new LegacyBlock(307, "iron_chestplate"), - new LegacyBlock(308, "iron_leggings"), new LegacyBlock(309, "iron_boots"), - new LegacyBlock(310, "diamond_helmet"), new LegacyBlock(311, "diamond_chestplate"), - new LegacyBlock(312, "diamond_leggings"), new LegacyBlock(313, "diamond_boots"), - new LegacyBlock(314, "gold_helmet", "golden_helmet"), - new LegacyBlock(315, "gold_chestplate", "golden_chestplate"), - new LegacyBlock(316, "gold_leggings", "golden_leggings"), - new LegacyBlock(317, "gold_boots", "golden_boots"), new LegacyBlock(318, "flint"), - new LegacyBlock(319, "pork", "porkchop"), - new LegacyBlock(320, "grilled_pork", "cooked_porkchop"), - new LegacyBlock(321, "painting"), new LegacyBlock(322, "golden_apple", "golden_apple"), - new LegacyBlock(322, 1, "golden_apple", "enchanted_golden_apple"), - new LegacyBlock(323, "sign"), new LegacyBlock(324, "wood_door", "oak_door"), - new LegacyBlock(325, "bucket"), new LegacyBlock(326, "water_bucket"), - new LegacyBlock(327, "lava_bucket"), new LegacyBlock(328, "minecart"), - new LegacyBlock(329, "saddle"), new LegacyBlock(330, "iron_door"), - new LegacyBlock(331, "redstone"), new LegacyBlock(332, "snow_ball", "snowball"), - new LegacyBlock(333, "boat", "oak_boat"), new LegacyBlock(334, "leather"), - new LegacyBlock(335, "milk_bucket"), new LegacyBlock(336, "clay_brick", "brick"), - new LegacyBlock(337, "clay_ball"), new LegacyBlock(338, "sugar_cane"), - new LegacyBlock(339, "paper"), new LegacyBlock(340, "book"), - new LegacyBlock(341, "slime_ball"), - new LegacyBlock(342, "storage_minecart", "chest_minecart"), - new LegacyBlock(343, "powered_minecart", "furnace_minecart"), - new LegacyBlock(344, "egg"), new LegacyBlock(345, "compass"), - new LegacyBlock(346, "fishing_rod"), new LegacyBlock(347, "watch", "clock"), - new LegacyBlock(348, "glowstone_dust"), new LegacyBlock(349, "raw_fish", "cod"), - new LegacyBlock(349, 1, "raw_fish", "salmon"), - new LegacyBlock(349, 2, "raw_fish", "tropical_fish"), - new LegacyBlock(349, 3, "raw_fish", "pufferfish"), - new LegacyBlock(350, "cooked_fish", "cooked_cod"), - new LegacyBlock(350, 1, "cooked_fish", "cooked_salmon"), - new LegacyBlock(351, "ink_sack", "ink_sac"), - new LegacyBlock(351, 1, "ink_sack", "rose_red"), - new LegacyBlock(351, 2, "ink_sack", "cactus_green"), - new LegacyBlock(351, 3, "ink_sack", "cocoa_beans"), - new LegacyBlock(351, 4, "ink_sack", "lapis_lazuli"), - new LegacyBlock(351, 5, "ink_sack", "purple_dye"), - new LegacyBlock(351, 6, "ink_sack", "cyan_dye"), - new LegacyBlock(351, 7, "ink_sack", "light_gray_dye"), - new LegacyBlock(351, 8, "ink_sack", "gray_dye"), - new LegacyBlock(351, 9, "ink_sack", "pink_dye"), - new LegacyBlock(351, 10, "ink_sack", "lime_dye"), - new LegacyBlock(351, 11, "ink_sack", "dandelion_yellow"), - new LegacyBlock(351, 12, "ink_sack", "light_blue_dye"), - new LegacyBlock(351, 13, "ink_sack", "magenta_dye"), - new LegacyBlock(351, 14, "ink_sack", "orange_dye"), - new LegacyBlock(351, 15, "ink_sack", "bone_meal"), new LegacyBlock(352, "bone"), - new LegacyBlock(353, "sugar", "sugar"), new LegacyBlock(354, "cake", "cake"), - new LegacyBlock(355, "bed", "white_bed"), new LegacyBlock(355, 1, "bed", "orange_bed"), - new LegacyBlock(355, 2, "bed", "magenta_bed"), - new LegacyBlock(355, 3, "bed", "light_blue_bed"), - new LegacyBlock(355, 4, "bed", "yellow_bed"), - new LegacyBlock(355, 5, "bed", "lime_bed"), new LegacyBlock(355, 6, "bed", "pink_bed"), - new LegacyBlock(355, 7, "bed", "gray_bed"), - new LegacyBlock(355, 8, "bed", "light_gray_bed"), - new LegacyBlock(355, 9, "bed", "cyan_bed"), - new LegacyBlock(355, 10, "bed", "purple_bed"), - new LegacyBlock(355, 11, "bed", "blue_bed"), - new LegacyBlock(355, 12, "bed", "brown_bed"), - new LegacyBlock(355, 13, "bed", "green_bed"), - new LegacyBlock(355, 14, "bed", "red_bed"), - new LegacyBlock(355, 15, "bed", "black_bed"), new LegacyBlock(356, "diode", "repeater"), - new LegacyBlock(357, "cookie", "cookie"), new LegacyBlock(358, "map"), - new LegacyBlock(359, "shears"), new LegacyBlock(360, "melon", "melon"), - new LegacyBlock(361, "pumpkin_seeds", "pumpkin_seeds"), - new LegacyBlock(362, "melon_seeds", "melon_seeds"), - new LegacyBlock(363, "raw_beef", "beef"), new LegacyBlock(364, "cooked_beef"), - new LegacyBlock(365, "raw_chicken", "chicken"), new LegacyBlock(366, "cooked_chicken"), - new LegacyBlock(367, "rotten_flesh"), new LegacyBlock(368, "ender_pearl"), - new LegacyBlock(369, "blaze_rod"), new LegacyBlock(370, "ghast_tear"), - new LegacyBlock(371, "gold_nugget"), - new LegacyBlock(372, "nether_stalk", "nether_wart"), - new LegacyBlock(373, "potion", "potion"), new LegacyBlock(374, "glass_bottle"), - new LegacyBlock(375, "spider_eye"), new LegacyBlock(376, "fermented_spider_eye"), - new LegacyBlock(377, "blaze_powder"), new LegacyBlock(378, "magma_cream"), - new LegacyBlock(379, "brewing_stand_item", "brewing_stand"), - new LegacyBlock(380, "cauldron_item", "cauldron"), - new LegacyBlock(381, "eye_of_ender", "ender_eye"), - new LegacyBlock(382, "speckled_melon"), new LegacyBlock(383, "monster_egg"), - new LegacyBlock(383, 4, "monster_egg", "elder_guardian_spawn_egg"), - new LegacyBlock(383, 5, "monster_egg", "wither_skeleton_spawn_egg"), - new LegacyBlock(383, 6, "monster_egg", "stray_spawn_egg"), - new LegacyBlock(383, 23, "monster_egg", "husk_spawn_egg"), - new LegacyBlock(383, 27, "monster_egg", "zombie_villager_spawn_egg"), - new LegacyBlock(383, 28, "monster_egg", "skeleton_horse_spawn_egg"), - new LegacyBlock(383, 29, "monster_egg", "zombie_horse_spawn_egg"), - new LegacyBlock(383, 31, "monster_egg", "donkey_spawn_egg"), - new LegacyBlock(383, 32, "monster_egg", "mule_spawn_egg"), - new LegacyBlock(383, 34, "monster_egg", "evocation_illager_spawn_egg"), - new LegacyBlock(383, 35, "monster_egg", "vex_spawn_egg"), - new LegacyBlock(383, 36, "monster_egg", "vindication_illager_spawn_egg"), - new LegacyBlock(383, 50, "monster_egg", "creeper_spawn_egg"), - new LegacyBlock(383, 51, "monster_egg", "skeleton_spawn_egg"), - new LegacyBlock(383, 52, "monster_egg", "spider_spawn_egg"), - new LegacyBlock(383, 54, "monster_egg", "zombie_spawn_egg"), - new LegacyBlock(383, 55, "monster_egg", "slime_spawn_egg"), - new LegacyBlock(383, 56, "monster_egg", "ghast_spawn_egg"), - new LegacyBlock(383, 57, "monster_egg", "zombie_pigman_spawn_egg"), - new LegacyBlock(383, 58, "monster_egg", "enderman_spawn_egg"), - new LegacyBlock(383, 59, "monster_egg", "cave_spider_spawn_egg"), - new LegacyBlock(383, 60, "monster_egg", "silverfish_spawn_egg"), - new LegacyBlock(383, 61, "monster_egg", "blaze_spawn_egg"), - new LegacyBlock(383, 62, "monster_egg", "magma_cube_spawn_egg"), - new LegacyBlock(383, 65, "monster_egg", "bat_spawn_egg"), - new LegacyBlock(383, 66, "monster_egg", "witch_spawn_egg"), - new LegacyBlock(383, 67, "monster_egg", "endermite_spawn_egg"), - new LegacyBlock(383, 68, "monster_egg", "guardian_spawn_egg"), - new LegacyBlock(383, 69, "monster_egg", "shulker_spawn_egg"), - new LegacyBlock(383, 90, "monster_egg", "pig_spawn_egg"), - new LegacyBlock(383, 91, "monster_egg", "sheep_spawn_egg"), - new LegacyBlock(383, 92, "monster_egg", "cow_spawn_egg"), - new LegacyBlock(383, 93, "monster_egg", "chicken_spawn_egg"), - new LegacyBlock(383, 94, "monster_egg", "squid_spawn_egg"), - new LegacyBlock(383, 95, "monster_egg", "wolf_spawn_egg"), - new LegacyBlock(383, 96, "monster_egg", "mooshroom_spawn_egg"), - new LegacyBlock(383, 98, "monster_egg", "ocelot_spawn_egg"), - new LegacyBlock(383, 100, "monster_egg", "horse_spawn_egg"), - new LegacyBlock(383, 101, "monster_egg", "rabbit_spawn_egg"), - new LegacyBlock(383, 102, "monster_egg", "polar_bear_spawn_egg"), - new LegacyBlock(383, 103, "monster_egg", "llama_spawn_egg"), - new LegacyBlock(383, 120, "monster_egg", "villager_spawn_egg"), - new LegacyBlock(384, "exp_bottle", "experience_bottle"), - new LegacyBlock(385, "fireball", "fire_charge"), - new LegacyBlock(386, "book_and_quill", "writable_book"), - new LegacyBlock(387, "written_book"), new LegacyBlock(388, "emerald"), - new LegacyBlock(389, "item_frame"), - new LegacyBlock(390, "flower_pot_item", "flower_pot"), - new LegacyBlock(391, "carrot_item", "carrot"), - new LegacyBlock(392, "potato_item", "potato"), new LegacyBlock(393, "baked_potato"), - new LegacyBlock(394, "poisonous_potato"), new LegacyBlock(395, "empty_map", "map"), - new LegacyBlock(396, "golden_carrot"), - new LegacyBlock(397, "skull_item", "skeleton_skull"), - new LegacyBlock(397, 1, "skull_item", "wither_skeleton_skull"), - new LegacyBlock(397, 2, "skull_item", "zombie_head"), - new LegacyBlock(397, 3, "skull_item", "player_head"), - new LegacyBlock(397, 4, "skull_item", "creeper_head"), - new LegacyBlock(397, 5, "skull_item", "dragon_head"), - new LegacyBlock(398, "carrot_stick"), new LegacyBlock(399, "nether_star"), - new LegacyBlock(400, "pumpkin_pie"), - new LegacyBlock(401, "firework", "firework_rocket"), - new LegacyBlock(402, "firework_charge", "firework_star"), - new LegacyBlock(403, "enchanted_book"), - new LegacyBlock(404, "redstone_comparator", "comparator"), - new LegacyBlock(405, "nether_brick_item", "nether_brick"), - new LegacyBlock(406, "quartz"), - new LegacyBlock(407, "explosive_minecart", "tnt_minecart"), - new LegacyBlock(408, "hopper_minecart"), new LegacyBlock(409, "prismarine_shard"), - new LegacyBlock(410, "prismarine_crystals"), new LegacyBlock(411, "rabbit"), - new LegacyBlock(412, "cooked_rabbit"), new LegacyBlock(413, "rabbit_stew"), - new LegacyBlock(414, "rabbit_foot"), new LegacyBlock(415, "rabbit_hide"), - new LegacyBlock(416, "armor_stand"), - new LegacyBlock(417, "iron_barding", "iron_horse_armor"), - new LegacyBlock(418, "gold_barding", "gold_horse_armor"), - new LegacyBlock(419, "diamond_barding", "diamond_horse_armor"), - new LegacyBlock(420, "leash", "lead"), new LegacyBlock(421, "name_tag"), - new LegacyBlock(422, "command_minecart", "command_block_minecart"), - new LegacyBlock(423, "mutton"), new LegacyBlock(424, "cooked_mutton"), - new LegacyBlock(425, "banner", "white_banner"), - new LegacyBlock(425, 1, "banner", "orange_banner"), - new LegacyBlock(425, 2, "banner", "magenta_banner"), - new LegacyBlock(425, 3, "banner", "light_blue_banner"), - new LegacyBlock(425, 4, "banner", "yellow_banner"), - new LegacyBlock(425, 5, "banner", "lime_banner"), - new LegacyBlock(425, 6, "banner", "pink_banner"), - new LegacyBlock(425, 7, "banner", "gray_banner"), - new LegacyBlock(425, 8, "banner", "light_gray_banner"), - new LegacyBlock(425, 9, "banner", "cyan_banner"), - new LegacyBlock(425, 10, "banner", "purple_banner"), - new LegacyBlock(425, 11, "banner", "blue_banner"), - new LegacyBlock(425, 12, "banner", "brown_banner"), - new LegacyBlock(425, 13, "banner", "green_banner"), - new LegacyBlock(425, 14, "banner", "red_banner"), - new LegacyBlock(425, 15, "banner", "black_banner"), new LegacyBlock(426, "end_crystal"), - new LegacyBlock(427, "spruce_door_item", "spruce_door"), - new LegacyBlock(428, "birch_door_item", "birch_door"), - new LegacyBlock(429, "jungle_door_item", "jungle_door"), - new LegacyBlock(430, "acacia_door_item", "acacia_door"), - new LegacyBlock(431, "dark_oak_door_item", "dark_oak_door"), - new LegacyBlock(432, "chorus_fruit"), new LegacyBlock(433, "chorus_fruit_popped"), - new LegacyBlock(434, "beetroot"), new LegacyBlock(435, "beetroot_seeds"), - new LegacyBlock(436, "beetroot_soup"), - new LegacyBlock(437, "dragons_breath", "dragon_breath"), - new LegacyBlock(438, "splash_potion"), new LegacyBlock(439, "spectral_arrow"), - new LegacyBlock(440, "tipped_arrow"), new LegacyBlock(441, "lingering_potion"), - new LegacyBlock(442, "shield"), new LegacyBlock(443, "elytra"), - new LegacyBlock(444, "boat_spruce", "spruce_boat"), - new LegacyBlock(445, "boat_birch", "birch_boat"), - new LegacyBlock(446, "boat_jungle", "jungle_boat"), - new LegacyBlock(447, "boat_acacia", "acacia_boat"), - new LegacyBlock(448, "boat_dark_oak", "dark_oak_boat"), - new LegacyBlock(449, "totem", "totem_of_undying"), - new LegacyBlock(450, "shulker_shell"), new LegacyBlock(452, "iron_nugget"), - new LegacyBlock(453, "knowledge_book"), - new LegacyBlock(2256, "gold_record", "music_disc_13"), - new LegacyBlock(2257, "green_record", "music_disc_cat"), - new LegacyBlock(2258, "record_3", "music_disc_blocks"), - new LegacyBlock(2259, "record_4", "music_disc_chirp"), - new LegacyBlock(2260, "record_5", "music_disc_far"), - new LegacyBlock(2261, "record_6", "music_disc_mall"), - new LegacyBlock(2262, "record_7", "music_disc_mellohi"), - new LegacyBlock(2263, "record_8", "music_disc_stal"), - new LegacyBlock(2264, "record_9", "music_disc_strad"), - new LegacyBlock(2265, "record_10", "music_disc_ward"), - new LegacyBlock(2266, "record_11", "music_disc_11"), - new LegacyBlock(2267, "record_12", "music_disc_wait")}; - - private static final Map LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK = - new HashMap<>(); - private static final Map NEW_STRING_TO_LEGACY_PLOT_BLOCK = new HashMap<>(); - private static final Map OLD_STRING_TO_STRING_PLOT_BLOCK = new HashMap<>(); - - @SuppressWarnings("deprecation") public BukkitLegacyMappings() { - this.addAll(Arrays.asList(BLOCKS)); - // Make sure to add new blocks as well - final List missing = new ArrayList<>(); - for (final Material material : Material.values()) { - final String materialName = material.name().toLowerCase(Locale.ENGLISH); - if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.get(materialName) == null) { - try { - final LegacyBlock missingBlock = - new LegacyBlock(material.getId(), materialName, materialName); - missing.add(missingBlock); - } catch (Exception ignored) { - } - } - } - addAll(missing); - } - - private void addAll(@NonNull final Collection blocks) { - for (final LegacyBlock legacyBlock : blocks) { - LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK - .put(new IdDataPair(legacyBlock.getNumericalId(), legacyBlock.getDataValue()), - legacyBlock.toStringPlotBlock()); - NEW_STRING_TO_LEGACY_PLOT_BLOCK - .put(legacyBlock.getNewName(), legacyBlock.toLegacyPlotBlock()); - OLD_STRING_TO_STRING_PLOT_BLOCK - .put(legacyBlock.getLegacyName(), legacyBlock.toStringPlotBlock()); - Material material; - try { - material = Material.valueOf(legacyBlock.getNewName()); - } catch (final Exception e) { - try { - material = Material.getMaterial(legacyBlock.getLegacyName(), true); - } catch (NoSuchMethodError error) { - PlotSquared.log("You can't use this version of PlotSquared on a server " - + "less than Minecraft 1.13.2"); - Bukkit.shutdown(); - break; - } - } - legacyBlock.material = material; - } - } - - public Collection getPlotBlocks() { - return Arrays.stream(BLOCKS).map(block -> PlotBlock.get(block.getNewName())) - .collect(Collectors.toList()); - } - - public StringComparison.ComparisonResult getClosestsMatch( - @NonNull final String string) { - final StringComparison comparison = - new StringComparison<>(string, getPlotBlocks()); - return comparison.getBestMatchAdvanced(); - } - - /** - * Try to find a legacy plot block by any means possible. Strategy: - Check if the name contains - * a namespace, if so, strip it - Check if there's a (new) material matching the name - Check if - * there's a legacy material matching the name - Check if there's a numerical ID matching the - * name - Return null if everything else fails - * - * @param string String ID - * @return LegacyBlock if found, else null - */ - public PlotBlock fromAny(@NonNull final String string) { - if (string.isEmpty()) { - return StringPlotBlock.EVERYTHING; - } - String workingString = string; - String[] parts = null; - IdDataPair idDataPair = null; - if (string.contains(":")) { - parts = string.split(":"); - if (parts.length > 1) { - if (parts[0].equalsIgnoreCase("minecraft")) { - workingString = parts[1]; - } else { - if (parts[0].matches("^\\d+$")) { - idDataPair = - new IdDataPair(Integer.parseInt(parts[0]), Integer.parseInt(parts[0])); - } else { - workingString = parts[0]; - } - } - } - } else if (string.matches("^\\d+$")) { - idDataPair = new IdDataPair(Integer.parseInt(string), 0); - } - PlotBlock plotBlock; - if (Material.matchMaterial(workingString) != null) { - return PlotBlock.get(workingString); - } else if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.containsKey(workingString.toLowerCase())) { - return PlotBlock.get(workingString); - } else if ((plotBlock = fromLegacyToString(idDataPair)) != null) { - return plotBlock; - } else if ((plotBlock = fromLegacyToString(workingString)) != null) { - return plotBlock; - } else { - try { - if (parts != null && parts.length > 1) { - final int id = Integer.parseInt(parts[0]); - final int data = Integer.parseInt(parts[1]); - return fromLegacyToString(id, data); - } else { - return fromLegacyToString(Integer.parseInt(workingString), 0); - } - } catch (final Throwable exception) { - return null; - } - } - } - - public PlotBlock fromLegacyToString(final int id, final int data) { - return LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK.get(new IdDataPair(id, data)); - } - - public PlotBlock fromLegacyToString(IdDataPair idDataPair) { - if (idDataPair == null) { - return null; - } - return LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK.get(idDataPair); - } - - public PlotBlock fromLegacyToString(final String id) { - return OLD_STRING_TO_STRING_PLOT_BLOCK.get(id); - } - - public PlotBlock fromStringToLegacy(final String id) { - return NEW_STRING_TO_LEGACY_PLOT_BLOCK.get(id.toLowerCase(Locale.ENGLISH)); - } - - @Getter @EqualsAndHashCode @ToString @RequiredArgsConstructor - private static final class IdDataPair { - private final int id; - private final int data; - } - - - @Getter @RequiredArgsConstructor(access = AccessLevel.PRIVATE) - public static final class LegacyBlock { - - private final int numericalId; - private final int dataValue; - private final String legacyName; - private final String newName; - - private Material material; - - LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName) { - this(numericalId, dataValue, legacyName, legacyName); - } - - LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName, - @NonNull final String newName, @NonNull final String new14Name) { - this(numericalId, dataValue, legacyName, - PlotSquared.get().IMP.getServerVersion()[1] == 13 ? newName : new14Name); - } - - LegacyBlock(final int numericalId, @NonNull final String legacyName, - @NonNull final String newName, @NonNull final String new14Name) { - this(numericalId, 0, legacyName, - Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1].equals("13") ? - newName : - new14Name); - } - - LegacyBlock(final int numericalId, @NonNull final String legacyName, - @NonNull final String newName) { - this(numericalId, 0, legacyName, newName); - } - - LegacyBlock(final int numericalId, @NonNull final String legacyName) { - this(numericalId, legacyName, legacyName); - } - - PlotBlock toStringPlotBlock() { - return StringPlotBlock.get(newName); - } - - PlotBlock toLegacyPlotBlock() { - return LegacyPlotBlock.get(numericalId, dataValue); - } - - @Override public String toString() { - return this.newName; - } - } - -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java index 3f980d37c..ad2233ed2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSchematicHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index 59be5f5e7..44c2e13d5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java index 56448ff34..aaf9c787f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitTaskManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import org.bukkit.Bukkit; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index 00bc7809f..d264cdc05 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -1,15 +1,16 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -25,7 +26,6 @@ import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; import org.bukkit.block.Sign; import org.bukkit.block.data.Directional; import org.bukkit.block.data.type.WallSign; @@ -263,23 +263,11 @@ import java.util.Set; location.getPitch()); } - public static BukkitLegacyMappings getBukkitLegacyMappings() { - return (BukkitLegacyMappings) PlotSquared.imp().getLegacyMappings(); + public static Material getMaterial(@NonNull final BlockState plotBlock) { + return BukkitAdapter.adapt(plotBlock.getBlockType()); } - public static Material getMaterial(@NonNull final PlotBlock plotBlock) { - if (plotBlock instanceof StringPlotBlock) { - return Material - .getMaterial(((StringPlotBlock) plotBlock).getItemId().toUpperCase(Locale.ENGLISH)); - } else { - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock; - return getBukkitLegacyMappings() - .fromLegacyToString(legacyPlotBlock.getId(), legacyPlotBlock.getData()) - .to(Material.class); - } - } - - @Override public boolean isBlockSame(PlotBlock block1, PlotBlock block2) { + @Override public boolean isBlockSame(BlockState block1, BlockState block2) { if (block1.equals(block2)) { return true; } @@ -380,7 +368,7 @@ import java.util.Set; sign.setFacing(facing); block.setBlockData(sign, false); } - final BlockState blockstate = block.getState(); + final org.bukkit.block.BlockState blockstate = block.getState(); if (blockstate instanceof Sign) { final Sign sign = (Sign) blockstate; for (int i = 0; i < lines.length; i++) { @@ -408,13 +396,13 @@ import java.util.Set; public boolean addItems(@NonNull final String worldName, @NonNull final PlotItem items) { final World world = getWorld(worldName); final Block block = world.getBlockAt(items.x, items.y, items.z); - final BlockState state = block.getState(); + final org.bukkit.block.BlockState state = block.getState(); if (state instanceof InventoryHolder) { InventoryHolder holder = (InventoryHolder) state; Inventory inv = holder.getInventory(); for (int i = 0; i < items.types.length; i++) { // ItemStack item = new ItemStack(LegacyMappings.fromLegacyId(items.id[i]).getMaterial(), items.amount[i], items.data[i]); - ItemStack item = new ItemStack(items.types[i].to(Material.class), items.amount[i]); + ItemStack item = new ItemStack(BukkitAdapter.adapt(items.types[i]), items.amount[i]); inv.addItem(item); } state.update(true); @@ -423,33 +411,11 @@ import java.util.Set; return false; } - @Override public boolean isBlockSolid(@NonNull final PlotBlock block) { - try { - Material material = getMaterial(block); - if (material.isLegacy()) { - material = getBukkitLegacyMappings().fromLegacyToString(material.name()) - .to(Material.class); - } - if (material.isBlock() && material.isSolid() && !material.hasGravity()) { - String name = material.name().toLowerCase(Locale.ENGLISH); - if (material.isOccluding() || name.contains("stairs") || name.contains("slab") - || name.contains("wool")) { - switch (material) { - case NOTE_BLOCK: - case SPAWNER: - return false; - default: - return true; - } - } - } - return false; - } catch (Exception ignored) { - return false; - } + @Override public boolean isBlockSolid(@NonNull final BlockState block) { + return block.getBlockType().getMaterial().isSolid(); } - @Override public String getClosestMatchingName(@NonNull final PlotBlock block) { + @Override public String getClosestMatchingName(@NonNull final BlockState block) { try { return getMaterial(block).name(); } catch (Exception ignored) { @@ -458,12 +424,9 @@ import java.util.Set; } @Override @Nullable - public StringComparison.ComparisonResult getClosestBlock(String name) { - final PlotBlock plotBlock = BukkitUtil.getBukkitLegacyMappings().fromAny(name); - if (plotBlock != null) { - return new StringComparison().new ComparisonResult(1, plotBlock); - } - return BukkitUtil.getBukkitLegacyMappings().getClosestsMatch(name); + public StringComparison.ComparisonResult getClosestBlock(String name) { + BlockState state = BlockUtil.get(name); + return new StringComparison().new ComparisonResult(1, state); } @Override @@ -482,10 +445,10 @@ import java.util.Set; return new BukkitWorld(Bukkit.getWorld(world)); } - @Override public PlotBlock getBlock(@NonNull final Location location) { + @Override public BlockState getBlock(@NonNull final Location location) { final World world = getWorld(location.getWorld()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); - return PlotBlock.get(block.getType().name()); + return BlockUtil.get(block.getType().name()); } @Override public String getMainWorld() { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java index 8bfa3da59..a073aa23d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class BukkitVersion { public static int[] v1_13_2 = {1, 13, 2}; public static int[] v1_13_1 = {1, 13, 1}; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java index e3870d940..45b6568d9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/Metrics.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; @@ -48,6 +50,7 @@ public class Metrics { new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'}); final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'}); // We want to make sure nobody just copy & pastes the example and use the wrong package names + if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) { throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java index 10407f5ec..35030fa6a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/NbtFactory.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.google.common.base.Splitter; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java index a4ee94f80..7a2d53b27 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/OfflinePlayerUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Entity; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java index 8b5e89b27..0b8683cc8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java index 45814d639..17b046ec9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitAugmentedGenerator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java index e7d05eedc..687626ad0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -1,10 +1,11 @@ package com.github.intellectualsites.plotsquared.bukkit.util.block; +import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQueue; import com.sk89q.jnbt.CompoundTag; @@ -19,7 +20,6 @@ import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; -import java.util.Locale; import java.util.concurrent.ExecutionException; public class BukkitLocalQueue extends BasicLocalBlockQueue { @@ -38,13 +38,13 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { } - @Override public PlotBlock getBlock(int x, int y, int z) { + @Override public BlockState getBlock(int x, int y, int z) { World worldObj = Bukkit.getWorld(getWorld()); if (worldObj != null) { Block block = worldObj.getBlockAt(x, y, z); - return PlotBlock.get(block.getType().toString()); + return BukkitBlockUtil.get(block); } else { - return PlotBlock.get(0, 0); + return BlockUtil.get(0, 0); } } @@ -95,7 +95,7 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { BlockData blockData = BukkitAdapter.adapt(block); Block existing = chunk.getBlock(x, y, z); - if (equals(PlotBlock.get(block), existing) && existing + if (BukkitBlockUtil.get(existing).equals(block) && existing .getBlockData().matches(blockData)) { continue; } @@ -116,38 +116,13 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { }); } - private void setMaterial(@NonNull final PlotBlock plotBlock, @NonNull final Block block) { - final Material material; - if (plotBlock instanceof StringPlotBlock) { - material = Material - .getMaterial(((StringPlotBlock) plotBlock).getItemId().toUpperCase(Locale.ENGLISH)); - if (material == null) { - throw new IllegalStateException(String - .format("Could not find material that matches %s", - ((StringPlotBlock) plotBlock).getItemId())); - } - } else { - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock; - material = PlotSquared.get().IMP.getLegacyMappings() - .fromLegacyToString(legacyPlotBlock.getId(), legacyPlotBlock.getData()) - .to(Material.class); - if (material == null) { - throw new IllegalStateException(String - .format("Could not find material that matches %s", legacyPlotBlock.toString())); - } - } + 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 PlotBlock plotBlock, @NonNull final Block block) { - if (plotBlock instanceof StringPlotBlock) { - return ((StringPlotBlock) plotBlock).idEquals(block.getType().name()); - } - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock; - return Material.getMaterial(PlotSquared.get().IMP.getLegacyMappings() - .fromLegacyToString(((LegacyPlotBlock) plotBlock).id, - ((LegacyPlotBlock) plotBlock).data).toString()) == block.getType() && ( - legacyPlotBlock.id == 0 || legacyPlotBlock.data == block.getData()); + private boolean equals(@NonNull final BlockState plotBlock, @NonNull final Block block) { + return plotBlock.equals(BukkitBlockUtil.get(block)); } public void setBiomes(LocalChunk lc) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index fc2bc3574..41d04222c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -1,9 +1,12 @@ package com.github.intellectualsites.plotsquared.bukkit.util.block; +import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -22,7 +25,7 @@ import java.util.Arrays; public class GenChunk extends ScopedLocalBlockQueue { public final Biome[] biomes; - public PlotBlock[][] result; + public BlockState[][] result; public BiomeGrid biomeGrid; public Chunk chunk; public String world; @@ -68,14 +71,14 @@ public class GenChunk extends ScopedLocalBlockQueue { } } - @Override public void setCuboid(Location pos1, Location pos2, PlotBlock block) { + @Override public void setCuboid(Location pos1, Location pos2, BlockState block) { if (result != null && pos1.getX() == 0 && pos1.getZ() == 0 && pos2.getX() == 15 && pos2.getZ() == 15) { for (int y = pos1.getY(); y <= pos2.getY(); y++) { int layer = y >> 4; - PlotBlock[] data = result[layer]; + BlockState[] data = result[layer]; if (data == null) { - result[layer] = data = new PlotBlock[4096]; + result[layer] = data = new BlockState[4096]; } int start = y << 8; int end = start + 256; @@ -88,8 +91,7 @@ public class GenChunk extends ScopedLocalBlockQueue { int maxX = Math.max(pos1.getX(), pos2.getX()); int maxY = Math.max(pos1.getY(), pos2.getY()); int maxZ = Math.max(pos1.getZ(), pos2.getZ()); - chunkData - .setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class)); + chunkData.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block)); } @Override public boolean setBiome(int x, int z, String biome) { @@ -104,21 +106,21 @@ public class GenChunk extends ScopedLocalBlockQueue { return false; } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (this.result == null) { - this.chunkData.setBlock(x, y, z, id.to(Material.class)); + this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); return true; } - this.chunkData.setBlock(x, y, z, id.to(Material.class)); + this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); this.storeCache(x, y, z, id); return true; } - private void storeCache(final int x, final int y, final int z, final PlotBlock id) { + private void storeCache(final int x, final int y, final int z, final BlockState id) { int i = MainUtil.CACHE_I[y][x][z]; - PlotBlock[] v = this.result[i]; + BlockState[] v = this.result[i]; if (v == null) { - this.result[i] = v = new PlotBlock[4096]; + this.result[i] = v = new BlockState[4096]; } int j = MainUtil.CACHE_J[y][x][z]; v[j] = id; @@ -130,18 +132,18 @@ public class GenChunk extends ScopedLocalBlockQueue { return true; } this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id)); - this.storeCache(x, y, z, PlotBlock.get(id.getBlockType().getId())); + this.storeCache(x, y, z, BlockUtil.get(id.getBlockType().getId())); return true; } - @Override public PlotBlock getBlock(int x, int y, int z) { + @Override public BlockState getBlock(int x, int y, int z) { int i = MainUtil.CACHE_I[y][x][z]; if (result == null) { - return PlotBlock.get(chunkData.getType(x, y, z)); + return BukkitBlockUtil.get(chunkData.getType(x, y, z)); } - PlotBlock[] array = result[i]; + BlockState[] array = result[i]; if (array == null) { - return PlotBlock.get(""); + return BlockUtil.get(""); } int j = MainUtil.CACHE_J[y][x][z]; return array[j]; @@ -171,9 +173,9 @@ public class GenChunk extends ScopedLocalBlockQueue { GenChunk toReturn = new GenChunk(); if (this.result != null) { for (int i = 0; i < this.result.length; i++) { - PlotBlock[] matrix = this.result[i]; + BlockState[] matrix = this.result[i]; if (matrix != null) { - toReturn.result[i] = new PlotBlock[matrix.length]; + toReturn.result[i] = new BlockState[matrix.length]; System.arraycopy(matrix, 0, toReturn.result[i], 0, matrix.length); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java index 2fb0892a7..2be775fb3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DatFileFilter.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.File; import java.io.FilenameFilter; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java index 40d902f8e..04cdea922 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 440aca318..351668cb5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java index 3f33387b9..41129644e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.google.common.base.Charsets; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java index 306f67e4e..74f067cc9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 4c74be5b6..434bd8760 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index 610362953..adb7235cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.api; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java index 7ae1985ce..f50397294 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Argument.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotId; public abstract class Argument { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java index 691daa93e..6472310fd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java index 3b5ee295e..eca768ecc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandCaller.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; public interface CommandCaller { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java index 851a03174..6377796fc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/CommandDeclaration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java index c2b4b4d95..be132d9d3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/Configuration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java index 81c96196d..808f942c9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Various settings for controlling the input and output of a {@link * Configuration}. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java index 0752dfb57..6579332c8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/ConfigurationSection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.List; import java.util.Map; import java.util.Set; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java index e9c099ed1..81377a83e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/InvalidConfigurationException.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Exception thrown when attempting to load an invalid {@link Configuration}. */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java index 20131cbe1..0dbb112a6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfiguration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java index 22f9d751b..89b99ffb3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemoryConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Various settings for controlling the input and output of a {@link * MemoryConfiguration}. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java index 14233b758..68ef0f660 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/MemorySection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedHashSet; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java index e8123cfc9..686347a17 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfiguration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java index 6eb99bb6e..fe1e19ce2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/FileConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration; import com.github.intellectualsites.plotsquared.configuration.MemoryConfigurationOptions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java index d8c41c3da..7388ecd53 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java index a7e71cdaf..b0dfae09d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfigurationOptions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * Various settings for controlling the input and output of a {@link * YamlConfiguration}. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java index 1f52f7abb..b0e288250 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConstructor.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization; import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.error.YAMLException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java index ebe1aebee..99263c761 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlRepresenter.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java index f83e7a468..415f162d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerializable.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java index cb1abd54a..9f0374354 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/ConfigurationSerialization.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.Configuration; import java.lang.reflect.Constructor; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java index 8a071cb2e..7267d5c2d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/DelegateDeserialization.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java index 79b50998c..c88a9c277 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/serialization/SerializableAs.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.configuration.serialization; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java index 62ee01329..cb4d5f99f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONArray.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.IOException; import java.io.StringWriter; import java.io.Writer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java index 67de10815..690dd78b2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONException.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * The JSONException is thrown by the JSON.org classes when things are amiss. * diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java index 965e95644..dc4d37bac 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.IOException; import java.io.StringWriter; import java.io.Writer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java index 019776e58..116091822 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONString.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * The JSONString interface allows a toJSONString() method so that a class can change the * behavior of JSONObject.toString(), JSONArray.toString(), and diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java index 195ceeb5d..673202d3b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONTokener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java index 7ace1989b..50faeb1c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/Property.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Enumeration; import java.util.Iterator; import java.util.Properties; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java index 51a0cdb10..65ce81e65 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XML.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Iterator; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java index 96d65541f..84ee565f4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/XMLTokener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.json; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.HashMap; /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java index fb62a61ce..77f36bb41 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java @@ -4,14 +4,12 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.logger.ILogger; -import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.ChatManager; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; -import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; @@ -89,8 +87,12 @@ public interface IPlotMain extends ILogger { /** * Gets the NMS package prefix. + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; * * @return The NMS package prefix + +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; */ String getNMSPackage(); @@ -246,9 +248,4 @@ public interface IPlotMain extends ILogger { @NotNull IndependentPlotGenerator getDefaultGenerator(); List getPluginIds(); - - BlockRegistry getBlockRegistry(); - - LegacyMappings getLegacyMappings(); - } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java index 1736edf6f..0278e90b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Platform.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum Platform { Bukkit, Sponge, Spigot, Paper diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index d6c7b437c..88c9009a8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; @@ -24,7 +26,7 @@ import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotCluster; import com.github.intellectualsites.plotsquared.plot.object.PlotFilter; import com.github.intellectualsites.plotsquared.plot.object.PlotId; @@ -154,7 +156,7 @@ import java.util.zip.ZipInputStream; // // Register configuration serializable classes // - ConfigurationSerialization.registerClass(PlotBlock.class, "PlotBlock"); +// ConfigurationSerialization.registerClass(BlockState.class, "BlockState"); ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket"); try { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java index 4646a787a..13cd48798 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class PlotVersion { public final int year, month, day, hash, build; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index d92dd4ea3..c51dbb1e7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 401446243..8250c4d20 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java index 0f39ebe94..a01145e72 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java index bf0a221b8..45a6fae1c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index 8b9ecb790..1a18c5150 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java index dbfd37768..343c7d96b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java index c2a3daf84..b8fca9445 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java index aba59ad05..a691ff4b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index 9dcd475a1..fe3a45a8c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java index 088273c9c..d0bc4127f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java index 3958f2d39..fc910e50a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import lombok.RequiredArgsConstructor; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index 171a5bfe5..4ddd2b302 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index a9341f373..c00065f20 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java index 75a4709b8..4d9473387 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java index 961742c1b..9261ef796 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index de77513bc..9ca4816f9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 14fa6347e..52d00568d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index abbddc9ca..13e957a08 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index c1970f969..fe86acaaa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java index 8413eae22..f827a5ffa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java index 411a3290b..7876177b5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java index 6d5894616..82dc57b24 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -15,7 +17,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -124,7 +126,7 @@ import java.util.concurrent.CompletableFuture; // Classes this.scope.put("Location", Location.class); - this.scope.put("PlotBlock", PlotBlock.class); + this.scope.put("BlockState", BlockState.class); this.scope.put("Plot", Plot.class); this.scope.put("PlotId", PlotId.class); this.scope.put("Runnable", Runnable.class); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java index ca848a6bb..946abaf82 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index 978c95e34..1d72d34a6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java index f12ce8d1e..adfd640b9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 9ea6d7bdd..522f11b8f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index a268f8903..33559079c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java index 0c544d096..698e7099a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index 72c6da126..adf8491e5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 5ddfde305..dc9dec874 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java index d3b261ba8..2ef572d73 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java index 372231481..315a9fea8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java index 055cfabd9..282ab8331 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java index 776cff0f8..fbbffdf2d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index 746ddfe98..a0d1598b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -10,10 +12,10 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.IntegerFlag; import com.github.intellectualsites.plotsquared.plot.flag.ListFlag; -import com.github.intellectualsites.plotsquared.plot.flag.PlotBlockListFlag; +import com.github.intellectualsites.plotsquared.plot.flag.BlockStateListFlag; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -21,6 +23,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.sk89q.worldedit.world.block.BlockType; import java.util.ArrayList; import java.util.Arrays; @@ -32,6 +35,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; @CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setflag"}, usage = "/plot flag ", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") @@ -61,12 +65,12 @@ public class FlagCmd extends SubCommand { } catch (NumberFormatException ignore) { } - } else if (flag instanceof PlotBlockListFlag) { - final PlotBlockListFlag blockListFlag = (PlotBlockListFlag) flag; - final HashSet parsedBlocks = blockListFlag.parseValue(value); - for (final PlotBlock block : parsedBlocks) { + } else if (flag instanceof BlockStateListFlag) { + final BlockStateListFlag blockListFlag = (BlockStateListFlag) flag; + Set parsedBlocks = blockListFlag.parseValue(value); + for (final BlockType block : parsedBlocks) { final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE - .f(key.toLowerCase(), block.getRawId().toString().toLowerCase()); + .f(key.toLowerCase(), block.toString().toLowerCase()); final boolean result = Permissions.hasPermission(player, permission); if (!result) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java index 7a1d2cddc..92cb8da1a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index 60ecbeab0..289badf46 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 7949df513..5ffd80e45 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 030ef0f44..9cbdde212 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index fe42e5dd4..5182f86d4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index eb36f8e67..5899da372 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index b51993326..a07330424 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java index 378da26c2..30e84f3bd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java index 2b70e48e5..537e4bd1a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java index 4b0305969..65fc58fc3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java index dd060c88e..4ebb48b83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index 43204b266..c8d9ae379 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java index f3acaf5a0..3a9bd453c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 02c7494cb..4026bb1e3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index a763a3c51..fb077e811 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -8,6 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.sk89q.worldedit.world.item.ItemTypes; import java.util.Arrays; import java.util.Collection; @@ -39,11 +42,11 @@ import java.util.Locale; if (item == null) { return true; } - if (item.getPlotBlock().equalsAny(7, "bedrock")) { + if (item.getType() == ItemTypes.BEDROCK) { plot.removeFlag(Flags.MUSIC); Captions.FLAG_REMOVED.send(player); } else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) { - plot.setFlag(Flags.MUSIC, item.getPlotBlock().getRawId()); + plot.setFlag(Flags.MUSIC, item); Captions.FLAG_ADDED.send(player); } else { Captions.FLAG_NOT_ADDED.send(player); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java index d897fb3cf..25e83c4bd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 55dbdbda4..daa0ae30e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index 8e31051fb..f0b0b0fa4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.json.JSONObject; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java index 0825b9610..99d104071 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java index f81f02719..884c23f16 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java index e47cb610f..76a641095 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java index cc5c8c21a..a84ee8584 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java index db900e91e..777ea37d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.MemorySection; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index 038355d83..147405038 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java index 2dc75f919..5329ae2e2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RequiredType.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; public enum RequiredType { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java index d000f55e2..a348bf461 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index 130f2ad1d..d389924f4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index 582dfb38a..ae25ccaa5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -10,7 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -60,7 +62,7 @@ import java.util.stream.IntStream; Captions.PERMISSION_SET_COMPONENT.f(component)); return false; } - // PlotBlock[] blocks; + // BlockState[] blocks; BlockBucket bucket; try { if (args.length < 2) { @@ -73,7 +75,7 @@ import java.util.stream.IntStream; } catch (final UnknownBlockException unknownBlockException) { final String unknownBlock = unknownBlockException.getUnknownValue(); Captions.NOT_VALID_BLOCK.send(player, unknownBlock); - StringComparison.ComparisonResult match = + StringComparison.ComparisonResult match = WorldUtil.IMP.getClosestBlock(unknownBlock); if (match != null) { final String found = @@ -87,8 +89,8 @@ import java.util.stream.IntStream; } if (!allowUnsafe) { - for (final PlotBlock block : bucket.getBlocks()) { - if (!block.isAir() && !WorldUtil.IMP.isBlockSolid(block)) { + for (final BlockState block : bucket.getBlocks()) { + if (!block.getBlockType().getMaterial().isAir() && !WorldUtil.IMP.isBlockSolid(block)) { Captions.NOT_ALLOWED_BLOCK.send(player, block.toString()); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index 8b746c624..d4b12fa7a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index 4b742ad94..3359fe060 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java index 82190f1b2..4ea9f7411 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java index 458442ff2..7c58f0f3d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index b3ec2ff05..2a9f0529e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java index 4dd37bdb0..03a3cf3d3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java index 85a0fe633..14385ff1d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index 87411f1c6..8ae7c5e40 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java index 000aa9b56..4f1740821 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trim.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java index c0cd3309e..d357ed435 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Trust.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java index 66682ccda..8e4bd39b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Unlink.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java index e2b7fa382..0f5c5f45b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java index 36744cc44..add8d4540 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/WE_Anywhere.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index c319303b6..3a7613dd1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java index 7234743cf..177715d39 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Config.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index 3d636e0dd..ea2f6f538 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -1,7 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import lombok.Getter; @@ -76,11 +78,11 @@ public class Configuration { } else { block = part; } - final StringComparison.ComparisonResult value = + final StringComparison.ComparisonResult value = WorldUtil.IMP.getClosestBlock(block); if (value == null) { throw new UnknownBlockException(block); - } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.isAir() + } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.getBlockType().getMaterial().isAir() && !WorldUtil.IMP.isBlockSolid(value.best)) { throw new UnsafeBlockException(value.best); } @@ -110,11 +112,11 @@ public class Configuration { } else { block = part; } - StringComparison.ComparisonResult value = + StringComparison.ComparisonResult value = WorldUtil.IMP.getClosestBlock(block); if (value == null || value.match > 1) { return false; - } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.isAir() + } else if (Settings.Enabled_Components.PREVENT_UNSAFE && !value.best.getBlockType().getMaterial().isAir() && !WorldUtil.IMP.isBlockSolid(value.best)) { throw new UnsafeBlockException(value.best); } @@ -162,9 +164,9 @@ public class Configuration { public static final class UnsafeBlockException extends IllegalArgumentException { - @Getter private final PlotBlock unsafeBlock; + @Getter private final BlockState unsafeBlock; - UnsafeBlockException(@NonNull final PlotBlock 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/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java index 31539d5c2..05127f68d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/ConfigurationNode.java @@ -1,7 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.ArrayList; @@ -66,7 +68,7 @@ public class ConfigurationNode { if (this.value instanceof BlockBucket) { return this.value.toString(); } - if (this.value instanceof PlotBlock) { + if (this.value instanceof BlockState) { return this.value.toString(); } return this.value; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index b1e239c78..8b2e4398d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java index 962e0468f..59385e623 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Storage.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.config; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.File; import java.util.ArrayList; import java.util.Collections; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java index 5beef2aab..81565c4e2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java index 47a03cf60..38fc283b7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/DBFunc.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java index 4acecc01f..1126a7d83 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/Database.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java index f8b2cedb0..1a27ff618 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/MySQL.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Storage; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java index a62924e9e..55cb57b57 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java index 10ceb8784..2bb1d3dd5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLite.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import java.io.File; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java index 837d3a66a..a390960c3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/StmtMod.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.sql.PreparedStatement; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java new file mode 100644 index 000000000..ee80b560e --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BlockStateListFlag.java @@ -0,0 +1,40 @@ +package com.github.intellectualsites.plotsquared.plot.flag; + +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.github.intellectualsites.plotsquared.plot.config.Captions; +import com.sk89q.worldedit.world.block.BlockState; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.sk89q.worldedit.world.block.BlockType; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class BlockStateListFlag extends ListFlag> { + + public BlockStateListFlag(String name) { + super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); + } + + @Override public String valueToString(Object value) { + return StringMan.join((Set) value, ","); + } + + @Override public Set parseValue(final String value) { + return Arrays.stream(BlockUtil.parse(value)).map(BlockState::getBlockType).collect(Collectors.toSet()); + } + + @Override public String getValueDescription() { + return "Flag value must be a block list"; + } + + public boolean contains(Plot plot, BlockState value) { + return contains(plot, value.getBlockType()); + } +} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java index 841df766c..a44168e73 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/BooleanFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java index 8cc665471..505f5cab6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/DoubleFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; public class DoubleFlag extends Flag { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java index 88119bbaa..c86299a22 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/EnumFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java index 21047d9cd..03269827e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.util.StringComparison; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java index 51391f788..4a4a7d64a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index b21d6fb25..a84d041bc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -58,9 +60,9 @@ public final class Flags { public static final BooleanFlag BLOCK_IGNITION = new BooleanFlag("block-ignition"); public static final BooleanFlag SOIL_DRY = new BooleanFlag("soil-dry"); public static final StringListFlag BLOCKED_CMDS = new StringListFlag("blocked-cmds"); - public static final PlotBlockListFlag USE = new PlotBlockListFlag("use"); - public static final PlotBlockListFlag BREAK = new PlotBlockListFlag("break"); - public static final PlotBlockListFlag PLACE = new PlotBlockListFlag("place"); + public static final BlockStateListFlag USE = new BlockStateListFlag("use"); + public static final BlockStateListFlag BREAK = new BlockStateListFlag("break"); + public static final BlockStateListFlag PLACE = new BlockStateListFlag("place"); public static final BooleanFlag DEVICE_INTERACT = new BooleanFlag("device-interact"); public static final BooleanFlag VEHICLE_BREAK = new BooleanFlag("vehicle-break"); public static final BooleanFlag VEHICLE_PLACE = new BooleanFlag("vehicle-place"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java index 26510b35b..b67ae58ba 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/GameModeFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java index ced532cd1..2a83fbac7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java index 1f24cb4a3..55260ec6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntegerListFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java index 0468c59b2..af2b1345c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/IntervalFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java index 3085288b1..7f1fd1aff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/ListFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java index 8d57e8865..b5ad2fca2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/LongFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; public class LongFlag extends Flag { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java deleted file mode 100644 index d042ecb4d..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotBlockListFlag.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.flag; - -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; -import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings; -import com.github.intellectualsites.plotsquared.plot.util.StringMan; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Objects; -import java.util.stream.Collectors; - -public class PlotBlockListFlag extends ListFlag> { - - public PlotBlockListFlag(String name) { - super(Captions.FLAG_CATEGORY_BLOCK_LIST, name); - } - - @Override public String valueToString(Object value) { - return StringMan.join((HashSet) value, ","); - } - - @Override public HashSet parseValue(final String value) { - final LegacyMappings legacyMappings = PlotSquared.get().IMP.getLegacyMappings(); - return Arrays.stream(value.split(",")).map(legacyMappings::fromAny).filter(Objects::nonNull) - .collect(Collectors.toCollection(HashSet::new)); - } - - @Override public String getValueDescription() { - return "Flag value must be a block list"; - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java index 43544748f..beb3e8836 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/PlotWeatherFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java index 31447847c..504b04a40 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; public class StringFlag extends Flag { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java index a1e28aa3d..9717de1d9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/StringListFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java index 6c02516fd..9dfa64dc5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/TeleportDenyFlag.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.flag; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java index 2a85581ad..1e2d1df5f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/AugmentedUtils.java @@ -1,16 +1,19 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; -import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; +import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.NotNull; import java.util.Set; @@ -64,7 +67,7 @@ public class AugmentedUtils { txx = Math.min(15, area.getRegion().maxX - blockX); tzz = Math.min(15, area.getRegion().maxZ - blockZ); primaryMask = new DelegateLocalBlockQueue(queue) { - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (area.contains(x, z)) { return super.setBlock(x, y, z, id); } @@ -84,7 +87,7 @@ public class AugmentedUtils { primaryMask = queue; } LocalBlockQueue secondaryMask; - PlotBlock air = StringPlotBlock.EVERYTHING; + BlockState air = BlockTypes.AIR.getDefaultState(); if (area.TERRAIN == 2) { PlotManager manager = area.getPlotManager(); final boolean[][] canPlace = new boolean[16][16]; @@ -108,7 +111,7 @@ public class AugmentedUtils { } toReturn = true; secondaryMask = new DelegateLocalBlockQueue(primaryMask) { - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { if (canPlace[x - blockX][z - blockZ]) { return super.setBlock(x, y, z, id); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java index a15b9ab1b..293303bcf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotManager.java @@ -1,11 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Direction; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -284,9 +286,9 @@ public class ClassicPlotManager extends SquarePlotManager { queue.setCuboid( new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz + 1), new Location(classicPlotWorld.worldname, ex, maxY, ez - 1), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 0, sz + 1), - new Location(classicPlotWorld.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0)); + new Location(classicPlotWorld.worldname, ex, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT, ez - 1), classicPlotWorld.WALL_FILLING); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1), @@ -312,9 +314,9 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx + 1, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), - ez), PlotBlock.get((short) 0, (byte) 0)); + ez), BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz), - new Location(classicPlotWorld.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0)); + new Location(classicPlotWorld.worldname, ex - 1, 0, ez), BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT, sz), classicPlotWorld.WALL_FILLING); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz), @@ -337,10 +339,10 @@ public class ClassicPlotManager extends SquarePlotManager { LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.ROAD_HEIGHT + 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez - 1), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, 0, ez - 1), - PlotBlock.get((short) 7, (byte) 0)); + BlockUtil.get((short) 7, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); return queue.enqueue(); @@ -358,7 +360,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), @@ -378,7 +380,7 @@ public class ClassicPlotManager extends SquarePlotManager { new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz), new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), @@ -395,7 +397,7 @@ public class ClassicPlotManager extends SquarePlotManager { LocalBlockQueue queue = classicPlotWorld.getQueue(false); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT + 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), - PlotBlock.get((short) 0, (byte) 0)); + BlockUtil.get((short) 0, (byte) 0)); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz), new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java index ec80b3b84..7048ee8cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java @@ -1,12 +1,14 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.jetbrains.annotations.NotNull; @@ -18,18 +20,18 @@ import java.util.Locale; public int ROAD_HEIGHT = 62; public int PLOT_HEIGHT = 62; public int WALL_HEIGHT = 62; - public BlockBucket MAIN_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone")); - // new PlotBlock[] {PlotBlock.get("stone")}; - public BlockBucket TOP_BLOCK = BlockBucket.withSingle(PlotBlock.get("grass_block")); - //new PlotBlock[] {PlotBlock.get("grass")}; - public BlockBucket WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone_slab")); - // PlotBlock.get((short) 44, (byte) 0); - public BlockBucket CLAIMED_WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("sandstone_slab")); - // PlotBlock.get((short) 44, (byte) 1); - public BlockBucket WALL_FILLING = BlockBucket.withSingle(PlotBlock.get("stone")); - //PlotBlock.get((short) 1, (byte) 0); - public BlockBucket ROAD_BLOCK = BlockBucket.withSingle(PlotBlock.get("quartz_block")); - // PlotBlock.get((short) 155, (byte) 0); + public BlockBucket MAIN_BLOCK = BlockBucket.withSingle(BlockUtil.get("stone")); + // new BlockState[] {BlockUtil.get("stone")}; + public BlockBucket TOP_BLOCK = BlockBucket.withSingle(BlockUtil.get("grass_block")); + //new BlockState[] {BlockUtil.get("grass")}; + public BlockBucket WALL_BLOCK = BlockBucket.withSingle(BlockUtil.get("stone_slab")); + // BlockUtil.get((short) 44, (byte) 0); + public BlockBucket CLAIMED_WALL_BLOCK = BlockBucket.withSingle(BlockUtil.get("sandstone_slab")); + // BlockUtil.get((short) 44, (byte) 1); + public BlockBucket WALL_FILLING = BlockBucket.withSingle(BlockUtil.get("stone")); + //BlockUtil.get((short) 1, (byte) 0); + public BlockBucket ROAD_BLOCK = BlockBucket.withSingle(BlockUtil.get("quartz_block")); + // BlockUtil.get((short) 155, (byte) 0); public boolean PLOT_BEDROCK = true; public ClassicPlotWorld(String worldName, String id, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java index ec5f971fc..ffe895f8b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GeneratorWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; public interface GeneratorWrapper { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java index a0ed41226..2590fd181 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java index b0cc10323..d91d22f94 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/GridPlotWorld.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java index 6cb57ba8f..29b1ee67d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java @@ -1,11 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; @@ -43,7 +45,7 @@ public class HybridGen extends IndependentPlotGenerator { for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { blockBuckets[0][(z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("bedrock")); + BlockBucket.withSingle(BlockUtil.get("bedrock")); } } } @@ -74,7 +76,7 @@ public class HybridGen extends IndependentPlotGenerator { if (hpw.PLOT_BEDROCK) { for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { - result.setBlock(x, 0, z, PlotBlock.get("bedrock")); + result.setBlock(x, 0, z, BlockUtil.get("bedrock")); } } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java index 528ad57f9..17129cc29 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -7,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.FileBytes; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -174,13 +176,13 @@ public class HybridPlotManager extends ClassicPlotManager { // The component blocks final BlockBucket plotfloor = hybridPlotWorld.TOP_BLOCK; final BlockBucket filling = hybridPlotWorld.MAIN_BLOCK; - final PlotBlock bedrock; + final BlockState bedrock; if (hybridPlotWorld.PLOT_BEDROCK) { - bedrock = PlotBlock.get((short) 7, (byte) 0); + bedrock = BlockUtil.get((short) 7, (byte) 0); } else { - bedrock = PlotBlock.get((short) 0, (byte) 0); + bedrock = BlockUtil.get((short) 0, (byte) 0); } - final PlotBlock air = PlotBlock.get((short) 0, (byte) 0); + final BlockState air = BlockUtil.get((short) 0, (byte) 0); final String biome = hybridPlotWorld.PLOT_BIOME; final LocalBlockQueue queue = hybridPlotWorld.getQueue(false); ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index 2f8c7c823..c53e1c9b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; @@ -14,7 +16,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTagBuilder; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.transform.BlockTransformExtent; import com.sk89q.worldedit.internal.helper.MCDirections; import com.sk89q.worldedit.math.BlockVector3; @@ -178,7 +180,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { if (schematic3 != null) { this.PLOT_SCHEMATIC = true; - BlockArrayClipboard blockArrayClipboard3 = schematic3.getClipboard(); + Clipboard blockArrayClipboard3 = schematic3.getClipboard(); BlockVector3 d3 = blockArrayClipboard3.getDimensions(); short w3 = (short) d3.getX(); @@ -252,9 +254,9 @@ public class HybridPlotWorld extends ClassicPlotWorld { } this.ROAD_SCHEMATIC_ENABLED = true; // Do not populate road if using schematic population - // TODO: What? this.ROAD_BLOCK = BlockBucket.empty(); // PlotBlock.getEmptyData(this.ROAD_BLOCK); // PlotBlock.get(this.ROAD_BLOCK.id, (byte) 0); + // TODO: What? this.ROAD_BLOCK = BlockBucket.empty(); // BlockState.getEmptyData(this.ROAD_BLOCK); // BlockUtil.get(this.ROAD_BLOCK.id, (byte) 0); - BlockArrayClipboard blockArrayClipboard1 = schematic1.getClipboard(); + Clipboard blockArrayClipboard1 = schematic1.getClipboard(); BlockVector3 d1 = blockArrayClipboard1.getDimensions(); short w1 = (short) d1.getX(); @@ -277,7 +279,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { } } - BlockArrayClipboard blockArrayClipboard2 = schematic2.getClipboard(); + Clipboard blockArrayClipboard2 = schematic2.getClipboard(); BlockVector3 d2 = blockArrayClipboard2.getDimensions(); short w2 = (short) d2.getX(); short l2 = (short) d2.getZ(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java index 9e09ea977..a638059a1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; @@ -8,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; @@ -111,12 +113,12 @@ public abstract class HybridUtils { } public int checkModified(LocalBlockQueue queue, int x1, int x2, int y1, int y2, int z1, int z2, - PlotBlock[] blocks) { + BlockState[] blocks) { int count = 0; for (int y = y1; y <= y2; y++) { for (int x = x1; x <= x2; x++) { for (int z = z1; z <= z2; z++) { - PlotBlock block = queue.getBlock(x, y, z); + BlockState block = queue.getBlock(x, y, z); boolean same = Arrays.stream(blocks).anyMatch(p -> WorldUtil.IMP.isBlockSame(block, p)); if (!same) { @@ -307,8 +309,8 @@ public abstract class HybridUtils { for (int z = sz; z <= ez; z++) { for (int y = sy; y <= pm.getWorldHeight(); y++) { if (y > ey) { - PlotBlock block = queue.getBlock(x, y, z); - if (!block.isAir()) { + BlockState block = queue.getBlock(x, y, z); + if (!block.getBlockType().getMaterial().isAir()) { ey = y; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java index def532368..bda8a6ccb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/IndependentPlotGenerator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java index 88c7f2557..0880a9e8b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/PlotGenerator.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java index 8ee343b3f..cc3f292cb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Direction; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java index c2d1ddb31..6ed48568d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/SquarePlotWorld.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotId; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java index 5d0c86858..adfaf450d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ExtentWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java index 815f5ea43..177b92699 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlayerBlockEventType.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum PlayerBlockEventType { // Non interactive EAT, READ, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java index 7aee40de0..ec6051199 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flag; @@ -8,7 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.block.ItemUtil; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities; @@ -22,6 +25,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import java.util.HashMap; import java.util.Map; @@ -144,21 +149,21 @@ public class PlotListener { Optional musicFlag = plot.getFlag(Flags.MUSIC); if (musicFlag.isPresent()) { final String id = musicFlag.get(); - final PlotBlock block = PlotBlock.get(id); - final String rawId = block.getRawId().toString(); - if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) { + final ItemType item = ItemUtil.get(id); + final String rawId = item.getId(); + if (rawId.contains("disc") || item == ItemTypes.AIR) { Location location = player.getLocation(); Location lastLocation = player.getMeta("music"); if (lastLocation != null) { - player.playMusic(lastLocation, PlotBlock.get("air")); - if (PlotBlock.isEverything(block) || block.isAir()) { + player.playMusic(lastLocation, ItemTypes.AIR); + if (item == ItemTypes.AIR) { player.deleteMeta("music"); } } - if (!(PlotBlock.isEverything(block) || block.isAir())) { + if (!(item == ItemTypes.AIR)) { try { player.setMeta("music", location); - player.playMusic(location, block); + player.playMusic(location, item); } catch (Exception ignored) { } } @@ -167,7 +172,7 @@ public class PlotListener { Location lastLoc = player.getMeta("music"); if (lastLoc != null) { player.deleteMeta("music"); - player.playMusic(lastLoc, PlotBlock.get("air")); + player.playMusic(lastLoc, ItemTypes.AIR); } } CommentManager.sendTitle(player, plot); @@ -275,7 +280,7 @@ public class PlotListener { Location lastLoc = player.getMeta("music"); if (lastLoc != null) { player.deleteMeta("music"); - player.playMusic(lastLoc, PlotBlock.get("air")); + player.playMusic(lastLoc, ItemTypes.AIR); } } return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java index 7d2d824b4..8818ed437 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/ProcessedWEExtent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java index 073819fa3..39d30935b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java index 3692efa51..c562f4f9a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java index 78379fd9e..5f9cac7fc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WESubscriber.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.listener; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java index ed925a135..ca9b988bb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/DelegateLogger.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.logger; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class DelegateLogger implements ILogger { private final ILogger parent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java index 16fb343bf..050f2a365 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/logger/ILogger.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.logger; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public interface ILogger { void log(String message); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java index bd15eddf9..b0ddc9d06 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java @@ -1,9 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.object.collection.RandomCollection; import com.google.common.collect.ImmutableMap; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; @@ -24,23 +28,23 @@ import java.util.Random; * has a specified chance of being randomly picked */ @EqualsAndHashCode @SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket - implements Iterable, ConfigurationSerializable { + implements Iterable, ConfigurationSerializable { private final Random random = new Random(); - private final Map blocks; + private final Map blocks; private final BucketIterator bucketIterator = new BucketIterator(); private boolean compiled, singleItem; - private PlotBlock head; + private BlockState head; - private RandomCollection randomBlocks; - private PlotBlock single; + private RandomCollection randomBlocks; + private BlockState single; public BlockBucket() { this.blocks = new HashMap<>(); } - public static BlockBucket withSingle(@NonNull final PlotBlock block) { + public static BlockBucket withSingle(@NonNull final BlockState block) { final BlockBucket blockBucket = new BlockBucket(); blockBucket.addBlock(block, 100); return blockBucket; @@ -53,15 +57,15 @@ import java.util.Random; return Configuration.BLOCK_BUCKET.parseString(map.get("blocks").toString()); } - public void addBlock(@NonNull final PlotBlock block) { + public void addBlock(@NonNull final BlockState block) { this.addBlock(block, -1); } - public void addBlock(@NonNull final PlotBlock block, final int chance) { + public void addBlock(@NonNull final BlockState block, final int chance) { addBlock(block, (double) chance); } - private void addBlock(@NonNull final PlotBlock block, double chance) { + private void addBlock(@NonNull final BlockState block, double chance) { if (chance == -1) chance = 1; this.blocks.put(block, chance); @@ -81,7 +85,7 @@ import java.util.Random; * @return Immutable collection containing all blocks that can * be found in the bucket */ - public Collection getBlocks() { + public Collection getBlocks() { if (!isCompiled()) { this.compile(); } @@ -94,7 +98,7 @@ import java.util.Random; * @param count Number of blocks * @return Immutable collection containing randomly selected blocks */ - public Collection getBlocks(final int count) { + public Collection getBlocks(final int count) { return Arrays.asList(getBlockArray(count)); } @@ -104,8 +108,8 @@ import java.util.Random; * @param count Number of blocks * @return Immutable collection containing randomly selected blocks */ - public PlotBlock[] getBlockArray(final int count) { - final PlotBlock[] blocks = new PlotBlock[count]; + public BlockState[] getBlockArray(final int count) { + final BlockState[] blocks = new BlockState[count]; if (this.singleItem) { Arrays.fill(blocks, 0, count, getBlock()); } else { @@ -142,7 +146,7 @@ import java.util.Random; } } - @NotNull @Override public Iterator iterator() { + @NotNull @Override public Iterator iterator() { return this.bucketIterator; } @@ -155,7 +159,7 @@ import java.util.Random; * * @return Randomly picked block (cased on specified rates) */ - public PlotBlock getBlock() { + public BlockState getBlock() { if (!isCompiled()) { this.compile(); } @@ -165,19 +169,22 @@ import java.util.Random; if (randomBlocks != null) { return randomBlocks.next(); } - return StringPlotBlock.EVERYTHING; + return BlockTypes.AIR.getDefaultState(); } @Override public String toString() { if (!isCompiled()) { compile(); } + if (blocks.size() == 1) { + return blocks.entrySet().iterator().next().getKey().toString(); + } final StringBuilder builder = new StringBuilder(); - Iterator> iterator = blocks.entrySet().iterator(); + Iterator> iterator = blocks.entrySet().iterator(); while (iterator.hasNext()) { - Entry entry = iterator.next(); - PlotBlock block = entry.getKey(); - builder.append(block.getRawId()); + Entry entry = iterator.next(); + BlockState block = entry.getKey(); + builder.append(block); Double weight = entry.getValue(); if (weight != 1) { builder.append(":").append(weight.intValue()); @@ -213,13 +220,13 @@ import java.util.Random; } - private final class BucketIterator implements Iterator { + private final class BucketIterator implements Iterator { @Override public boolean hasNext() { return true; } - @Override public PlotBlock next() { + @Override public BlockState next() { return getBlock(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java index a4f02a9ef..07094aec5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockLoc.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class BlockLoc { private final int x; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java deleted file mode 100644 index e125ca188..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockRegistry.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import lombok.Getter; -import lombok.NonNull; - -import java.util.HashMap; -import java.util.Map; - -public abstract class BlockRegistry { - - @Getter private final Class type; - private final Map map = new HashMap<>(); - - public BlockRegistry(@NonNull final Class type, final T... preInitializedItems) { - this.type = type; - for (final T preInitializedItem : preInitializedItems) { - this.addMapping(getPlotBlock(preInitializedItem), preInitializedItem); - } - } - - public final void addMapping(@NonNull final PlotBlock plotBlock, @NonNull final T t) { - if (map.containsKey(plotBlock)) { - return; - } - this.map.put(plotBlock, t); - } - - public abstract PlotBlock getPlotBlock(final T item); - - public final T getItem(final PlotBlock plotBlock) { - return this.map.get(plotBlock); - } - -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java index e665ea752..c1bc5c98d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ChunkWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java index 27cb55216..182aa061e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/CmdInstance.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class CmdInstance { public final Runnable command; public final long timestamp; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index 490a6e211..8da0f74a3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -1,10 +1,15 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import org.jetbrains.annotations.NotNull; import java.util.UUID; @@ -120,7 +125,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(@NotNull Location location, @NotNull PlotBlock id) { + @Override public void playMusic(@NotNull Location location, @NotNull ItemType id) { } @Override public void kick(String message) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java index 3c3900dc1..f54e103a1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Direction.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum Direction { ALL(-1, "all"), NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java index bb466c082..30c2f88b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Expression.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.DebugExec; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java index d34521ee9..9c6c63022 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/FileBytes.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class FileBytes { public final String path; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java index 3413bd235..490c256f5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyBlock.java @@ -1,10 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; +import com.sk89q.worldedit.world.block.BlockState; + public abstract class LazyBlock { - public abstract StringPlotBlock getPlotBlock(); + public abstract BlockState getBlockState(); public String getId() { - return getPlotBlock().getItemId(); + return getBlockState().toString(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java index 8487c44be..a2391a86f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LazyResult.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class LazyResult { private T result; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java deleted file mode 100644 index 0596cd010..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/LegacyPlotBlock.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.registry.LegacyMapper; -import lombok.Getter; -import lombok.Setter; - -public class LegacyPlotBlock extends PlotBlock { - - public static final PlotBlock EVERYTHING = new LegacyPlotBlock((short) 0, (byte) 0); - public static final PlotBlock[] CACHE = new PlotBlock[65535]; - - static { - for (int i = 0; i < 65535; i++) { - short id = (short) (i >> 4); - byte data = (byte) (i & 15); - CACHE[i] = new LegacyPlotBlock(id, data); - } - } - - @Setter private BaseBlock baseBlock = null; - @Getter public final short id; - @Getter public final byte data; - - public LegacyPlotBlock(short id, byte data) { - this.id = id; - this.data = data; - } - - @Override public Object getRawId() { - return this.id; - } - - @Override public BaseBlock getBaseBlock() { - if (baseBlock == null) { - baseBlock = LegacyMapper.getInstance().getBlockFromLegacy(id, data).toBaseBlock(); - } - return baseBlock; - } - - @Override public boolean isAir() { - return this.id == 0; - } - - @Override public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LegacyPlotBlock other = (LegacyPlotBlock) obj; - return (this.id == other.id) && ((this.data == other.data) || (this.data == -1) || ( - other.data == -1)); - } - - @Override public int hashCode() { - return this.id; - } - - @Override public String toString() { - if (this.data == -1) { - return this.id + ""; - } - return this.id + ":" + this.data; - } - -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java index 5f2b6bafe..8e7edf51a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Location.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.sk89q.worldedit.math.BlockVector2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java index 85e6e72d8..f2e1a8dab 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/OfflinePlotPlayer.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.UUID; public interface OfflinePlotPlayer { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 6708289f3..edb28ba12 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; @@ -1282,7 +1284,7 @@ public class Plot { if (!isLoaded()) { return location; } - if (!WorldUtil.IMP.getBlock(location).isAir()) { + if (!WorldUtil.IMP.getBlock(location).getBlockType().getMaterial().isAir()) { location.setY(Math.max(1 + WorldUtil.IMP .getHighestBlock(this.getWorldName(), location.getX(), location.getZ()), bottom.getY())); @@ -1456,7 +1458,7 @@ public class Plot { } Location location = manager.getSignLoc(this); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); - queue.setBlock(location.getX(), location.getY(), location.getZ(), PlotBlock.get("air")); + queue.setBlock(location.getX(), location.getY(), location.getZ(), BlockUtil.get("air")); queue.flush(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java index b3217297d..99b4709cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java deleted file mode 100644 index 5b9de5852..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotBlock.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.Settings; -import com.google.common.collect.ImmutableMap; -import com.sk89q.worldedit.world.block.BaseBlock; -import lombok.NonNull; - -import java.util.Collection; -import java.util.Map; - -public abstract class PlotBlock implements ConfigurationSerializable { - - private static Class conversionType; - private static BlockRegistry blockRegistry; - - protected PlotBlock() { - } - - public static boolean isEverything(@NonNull final PlotBlock block) { - return block.equals(LegacyPlotBlock.EVERYTHING) || block.equals(StringPlotBlock.EVERYTHING); - } - - public static boolean containsEverything(@NonNull final Collection blocks) { - for (final PlotBlock block : blocks) { - if (isEverything(block)) { - return true; - } - } - return false; - } - - public static PlotBlock get(char combinedId) { - switch (combinedId) { - case 0: - return null; - case 1: - return get(0, 0); - default: - return get(combinedId >> 4, combinedId & 15); - } - } - - public static PlotBlock deserialize(@NonNull final Map map) { - if (map.containsKey("material")) { - final Object object = map.get("material"); - return get(object.toString()); - } - return null; - } - - public static StringPlotBlock get(@NonNull final String itemId) { - if (Settings.Enabled_Components.BLOCK_CACHE) { - return StringPlotBlock.getOrAdd(itemId); - } - return new StringPlotBlock(itemId); - } - - public static PlotBlock get(int id, int data) { - return Settings.Enabled_Components.BLOCK_CACHE && data > 0 ? - LegacyPlotBlock.CACHE[(id << 4) + data] : - new LegacyPlotBlock((short) id, (byte) data); - } - - public static PlotBlock getEmptyData(@NonNull final PlotBlock plotBlock) { - if (plotBlock instanceof StringPlotBlock) { - return plotBlock; - } - return get(((LegacyPlotBlock) plotBlock).getId(), (byte) 0); - } - - public static PlotBlock get(@NonNull final BaseBlock baseBlock) { - StringPlotBlock plotBlock = get(baseBlock.getBlockType().getId()); - plotBlock.setBaseBlock(baseBlock); - return plotBlock; - } - - public static PlotBlock get(@NonNull final Object type) { - if (blockRegistry == null) { - blockRegistry = PlotSquared.imp().getBlockRegistry(); - if (blockRegistry == null) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a custom block registry." - + " This method can't be used."); - } - conversionType = blockRegistry.getType(); - } - if (!type.getClass().equals(conversionType)) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a block registry for this object type"); - } - return blockRegistry.getPlotBlock(type); - } - - @Override public Map serialize() { - return ImmutableMap.of("material", this.getRawId()); - } - - public T to(@NonNull final Class clazz) { - if (blockRegistry == null) { - blockRegistry = PlotSquared.imp().getBlockRegistry(); - if (blockRegistry == null) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a custom block registry." - + " This method can't be used."); - } - conversionType = blockRegistry.getType(); - } - if (!clazz.equals(conversionType)) { - throw new UnsupportedOperationException( - "The PlotSquared implementation has not registered a block registry for this object type"); - } - return clazz.cast(blockRegistry.getItem(this)); - } - - public abstract boolean isAir(); - - public final boolean equalsAny(final int id, @NonNull final String stringId) { - if (this instanceof StringPlotBlock) { - final StringPlotBlock stringPlotBlock = (StringPlotBlock) this; - return stringPlotBlock.idEquals(stringId); - } - final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) this; - return legacyPlotBlock.id == id; - } - - @Override public abstract boolean equals(Object obj); - - @Override public abstract int hashCode(); - - @Override public abstract String toString(); - - public abstract Object getRawId(); - - public abstract BaseBlock getBaseBlock(); - -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java index d5d7c95d3..ef68d8d45 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotCluster.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java index 09759c09d..bd941da6b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotFilter.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class PlotFilter { public boolean allowsArea(final PlotArea area) { return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java index 4faa17b76..62cfeec49 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Set; import java.util.UUID; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 21e7dc777..1076ad443 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java index 4598a2fff..927f80872 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil; import lombok.NonNull; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java index c0a9d93d0..b306ebed9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotItemStack.java @@ -1,7 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.StringComparison; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; import lombok.Getter; public class PlotItemStack { @@ -9,7 +15,7 @@ public class PlotItemStack { public final int amount; public final String name; public final String[] lore; - @Getter private final PlotBlock plotBlock; + @Getter private final ItemType type; /** * @param id Legacy numerical item ID @@ -21,10 +27,11 @@ public class PlotItemStack { */ @Deprecated public PlotItemStack(final int id, final short data, final int amount, final String name, final String... lore) { + this.amount = amount; this.name = name; this.lore = lore; - this.plotBlock = PlotBlock.get(id, data); + this.type = LegacyMapper.getInstance().getItemFromLegacy(id, data); } /** @@ -35,10 +42,13 @@ public class PlotItemStack { */ public PlotItemStack(final String id, final int amount, final String name, final String... lore) { - StringComparison.ComparisonResult match = WorldUtil.IMP.getClosestBlock(id); - this.plotBlock = match.best; + this.type = ItemTypes.get(id); this.amount = amount; this.name = name; this.lore = lore; } + + public BlockState getBlockState() { + return type.getBlockType().getDefaultState(); + } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java index 33e57f753..e2ca83a64 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotLoc.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.StringMan; import lombok.AllArgsConstructor; import org.jetbrains.annotations.Nullable; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java index 0b39b2b7d..9120a576f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.commands.Template; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java index 64e6fedb3..f7865a7c6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotMessage.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java index e7ee3d40f..7019d10ce 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; @@ -19,6 +21,8 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.google.common.base.Preconditions; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; import lombok.NonNull; import org.jetbrains.annotations.NotNull; @@ -470,7 +474,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 PlotBlock id); + public abstract void playMusic(@NotNull Location location, @NotNull ItemType id); /** * Check if this player is banned. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java index 8d7904690..4bc9b159f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java index 490f8c926..3dfb4c1fa 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PseudoRandom.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class PseudoRandom { public static final PseudoRandom random = new PseudoRandom(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java index 911b2e6c5..b00e3cac7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Rating.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; import java.util.ArrayList; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java index ced127a22..3f4db9a7c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RegionWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class RegionWrapper { public final int minX; public final int maxX; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java index 90074a63a..3ac0da1a8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class RunnableVal implements Runnable { public T value; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java index ee46a417f..1872b5c1c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal2.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class RunnableVal2 implements Runnable { public T value1; public U value2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java index cb6b2a8be..4a4d47663 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/RunnableVal3.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class RunnableVal3 implements Runnable { public T value1; public U value2; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java index e203fa870..ba7a5f47c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/SetupObject.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java deleted file mode 100644 index d4119ae92..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object; - -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockTypes; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -public class StringPlotBlock extends PlotBlock { - - public static final PlotBlock EVERYTHING = new StringPlotBlock("air"); - private static final Map STRING_PLOT_BLOCK_CACHE = new HashMap<>(); - @Getter private final String nameSpace; - @Getter private final String itemId; - @Setter private BaseBlock baseBlock = null; - private boolean isForeign = false; - - public StringPlotBlock(@NonNull final String nameSpace, @NonNull final String itemId) { - this.nameSpace = nameSpace.toLowerCase(Locale.ENGLISH); - this.itemId = itemId.toLowerCase(Locale.ENGLISH); - this.determineForeign(); - } - - public StringPlotBlock(@NonNull final String itemId) { - if (itemId.contains(":")) { - final String[] parts = itemId.split(":"); - if (parts.length < 2) { - throw new IllegalArgumentException(String.format("Cannot parse \"%s\"", itemId)); - } - this.nameSpace = parts[0].toLowerCase(Locale.ENGLISH); - this.itemId = parts[1].toLowerCase(Locale.ENGLISH); - } else { - this.nameSpace = "minecraft"; - if (itemId.isEmpty()) { - this.itemId = "air"; - } else { - this.itemId = itemId.toLowerCase(Locale.ENGLISH); - } - } - this.determineForeign(); - } - - public static StringPlotBlock getOrAdd(@NonNull final String itemId) { - // final String id = itemId.toLowerCase(Locale.ENGLISH); - - StringPlotBlock plotBlock = STRING_PLOT_BLOCK_CACHE.get(itemId); - if (plotBlock == null) { - plotBlock = new StringPlotBlock(itemId); - STRING_PLOT_BLOCK_CACHE.put(itemId, plotBlock); - } - - return plotBlock; - } - - private void determineForeign() { - this.isForeign = !this.nameSpace.equals("minecraft"); - } - - @Override public String toString() { - return this.isForeign ? String.format("%s:%s", nameSpace, itemId) : itemId; - } - - @Override public boolean isAir() { - return this.itemId.isEmpty() || this.itemId.equalsIgnoreCase("air"); - } - - @Override public int hashCode() { - return this.toString().hashCode(); - } - - public boolean idEquals(@NonNull final String id) { - return id.equalsIgnoreCase(this.itemId); - } - - @Override public Object getRawId() { - return this.getItemId(); - } - - @Override public BaseBlock getBaseBlock() { - if (baseBlock == null) { - baseBlock = BlockTypes.get(itemId).getDefaultState().toBaseBlock(); - } - return baseBlock; - } - - @Override public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - StringPlotBlock other = (StringPlotBlock) obj; - return other.nameSpace.equals(this.nameSpace) && other.itemId.equals(this.itemId); - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java index 12d0a11aa..aa1e6e471 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + /** * */ diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java index 0353eb313..1af1fbf19 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/chat/PlainChatManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.chat; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java index 341fbb4f3..ef3cad495 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/FlatRandomCollection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.util.MathMan; import java.util.ArrayList; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java index b8dfa0a12..5778883f3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/RandomCollection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; import java.util.Random; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java index e75b64cb4..143649029 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/collection/SimpleRandomCollection.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.collection; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Map; import java.util.NavigableMap; import java.util.Random; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java index 30d9b1230..b0b964060 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/CommentInbox.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java index 29cf003cf..bf1f56d25 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxOwner.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java index 598904b0f..80e417801 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxPublic.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java index fa44db6c2..e597fcd02 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/InboxReport.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java index ada90457f..97579f29e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/comment/PlotComment.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.comment; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotId; public class PlotComment { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java deleted file mode 100644 index f558b5243..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/ItemType.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.object.schematic; - -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - -public enum ItemType { - AIR("air", 0), STONE("stone", 1), GRANITE("stone", 1, 1), POLISHED_GRANITE("stone", 1, - 2), DIORITE("stone", 1, 3), POLISHED_DIORITE("stone", 1, 4), ANDESITE("stone", 1, - 5), POLISHED_ANDESITE("stone", 1, 6), GRASS("grass", 2), DIRT("dirt", 3), COARSE_DIRT( - "dirt", 3, 1), PODZOL("dirt", 3, 2), COBBLESTONE("cobblestone", 4), OAK_WOOD_PLANK("planks", - 5), SPRUCE_WOOD_PLANK("planks", 5, 1), BIRCH_WOOD_PLANK("planks", 5, 2), JUNGLE_WOOD_PLANK( - "planks", 5, 3), ACACIA_WOOD_PLANK("planks", 5, 4), DARK_OAK_WOOD_PLANK("planks", 5, - 5), OAK_SAPLING("sapling", 6), SPRUCE_SAPLING("sapling", 6, 1), BIRCH_SAPLING("sapling", 6, - 2), JUNGLE_SAPLING("sapling", 6, 3), ACACIA_SAPLING("sapling", 6, 4), DARK_OAK_SAPLING( - "sapling", 6, 5), BEDROCK("bedrock", 7), FLOWING_WATER("flowing_water", 8), STILL_WATER( - "water", 9), FLOWING_LAVA("flowing_lava", 10), STILL_LAVA("lava", 11), SAND("sand", - 12), RED_SAND("sand", 12, 1), GRAVEL("gravel", 13), GOLD_ORE("gold_ore", 14), IRON_ORE( - "iron_ore", 15), COAL_ORE("coal_ore", 16), OAK_WOOD("log", 17), SPRUCE_WOOD("log", 17, - 1), BIRCH_WOOD("log", 17, 2), JUNGLE_WOOD("log", 17, 3), OAK_LEAVES("leaves", - 18), SPRUCE_LEAVES("leaves", 18, 1), BIRCH_LEAVES("leaves", 18, 2), JUNGLE_LEAVES("leaves", - 18, 3), SPONGE("sponge", 19), WET_SPONGE("sponge", 19, 1), GLASS("glass", - 20), LAPIS_LAZULI_ORE("lapis_ore", 21), LAPIS_LAZULI_BLOCK("lapis_block", 22), DISPENSER( - "dispenser", 23), SANDSTONE("sandstone", 24), CHISELED_SANDSTONE("sandstone", 24, - 1), SMOOTH_SANDSTONE("sandstone", 24, 2), NOTE_BLOCK("noteblock", 25), BED("bed", - 26), POWERED_RAIL("golden_rail", 27), DETECTOR_RAIL("detector_rail", 28), STICKY_PISTON( - "sticky_piston", 29), COBWEB("web", 30), DEAD_SHRUB("tallgrass", 31), TALLGRASS("tallgrass", - 31, 1), FERN("tallgrass", 31, 2), DEAD_SHRUB1("deadbush", 32), PISTON("piston", - 33), PISTON_HEAD("piston_head", 34), WHITE_WOOL("wool", 35), ORANGE_WOOL("wool", 35, - 1), MAGENTA_WOOL("wool", 35, 2), LIGHT_BLUE_WOOL("wool", 35, 3), YELLOW_WOOL("wool", 35, - 4), LIME_WOOL("wool", 35, 5), PINK_WOOL("wool", 35, 6), GRAY_WOOL("wool", 35, - 7), LIGHT_GRAY_WOOL("wool", 35, 8), CYAN_WOOL("wool", 35, 9), PURPLE_WOOL("wool", 35, - 10), BLUE_WOOL("wool", 35, 11), BROWN_WOOL("wool", 35, 12), GREEN_WOOL("wool", 35, - 13), RED_WOOL("wool", 35, 14), BLACK_WOOL("wool", 35, 15), DANDELION("yellow_flower", - 37), POPPY("red_flower", 38), BLUE_ORCHID("red_flower", 38, 1), ALLIUM("red_flower", 38, - 2), AZURE_BLUET("red_flower", 38, 3), RED_TULIP("red_flower", 38, 4), ORANGE_TULIP( - "red_flower", 38, 5), WHITE_TULIP("red_flower", 38, 6), PINK_TULIP("red_flower", 38, - 7), OXEYE_DAISY("red_flower", 38, 8), BROWN_MUSHROOM("brown_mushroom", 39), RED_MUSHROOM( - "red_mushroom", 40), GOLD_BLOCK("gold_block", 41), IRON_BLOCK("iron_block", - 42), DOUBLE_STONE_SLAB("double_stone_slab", 43), DOUBLE_SANDSTONE_SLAB("double_stone_slab", - 43, 1), DOUBLE_WOODEN_SLAB("double_stone_slab", 43, 2), DOUBLE_COBBLESTONE_SLAB( - "double_stone_slab", 43, 3), DOUBLE_BRICK_SLAB("double_stone_slab", 43, - 4), DOUBLE_STONE_BRICK_SLAB("double_stone_slab", 43, 5), DOUBLE_NETHER_BRICK_SLAB( - "double_stone_slab", 43, 6), DOUBLE_QUARTZ_SLAB("double_stone_slab", 43, 7), STONE_SLAB( - "stone_slab", 44), SANDSTONE_SLAB("stone_slab", 44, 1), WOODEN_SLAB("stone_slab", 44, - 2), COBBLESTONE_SLAB("stone_slab", 44, 3), BRICK_SLAB("stone_slab", 44, - 4), STONE_BRICK_SLAB("stone_slab", 44, 5), NETHER_BRICK_SLAB("stone_slab", 44, - 6), QUARTZ_SLAB("stone_slab", 44, 7), BRICKS("brick_block", 45), TNT("tnt", 46), BOOKSHELF( - "bookshelf", 47), MOSS_STONE("mossy_cobblestone", 48), OBSIDIAN("obsidian", 49), TORCH( - "torch", 50), FIRE("fire", 51), MONSTER_SPAWNER("mob_spawner", 52), OAK_WOOD_STAIRS( - "oak_stairs", 53), CHEST("chest", 54), REDSTONE_WIRE("redstone_wire", 55), DIAMOND_ORE( - "diamond_ore", 56), DIAMOND_BLOCK("diamond_block", 57), CRAFTING_TABLE("crafting_table", - 58), WHEAT_CROPS("wheat", 59), FARMLAND("farmland", 60), FURNACE("furnace", - 61), BURNING_FURNACE("lit_furnace", 62), STANDING_SIGN_BLOCK("standing_sign", - 63), OAK_DOOR_BLOCK("wooden_door", 64), LADDER("ladder", 65), RAIL("rail", - 66), COBBLESTONE_STAIRS("stone_stairs", 67), WALL_MOUNTED_SIGN_BLOCK("wall_sign", - 68), LEVER("lever", 69), STONE_PRESSURE_PLATE("stone_pressure_plate", 70), IRON_DOOR_BLOCK( - "iron_door", 71), WOODEN_PRESSURE_PLATE("wooden_pressure_plate", 72), REDSTONE_ORE( - "redstone_ore", 73), GLOWING_REDSTONE_ORE("lit_redstone_ore", 74), REDSTONE_TORCH_OFF( - "unlit_redstone_torch", 75), REDSTONE_TORCH_ON("redstone_torch", 76), STONE_BUTTON( - "stone_button", 77), SNOW("snow_layer", 78), ICE("ice", 79), SNOW_BLOCK("snow", 80), CACTUS( - "cactus", 81), CLAY("clay", 82), SUGAR_CANES("reeds", 83), JUKEBOX("jukebox", - 84), OAK_FENCE("fence", 85), PUMPKIN("pumpkin", 86), NETHERRACK("netherrack", - 87), SOUL_SAND("soul_sand", 88), GLOWSTONE("glowstone", 89), NETHER_PORTAL("portal", - 90), JACK_OLANTERN("lit_pumpkin", 91), CAKE_BLOCK("cake", 92), REDSTONE_REPEATER_BLOCK_OFF( - "unpowered_repeater", 93), REDSTONE_REPEATER_BLOCK_ON("powered_repeater", - 94), WHITE_STAINED_GLASS("stained_glass", 95), ORANGE_STAINED_GLASS("stained_glass", 95, - 1), MAGENTA_STAINED_GLASS("stained_glass", 95, 2), LIGHT_BLUE_STAINED_GLASS("stained_glass", - 95, 3), YELLOW_STAINED_GLASS("stained_glass", 95, 4), LIME_STAINED_GLASS("stained_glass", - 95, 5), PINK_STAINED_GLASS("stained_glass", 95, 6), GRAY_STAINED_GLASS("stained_glass", 95, - 7), LIGHT_GRAY_STAINED_GLASS("stained_glass", 95, 8), CYAN_STAINED_GLASS("stained_glass", - 95, 9), PURPLE_STAINED_GLASS("stained_glass", 95, 10), BLUE_STAINED_GLASS("stained_glass", - 95, 11), BROWN_STAINED_GLASS("stained_glass", 95, 12), GREEN_STAINED_GLASS("stained_glass", - 95, 13), RED_STAINED_GLASS("stained_glass", 95, 14), BLACK_STAINED_GLASS("stained_glass", - 95, 15), WOODEN_TRAPDOOR("trapdoor", 96), STONE_MONSTER_EGG("monster_egg", - 97), COBBLESTONE_MONSTER_EGG("monster_egg", 97, 1), STONE_BRICK_MONSTER_EGG("monster_egg", - 97, 2), MOSSY_STONE_BRICK_MONSTER_EGG("monster_egg", 97, - 3), CRACKED_STONE_BRICK_MONSTER_EGG("monster_egg", 97, 4), CHISELED_STONE_BRICK_MONSTER_EGG( - "monster_egg", 97, 5), STONE_BRICKS("stonebrick", 98), MOSSY_STONE_BRICKS("stonebrick", 98, - 1), CRACKED_STONE_BRICKS("stonebrick", 98, 2), CHISELED_STONE_BRICKS("stonebrick", 98, - 3), RED_MUSHROOM_CAP("stonebrick", 99), BROWN_MUSHROOM_CAP("stonebrick", 100), IRON_BARS( - "iron_bars", 101), GLASS_PANE("glass_pane", 102), MELON_BLOCK("melon_block", - 103), PUMPKIN_STEM("pumpkin_stem", 104), MELON_STEM("melon_stem", 105), VINES("vine", - 106), OAK_FENCE_GATE("fence_gate", 107), BRICK_STAIRS("brick_stairs", - 108), STONE_BRICK_STAIRS("stone_brick_stairs", 109), MYCELIUM("mycelium", 110), LILY_PAD( - "waterlily", 111), NETHER_BRICK("nether_brick", 112), NETHER_BRICK_FENCE( - "nether_brick_fence", 113), NETHER_BRICK_STAIRS("nether_brick_stairs", 114), NETHER_WART( - "nether_wart", 115), ENCHANTMENT_TABLE("enchanting_table", 116), BREWING_STAND( - "brewing_stand", 117), CAULDRON("cauldron", 118), END_PORTAL("end_portal", - 119), END_PORTAL_FRAME("end_portal_frame", 120), END_STONE("end_stone", 121), DRAGON_EGG( - "dragon_egg", 122), REDSTONE_LAMP_INACTIVE("redstone_lamp", 123), REDSTONE_LAMP_ACTIVE( - "lit_redstone_lamp", 124), DOUBLE_OAK_WOOD_SLAB("double_wooden_slab", - 125), DOUBLE_SPRUCE_WOOD_SLAB("double_wooden_slab", 125, 1), DOUBLE_BIRCH_WOOD_SLAB( - "double_wooden_slab", 125, 2), DOUBLE_JUNGLE_WOOD_SLAB("double_wooden_slab", 125, - 3), DOUBLE_ACACIA_WOOD_SLAB("double_wooden_slab", 125, 4), DOUBLE_DARK_OAK_WOOD_SLAB( - "double_wooden_slab", 125, 5), OAK_WOOD_SLAB("wooden_slab", 126), SPRUCE_WOOD_SLAB( - "wooden_slab", 126, 1), BIRCH_WOOD_SLAB("wooden_slab", 126, 2), JUNGLE_WOOD_SLAB( - "wooden_slab", 126, 3), ACACIA_WOOD_SLAB("wooden_slab", 126, 4), DARK_OAK_WOOD_SLAB( - "wooden_slab", 126, 5), COCOA("cocoa", 127), SANDSTONE_STAIRS("sandstone_stairs", - 128), EMERALD_ORE("emerald_ore", 129), ENDER_CHEST("ender_chest", 130), TRIPWIRE_HOOK( - "tripwire_hook", 131), TRIPWIRE("tripwire_hook", 132), EMERALD_BLOCK("emerald_block", - 133), SPRUCE_WOOD_STAIRS("spruce_stairs", 134), BIRCH_WOOD_STAIRS("birch_stairs", - 135), JUNGLE_WOOD_STAIRS("jungle_stairs", 136), COMMAND_BLOCK("command_block", 137), BEACON( - "beacon", 138), COBBLESTONE_WALL("cobblestone_wall", 139), MOSSY_COBBLESTONE_WALL( - "cobblestone_wall", 139, 1), FLOWER_POT("flower_pot", 140), CARROTS("carrots", - 141), POTATOES("potatoes", 142), WOODEN_BUTTON("wooden_button", 143), MOB_HEAD("skull", - 144), ANVIL("anvil", 145), TRAPPED_CHEST("trapped_chest", - 146), WEIGHTED_PRESSURE_PLATE_LIGHT("light_weighted_pressure_plate", - 147), WEIGHTED_PRESSURE_PLATE_HEAVY("heavy_weighted_pressure_plate", - 148), REDSTONE_COMPARATOR_INACTIVE("unpowered_comparator", 149), REDSTONE_COMPARATOR_ACTIVE( - "powered_comparator", 150), DAYLIGHT_SENSOR("daylight_detector", 151), REDSTONE_BLOCK( - "redstone_block", 152), NETHER_QUARTZ_ORE("quartz_ore", 153), HOPPER("hopper", - 154), QUARTZ_BLOCK("quartz_block", 155), CHISELED_QUARTZ_BLOCK("quartz_block", 155, - 1), PILLAR_QUARTZ_BLOCK("quartz_block", 155, 2), QUARTZ_STAIRS("quartz_stairs", - 156), ACTIVATOR_RAIL("activator_rail", 157), DROPPER("dropper", 158), WHITE_STAINED_CLAY( - "stained_hardened_clay", 159), ORANGE_STAINED_CLAY("stained_hardened_clay", 159, - 1), MAGENTA_STAINED_CLAY("stained_hardened_clay", 159, 2), LIGHT_BLUE_STAINED_CLAY( - "stained_hardened_clay", 159, 3), YELLOW_STAINED_CLAY("stained_hardened_clay", 159, - 4), LIME_STAINED_CLAY("stained_hardened_clay", 159, 5), PINK_STAINED_CLAY( - "stained_hardened_clay", 159, 6), GRAY_STAINED_CLAY("stained_hardened_clay", 159, - 7), LIGHT_GRAY_STAINED_CLAY("stained_hardened_clay", 159, 8), CYAN_STAINED_CLAY( - "stained_hardened_clay", 159, 9), PURPLE_STAINED_CLAY("stained_hardened_clay", 159, - 10), BLUE_STAINED_CLAY("stained_hardened_clay", 159, 11), BROWN_STAINED_CLAY( - "stained_hardened_clay", 159, 12), GREEN_STAINED_CLAY("stained_hardened_clay", 159, - 13), RED_STAINED_CLAY("stained_hardened_clay", 159, 14), BLACK_STAINED_CLAY( - "stained_hardened_clay", 159, 15), WHITE_STAINED_GLASS_PANE("stained_glass_pane", - 160), ORANGE_STAINED_GLASS_PANE("stained_glass_pane", 160, 1), MAGENTA_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 2), LIGHT_BLUE_STAINED_GLASS_PANE("stained_glass_pane", 160, - 3), YELLOW_STAINED_GLASS_PANE("stained_glass_pane", 160, 4), LIME_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 5), PINK_STAINED_GLASS_PANE("stained_glass_pane", 160, - 6), GRAY_STAINED_GLASS_PANE("stained_glass_pane", 160, 7), LIGHT_GRAY_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 8), CYAN_STAINED_GLASS_PANE("stained_glass_pane", 160, - 9), PURPLE_STAINED_GLASS_PANE("stained_glass_pane", 160, 10), BLUE_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 11), BROWN_STAINED_GLASS_PANE("stained_glass_pane", 160, - 12), GREEN_STAINED_GLASS_PANE("stained_glass_pane", 160, 13), RED_STAINED_GLASS_PANE( - "stained_glass_pane", 160, 14), BLACK_STAINED_GLASS_PANE("stained_glass_pane", 160, - 15), ACACIA_LEAVES("leaves2", 161), DARK_OAK_LEAVES("leaves2", 161, 1), ACACIA_WOOD("log2", - 162), DARK_OAK_WOOD("log2", 162, 1), ACACIA_WOOD_STAIRS("acacia_stairs", - 163), DARK_OAK_WOOD_STAIRS("dark_oak_stairs", 164), SLIME_BLOCK("slime", 165), BARRIER( - "barrier", 166), IRON_TRAPDOOR("iron_trapdoor", 167), PRISMARINE("prismarine", - 168), PRISMARINE_BRICKS("prismarine", 168, 1), DARK_PRISMARINE("prismarine", 168, - 2), SEA_LANTERN("sea_lantern", 169), HAY_BALE("hay_block", 170), WHITE_CARPET("carpet", - 171), ORANGE_CARPET("carpet", 171, 1), MAGENTA_CARPET("carpet", 171, 2), LIGHT_BLUE_CARPET( - "carpet", 171, 3), YELLOW_CARPET("carpet", 171, 4), LIME_CARPET("carpet", 171, - 5), PINK_CARPET("carpet", 171, 6), GRAY_CARPET("carpet", 171, 7), LIGHT_GRAY_CARPET( - "carpet", 171, 8), CYAN_CARPET("carpet", 171, 9), PURPLE_CARPET("carpet", 171, - 10), BLUE_CARPET("carpet", 171, 11), BROWN_CARPET("carpet", 171, 12), GREEN_CARPET("carpet", - 171, 13), RED_CARPET("carpet", 171, 14), BLACK_CARPET("carpet", 171, 15), HARDENED_CLAY( - "hardened_clay", 172), BLOCK_OF_COAL("coal_block", 173), PACKED_ICE("packed_ice", - 174), SUNFLOWER("double_plant", 175), LILAC("double_plant", 175, 1), DOUBLE_TALLGRASS( - "double_plant", 175, 2), LARGE_FERN("double_plant", 175, 3), ROSE_BUSH("double_plant", 175, - 4), PEONY("double_plant", 175, 5), FREE_STANDING_BANNER("standing_banner", - 176), WALL_MOUNTED_BANNER("wall_banner", 177), INVERTED_DAYLIGHT_SENSOR( - "daylight_detector_inverted", 178), RED_SANDSTONE("red_sandstone", - 179), SMOOTH_RED_SANDSTONE("red_sandstone", 179, 1), CHISELED_RED_SANDSTONE("red_sandstone", - 179, 2), RED_SANDSTONE_STAIRS("red_sandstone_stairs", 180), DOUBLE_RED_SANDSTONE_SLAB( - "stone_slab2", 181), RED_SANDSTONE_SLAB("double_stone_slab2", 182), SPRUCE_FENCE_GATE( - "spruce_fence_gate", 183), BIRCH_FENCE_GATE("birch_fence_gate", 184), JUNGLE_FENCE_GATE( - "jungle_fence_gate", 185), DARK_OAK_FENCE_GATE("dark_oak_fence_gate", - 186), ACACIA_FENCE_GATE("acacia_fence_gate", 187), SPRUCE_FENCE("spruce_fence", - 188), BIRCH_FENCE("birch_fence", 189), JUNGLE_FENCE("jungle_fence", 190), DARK_OAK_FENCE( - "dark_oak_fence", 191), ACACIA_FENCE("acacia_fence", 192), SPRUCE_DOOR_BLOCK("spruce_door", - 193), BIRCH_DOOR_BLOCK("birch_door", 194), JUNGLE_DOOR_BLOCK("jungle_door", - 195), ACACIA_DOOR_BLOCK("acacia_door", 196), DARK_OAK_DOOR_BLOCK("dark_oak_door", - 197), IRON_SHOVEL("iron_shovel", 256), IRON_PICKAXE("iron_pickaxe", 257), IRON_AXE( - "iron_axe", 258), FLINT_AND_STEEL("flint_and_steel", 259), APPLE("apple", 260), BOW("bow", - 261), ARROW("arrow", 262), COAL("coal", 263), CHARCOAL("coal", 263, 1), DIAMOND("diamond", - 264), IRON_INGOT("iron_ingot", 265), GOLD_INGOT("gold_ingot", 266), IRON_SWORD("iron_sword", - 267), WOODEN_SWORD("wooden_sword", 268), WOODEN_SHOVEL("wooden_shovel", - 269), WOODEN_PICKAXE("wooden_pickaxe", 270), WOODEN_AXE("wooden_axe", 271), STONE_SWORD( - "stone_sword", 272), STONE_SHOVEL("stone_shovel", 273), STONE_PICKAXE("stone_pickaxe", - 274), STONE_AXE("stone_axe", 275), DIAMOND_SWORD("diamond_sword", 276), DIAMOND_SHOVEL( - "diamond_shovel", 277), DIAMOND_PICKAXE("diamond_pickaxe", 278), DIAMOND_AXE("diamond_axe", - 279), STICK("stick", 280), BOWL("bowl", 281), MUSHROOM_STEW("mushroom_stew", - 282), GOLDEN_SWORD("golden_sword", 283), GOLDEN_SHOVEL("golden_shovel", - 284), GOLDEN_PICKAXE("golden_pickaxe", 285), GOLDEN_AXE("golden_axe", 286), STRING("string", - 287), FEATHER("feather", 288), GUNPOWDER("gunpowder", 289), WOODEN_HOE("wooden_hoe", - 290), STONE_HOE("stone_hoe", 291), IRON_HOE("iron_hoe", 292), DIAMOND_HOE("diamond_hoe", - 293), GOLDEN_HOE("golden_hoe", 294), WHEAT_SEEDS("wheat_seeds", 295), WHEAT("wheat", - 296), BREAD("bread", 297), LEATHER_HELMET("leather_helmet", 298), LEATHER_TUNIC( - "leather_chestplate", 299), LEATHER_PANTS("leather_leggings", 300), LEATHER_BOOTS( - "leather_boots", 301), CHAINMAIL_HELMET("chainmail_helmet", 302), CHAINMAIL_CHESTPLATE( - "chainmail_chestplate", 303), CHAINMAIL_LEGGINGS("chainmail_leggings", - 304), CHAINMAIL_BOOTS("chainmail_boots", 305), IRON_HELMET("iron_helmet", - 306), IRON_CHESTPLATE("iron_chestplate", 307), IRON_LEGGINGS("iron_leggings", - 308), IRON_BOOTS("iron_boots", 309), DIAMOND_HELMET("diamond_helmet", - 310), DIAMOND_CHESTPLATE("diamond_chestplate", 311), DIAMOND_LEGGINGS("diamond_leggings", - 312), DIAMOND_BOOTS("diamond_boots", 313), GOLDEN_HELMET("golden_helmet", - 314), GOLDEN_CHESTPLATE("golden_chestplate", 315), GOLDEN_LEGGINGS("golden_leggings", - 316), GOLDEN_BOOTS("golden_boots", 317), FLINT("flint_and_steel", 318), RAW_PORKCHOP( - "porkchop", 319), COOKED_PORKCHOP("cooked_porkchop", 320), PAINTING("painting", - 321), GOLDEN_APPLE("golden_apple", 322), ENCHANTED_GOLDEN_APPLE("golden_apple", 322, - 1), SIGN("sign", 323), OAK_DOOR("wooden_door", 324), BUCKET("bucket", 325), WATER_BUCKET( - "water_bucket", 326), LAVA_BUCKET("lava_bucket", 327), MINECART("minecart", 328), SADDLE( - "saddle", 329), IRON_DOOR("iron_door", 330), REDSTONE("redstone", 331), SNOWBALL("snowball", - 332), BOAT("boat", 333), LEATHER("leather", 334), MILK_BUCKET("milk_bucket", 335), BRICK( - "brick", 336), CLAY1("clay_ball", 337), SUGAR_CANES1("reeds", 338), PAPER("paper", - 339), BOOK("book", 340), SLIMEBALL("slime_ball", 341), MINECART_WITH_CHEST("chest_minecart", - 342), MINECART_WITH_FURNACE("furnace_minecart", 343), EGG("egg", 344), COMPASS("compass", - 345), FISHING_ROD("fishing_rod", 346), CLOCK("clock", 347), GLOWSTONE_DUST("glowstone_dust", - 348), RAW_FISH("fish", 349), RAW_SALMON("fish", 349, 1), CLOWNFISH("fish", 349, - 2), PUFFERFISH("fish", 349, 3), COOKED_FISH("cooked_fish", 350), COOKED_SALMON( - "cooked_fish", 350, 1), INK_SACK("dye", 351), ROSE_RED("dye", 351, 1), CACTUS_GREEN("dye", - 351, 2), COCO_BEANS("dye", 351, 3), LAPIS_LAZULI("dye", 351, 4), PURPLE_DYE("dye", 351, - 5), CYAN_DYE("dye", 351, 6), LIGHT_GRAY_DYE("dye", 351, 7), GRAY_DYE("dye", 351, - 8), PINK_DYE("dye", 351, 9), LIME_DYE("dye", 351, 10), DANDELION_YELLOW("dye", 351, - 11), LIGHT_BLUE_DYE("dye", 351, 12), MAGENTA_DYE("dye", 351, 13), ORANGE_DYE("dye", 351, - 14), BONE_MEAL("dye", 351, 15), BONE("bone", 352), SUGAR("sugar", 353), CAKE("cake", - 354), BED1("bed", 355), REDSTONE_REPEATER("repeater", 356), COOKIE("cookie", 357), MAP( - "filled_map", 358), SHEARS("shears", 359), MELON("melon", 360), PUMPKIN_SEEDS( - "pumpkin_seeds", 361), MELON_SEEDS("melon_seeds", 362), RAW_BEEF("beef", 363), STEAK( - "cooked_beef", 364), RAW_CHICKEN("chicken", 365), COOKED_CHICKEN("cooked_chicken", - 366), ROTTEN_FLESH("rotten_flesh", 367), ENDER_PEARL("ender_pearl", 368), BLAZE_ROD( - "blaze_rod", 369), GHAST_TEAR("ghast_tear", 370), GOLD_NUGGET("gold_nugget", - 371), NETHER_WART1("nether_wart", 372), POTION("potion", 373), GLASS_BOTTLE("glass_bottle", - 374), SPIDER_EYE("spider_eye", 375), FERMENTED_SPIDER_EYE("fermented_spider_eye", - 376), BLAZE_POWDER("blaze_powder", 377), MAGMA_CREAM("magma_cream", 378), BREWING_STAND1( - "brewing_stand", 379), CAULDRON1("cauldron", 380), EYE_OF_ENDER("ender_eye", - 381), GLISTERING_MELON("speckled_melon", 382), SPAWN_CREEPER("spawn_egg", 383, - 50), SPAWN_SKELETON("spawn_egg", 383, 51), SPAWN_SPIDER("spawn_egg", 383, 52), SPAWN_ZOMBIE( - "spawn_egg", 383, 54), SPAWN_SLIME("spawn_egg", 383, 55), SPAWN_GHAST("spawn_egg", 383, - 56), SPAWN_PIGMAN("spawn_egg", 383, 57), SPAWN_ENDERMAN("spawn_egg", 383, - 58), SPAWN_CAVE_SPIDER("spawn_egg", 383, 59), SPAWN_SILVERFISH("spawn_egg", 383, - 60), SPAWN_BLAZE("spawn_egg", 383, 61), SPAWN_MAGMA_CUBE("spawn_egg", 383, 62), SPAWN_BAT( - "spawn_egg", 383, 65), SPAWN_WITCH("spawn_egg", 383, 66), SPAWN_ENDERMITE("spawn_egg", 383, - 67), SPAWN_GUARDIAN("spawn_egg", 383, 68), SPAWN_PIG("spawn_egg", 383, 90), SPAWN_SHEEP( - "spawn_egg", 383, 91), SPAWN_COW("spawn_egg", 383, 92), SPAWN_CHICKEN("spawn_egg", 383, - 93), SPAWN_SQUID("spawn_egg", 383, 94), SPAWN_WOLF("spawn_egg", 383, 95), SPAWN_MOOSHROOM( - "spawn_egg", 383, 96), SPAWN_OCELOT("spawn_egg", 383, 98), SPAWN_HORSE("spawn_egg", 383, - 100), SPAWN_RABBIT("spawn_egg", 383, 101), SPAWN_VILLAGER("spawn_egg", 383, - 120), BOTTLE_O_ENCHANTING("experience_bottle", 384), FIRE_CHARGE("fire_charge", - 385), BOOK_AND_QUILL("writable_book", 386), WRITTEN_BOOK("written_book", 387), EMERALD( - "emerald", 388), ITEM_FRAME("item_frame", 389), FLOWER_POT1("flower_pot", 390), CARROT( - "carrot", 391), POTATO("potato", 392), BAKED_POTATO("baked_potato", 393), POISONOUS_POTATO( - "poisonous_potato", 394), EMPTY_MAP("map", 395), GOLDEN_CARROT("golden_carrot", - 396), MOB_HEAD_SKELETON("skull", 397), MOB_HEAD_WITHER_SKELETON("skull", 397, - 1), MOB_HEAD_ZOMBIE("skull", 397, 2), MOB_HEAD_HUMAN("skull", 397, 3), MOB_HEAD_CREEPER( - "skull", 397, 4), CARROT_ON_A_STICK("carrot_on_a_stick", 398), NETHER_STAR("nether_star", - 399), PUMPKIN_PIE("pumpkin_pie", 400), FIREWORK_ROCKET("fireworks", 401), FIREWORK_STAR( - "firework_charge", 402), ENCHANTED_BOOK("enchanted_book", 403), REDSTONE_COMPARATOR( - "comparator", 404), NETHER_BRICK1("netherbrick", 405), NETHER_QUARTZ("quartz", - 406), MINECART_WITH_TNT("tnt_minecart", 407), MINECART_WITH_HOPPER("hopper_minecart", - 408), PRISMARINE_SHARD("prismarine_shard", 409), PRISMARINE_CRYSTALS("prismarine_crystals", - 410), RAW_RABBIT("rabbit", 411), COOKED_RABBIT("cooked_rabbit", 412), RABBIT_STEW( - "rabbit_stew", 413), RABBITS_FOOT("rabbit_foot", 414), RABBIT_HIDE("rabbit_hide", - 415), ARMOR_STAND("armor_stand", 416), IRON_HORSE_ARMOR("iron_horse_armor", - 417), GOLDEN_HORSE_ARMOR("golden_horse_armor", 418), DIAMOND_HORSE_ARMOR( - "diamond_horse_armor", 419), LEAD("lead", 420), NAME_TAG("name_tag", - 421), MINECART_WITH_COMMAND_BLOCK("command_block_minecart", 422), RAW_MUTTON("mutton", - 423), COOKED_MUTTON("cooked_mutton", 424), BANNER("banner", 425), SPRUCE_DOOR("spruce_door", - 427), BIRCH_DOOR("birch_door", 428), JUNGLE_DOOR("jungle_door", 429), ACACIA_DOOR( - "acacia_door", 430), DARK_OAK_DOOR("dark_oak_door", 431), DISC_13("record_13", - 2256), CAT_DISC("record_cat", 2257), BLOCKS_DISC("record_blocks", 2258), CHIRP_DISC( - "record_chirp", 2259), FAR_DISC("record_far", 2260), MALL_DISC("record_mall", - 2261), MELLOHI_DISC("record_mellohi", 2262), STAL_DISC("record_stal", 2263), STRAD_DISC( - "record_strad", 2264), WARD_DISC("record_ward", 2265), DISC_11("record_11", - 2266), WAIT_DISC("record_wait", 2267), END_ROD("end_rod", 198), CHORUS_PLANT("chorus_plant", - 199), CHORUS_FLOWER("chorus_flower", 200), PURPUR_BLOCK("purpur_block", 201), PURPUR_PILLAR( - "purpur_pillar", 202), PURPUR_STAIRS("purpur_stairs", 203), PURPUR_DOUBLE_SLAB( - "purpur_double_slab", 204), PURPUR_SLAB("purpur_slab", 205), END_BRICKS("end_bricks", - 206), BEETROOTS("beetroots", 207), GRASS_PATH("grass_path", 208), END_GATEWAY("end_gateway", - 209), REPEATING_COMMAND_BLOCK("repeating_command_block", 210), CHAIN_COMMAND_BLOCK( - "chain_command_block", 211), FROSTED_ICE("frosted_ice", 212), STRUCTURE_BLOCK( - "structure_block", 255); - - private static final Map ids = new HashMap<>(); - private static final Map datas = new HashMap<>(); - - static { - for (ItemType type : EnumSet.allOf(ItemType.class)) { - ids.put(type.name, type.id); - datas.put(type.name, type.data); - } - } - - private final int id; - private final byte data; - private final String name; - - ItemType(String name, int id) { - this.id = id; - this.data = 0; - this.name = name; - } - - ItemType(String name, int id, int data) { - this.id = id; - this.data = (byte) data; - this.name = name; - } - - public static int getId(String name) { - Integer value = ids.get(name); - if (value == null) { - return 0; - } - return value; - } - - public static byte getData(String name) { - Byte value = datas.get(name); - if (value == null) { - return 0; - } - return value; - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java index 2b7e31295..6e3cc6688 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/PlotItem.java @@ -1,6 +1,9 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; public class PlotItem { @@ -9,10 +12,10 @@ public class PlotItem { public final int z; // public final short[] id; // public final byte[] data; - public final PlotBlock[] types; + public final ItemType[] types; public final byte[] amount; - public PlotItem(short x, short y, short z, PlotBlock[] types, byte[] amount) { + public PlotItem(short x, short y, short z, ItemType[] types, byte[] amount) { this.x = x; this.y = y; this.z = z; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java index e2c222df5..5977c1eb3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/Schematic.java @@ -1,9 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicWriter; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; @@ -17,10 +19,10 @@ import java.util.Map; public class Schematic { // Lossy but fast - @Getter private final BlockArrayClipboard clipboard; + @Getter private final Clipboard clipboard; @Getter private Map flags = new HashMap<>(); - public Schematic(BlockArrayClipboard clip) { + public Schematic(Clipboard clip) { this.clipboard = clip; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java index a19404da2..6f31b68ed 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/schematic/StoredEntity.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.schematic; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java index 994f6a465..0223c45f6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/stream/AbstractDelegateOutputStream.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.stream; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.io.IOException; import java.io.OutputStream; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java index 8d5152a1b..a60d788df 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/DefaultPlotAreaManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java index 7a59dab9d..b5156eae9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/PlotAreaManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java index 7f63e2ed0..cfeba3ff2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java index 1f5e70856..a8b2c421f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Configuration; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java index f2e0b3c03..2dd7399ad 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotAreaManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java index 49d3788d5..dedeeacdf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java index d50e3d22f..a01bf0e70 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SingleWorldGenerator.java @@ -1,11 +1,13 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; @@ -35,7 +37,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { blockBuckets[layer] = new BlockBucket[4096]; } blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("bedrock")); + BlockBucket.withSingle(BlockUtil.get("bedrock")); } } } @@ -47,7 +49,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { blockBuckets[layer] = new BlockBucket[4096]; } blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("dirt")); + BlockBucket.withSingle(BlockUtil.get("dirt")); } } } @@ -59,7 +61,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { blockBuckets[layer] = new BlockBucket[4096]; } blockBuckets[layer][((y & 0xF) << 8) | (z << 4) | x] = - BlockBucket.withSingle(PlotBlock.get("grass_block")); + BlockBucket.withSingle(BlockUtil.get("grass_block")); } } } @@ -71,12 +73,12 @@ public class SingleWorldGenerator extends IndependentPlotGenerator { if (area.VOID) { Location min = result.getMin(); if (min.getX() == 0 && min.getZ() == 0) { - result.setBlock(0, 0, 0, PlotBlock.get("bedrock")); + result.setBlock(0, 0, 0, BlockUtil.get("bedrock")); } } else { - result.setCuboid(bedrock1, bedrock2, PlotBlock.get("bedrock")); - result.setCuboid(dirt1, dirt2, PlotBlock.get("dirt")); - result.setCuboid(grass1, grass2, PlotBlock.get("grass_block")); + result.setCuboid(bedrock1, bedrock2, BlockUtil.get("bedrock")); + result.setCuboid(dirt1, dirt2, BlockUtil.get("dirt")); + result.setCuboid(grass1, grass2, BlockUtil.get("grass_block")); } result.fillBiome("PLAINS"); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java index 6052c2a93..9dd004cf1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ArrayUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.Arrays; public class ArrayUtil { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java index ace8bb7e4..3b3b9d0c7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ByteArrayUtilities.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class ByteArrayUtilities { public static byte[] integerToBytes(int i) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java index 1177206e6..5ffba6493 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChatManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java index 206f2b710..e67c11265 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java index e6cdc4134..a502f7538 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CmdConfirm.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.CmdInstance; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java index 4eff629d6..281b2f71b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java index f8860887f..12afc3798 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ConsoleColors.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class ConsoleColors { public static String fromString(String input) { input = input.replaceAll("&0", fromChatColor("&0")).replaceAll("&1", fromChatColor("&1")) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java index 4912b6e83..8554b2d78 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EconHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java index 51e093d46..ad8a19479 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EntityUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.IntegerFlag; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java index 5d443a43e..51f055fea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -10,18 +12,22 @@ import com.github.intellectualsites.plotsquared.plot.object.LazyBlock; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Rating; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import org.jetbrains.annotations.Nullable; import java.util.HashSet; import java.util.List; import java.util.Optional; +import java.util.Set; import java.util.UUID; +import java.util.function.Supplier; public abstract class EventUtil { @@ -101,7 +107,7 @@ public abstract class EventUtil { } public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type, - Location location, LazyBlock block, boolean notifyPerms) { + Location location, Supplier block, boolean notifyPerms) { PlotArea area = location.getPlotArea(); assert area != null; Plot plot = area.getPlot(location); @@ -127,19 +133,19 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - Optional> use = plot.getFlag(Flags.USE); + Optional> use = plot.getFlag(Flags.USE); if (use.isPresent()) { - HashSet value = use.get(); - if (PlotBlock.containsEverything(value) || value - .contains(block.getPlotBlock())) { + Set value = use.get(); + if (value.contains(BlockTypes.AIR) || value + .contains(block.get())) { return true; } } - Optional> destroy = plot.getFlag(Flags.BREAK); + Optional> destroy = plot.getFlag(Flags.BREAK); if (destroy.isPresent()) { - HashSet value = destroy.get(); - if (PlotBlock.containsEverything(value) || value - .contains(block.getPlotBlock())) { + Set value = destroy.get(); + if (value.contains(BlockTypes.AIR) || value + .contains(block.get())) { return true; } } @@ -221,10 +227,10 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } - Optional> flagValue = plot.getFlag(Flags.USE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { return Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil @@ -244,10 +250,10 @@ public abstract class EventUtil { Captions.PERMISSION_ADMIN_BUILD_UNOWNED.getTranslated(), notifyPerms); } - Optional> flagValue = plot.getFlag(Flags.PLACE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.PLACE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_OTHER.getTranslated(), false)) { return true; @@ -271,10 +277,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.USE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -298,10 +304,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.USE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.USE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -327,10 +333,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.USE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.USE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -357,10 +363,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.USE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.USE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -387,10 +393,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) { return true; } - Optional> flagValue = plot.getFlag(Flags.PLACE); - HashSet value = flagValue.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flagValue = plot.getFlag(Flags.PLACE); + Set value = flagValue.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -417,10 +423,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.PLACE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.PLACE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { @@ -448,10 +454,10 @@ public abstract class EventUtil { if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) { return true; } - Optional> flag = plot.getFlag(Flags.PLACE); - HashSet value = flag.orElse(null); - if (value == null || !PlotBlock.containsEverything(value) && !value - .contains(block.getPlotBlock())) { + Optional> flag = plot.getFlag(Flags.PLACE); + Set value = flag.orElse(null); + if (value == null || !value.contains(BlockTypes.AIR) && !value + .contains(block.get())) { if (Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java index 761c5aa0a..ff5bfd98c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/HttpUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.config.Settings; import java.io.BufferedReader; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java index b5ebe5d17..300958f55 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/IncendoPaster.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.google.common.base.Charsets; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java index 03b87fc2b..3ce6f49cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/InventoryUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java index dfbc0b3eb..e9dca64af 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyConverter.java @@ -1,10 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import lombok.NonNull; import java.util.Collection; @@ -36,7 +38,7 @@ import java.util.Map; } private BlockBucket blockToBucket(@NonNull final String block) { - final PlotBlock plotBlock = WorldUtil.IMP.getClosestBlock(block).best; + final BlockState plotBlock = WorldUtil.IMP.getClosestBlock(block).best; return BlockBucket.withSingle(plotBlock); } @@ -48,9 +50,9 @@ import java.util.Map; section.set(string, blocks.toString()); } - private BlockBucket blockListToBucket(@NonNull final PlotBlock[] blocks) { - final Map counts = new HashMap<>(); - for (final PlotBlock block : blocks) { + private BlockBucket blockListToBucket(@NonNull final BlockState[] blocks) { + final Map counts = new HashMap<>(); + for (final BlockState block : blocks) { counts.putIfAbsent(block, 0); counts.put(block, counts.get(block) + 1); } @@ -63,7 +65,7 @@ import java.util.Map; } final BlockBucket bucket = new BlockBucket(); if (includeRatios) { - for (final Map.Entry count : counts.entrySet()) { + for (final Map.Entry count : counts.entrySet()) { bucket.addBlock(count.getKey(), count.getValue()); } } else { @@ -72,9 +74,9 @@ import java.util.Map; return bucket; } - private PlotBlock[] splitBlockList(@NonNull final List list) { + private BlockState[] splitBlockList(@NonNull final List list) { return list.stream().map(s -> WorldUtil.IMP.getClosestBlock(s).best) - .toArray(PlotBlock[]::new); + .toArray(BlockState[]::new); } private void convertBlock(@NonNull final ConfigurationSection section, @@ -86,14 +88,14 @@ import java.util.Map; private void convertBlockList(@NonNull final ConfigurationSection section, @NonNull final String key, @NonNull final List blockList) { - final PlotBlock[] blocks = this.splitBlockList(blockList); + final BlockState[] blocks = this.splitBlockList(blockList); final BlockBucket bucket = this.blockListToBucket(blocks); this.setString(section, key, bucket); PlotSquared.log( Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString())); } - private String plotBlockArrayString(@NonNull final PlotBlock[] 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/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java deleted file mode 100644 index d79ad6653..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/LegacyMappings.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.util; - -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; - -public abstract class LegacyMappings { - - public abstract PlotBlock fromAny(final String string); - - public abstract PlotBlock fromLegacyToString(final int id, final int data); - - public abstract PlotBlock fromLegacyToString(final String id); - - public abstract PlotBlock fromStringToLegacy(final String id); - -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index af4b21e3c..e998c787d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Like; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java index 00ea391ba..c82000adc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MathMan.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class MathMan { private static final int ATAN2_BITS = 7; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java index c9a332bb9..8143a7588 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java index b3b1fd5a7..f881f95e6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotGameMode.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum PlotGameMode { NOT_SET(-1, ""), SURVIVAL(0, "survival"), CREATIVE(1, "creative"), ADVENTURE(2, "adventure"), SPECTATOR(3, "spectator"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java index 62ea9cc33..759f423c3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/PlotWeather.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public enum PlotWeather { RAIN, CLEAR, RESET } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java index 621766c17..64cce0b02 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ReflectionUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java index b9fc6ff09..56493658a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/RegExUtil.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java index 90a9b905f..7fa86c242 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SchematicHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.json.JSONArray; import com.github.intellectualsites.plotsquared.json.JSONException; import com.github.intellectualsites.plotsquared.plot.PlotSquared; @@ -19,7 +21,7 @@ import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; @@ -180,7 +182,7 @@ public abstract class SchematicHandler { return; } // block type and data arrays - final BlockArrayClipboard blockArrayClipboard = schematic.getClipboard(); + final Clipboard blockArrayClipboard = schematic.getClipboard(); // Calculate the optimal height to paste the schematic at final int y_offset_actual; if (autoHeight) { @@ -330,7 +332,7 @@ public abstract class SchematicHandler { ClipboardFormat format = ClipboardFormats.findByFile(file); if (format != null) { ClipboardReader reader = format.getReader(new FileInputStream(file)); - BlockArrayClipboard clip = (BlockArrayClipboard) reader.read(); + Clipboard clip = reader.read(); return new Schematic(clip); } else { throw new UnsupportedFormatException( @@ -357,13 +359,13 @@ public abstract class SchematicHandler { try { SpongeSchematicReader schematicReader = new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); + Clipboard clip = schematicReader.read(); return new Schematic(clip); } catch (IOException ignored) { try { MCEditSchematicReader schematicReader = new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is))); - BlockArrayClipboard clip = (BlockArrayClipboard) schematicReader.read(); + Clipboard clip = schematicReader.read(); return new Schematic(clip); } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java index b77d991fe..670e01798 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/SetupUtils.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.SetupObject; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java index dd6a1f960..f2a6cbde2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringComparison.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java index 047b4a71f..304f55b32 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/StringMan.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.jetbrains.annotations.NotNull; import java.lang.reflect.Array; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java index f6e86cd92..a558487c5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java index 9967e88eb..5fb4bfba7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java index b5e37ed93..927cc646c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java index 0ad79b41b..d3f35e4b7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UpdateUtility.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java index a503e1882..a82e50d9e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/WorldUtil.java @@ -1,9 +1,11 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -50,15 +52,15 @@ public abstract class WorldUtil { public abstract void saveWorld(String world); - public abstract String getClosestMatchingName(PlotBlock plotBlock); + public abstract String getClosestMatchingName(BlockState plotBlock); - public abstract boolean isBlockSolid(PlotBlock block); + public abstract boolean isBlockSolid(BlockState block); - public abstract StringComparison.ComparisonResult getClosestBlock(String name); + public abstract StringComparison.ComparisonResult getClosestBlock(String name); public abstract String getBiome(String world, int x, int z); - public abstract PlotBlock getBlock(Location location); + public abstract BlockState getBlock(Location location); public abstract int getHighestBlock(String world, int x, int z); @@ -161,5 +163,5 @@ public abstract class WorldUtil { return null; } - public abstract boolean isBlockSame(PlotBlock block1, PlotBlock block2); + public abstract boolean isBlockSame(BlockState block1, BlockState block2); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java index 133088a2e..212778ccd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/area/QuadMap.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.area; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; import java.util.HashSet; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index ad20a5b99..d524e2af9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -1,6 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MathMan; @@ -30,7 +32,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { public abstract LocalChunk getLocalChunk(int x, int z); - @Override public abstract PlotBlock getBlock(int x, int y, int z); + @Override public abstract BlockState getBlock(int x, int y, int z); public abstract void setComponents(LocalChunk lc) throws ExecutionException, InterruptedException; @@ -111,11 +113,11 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { return true; } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { - // Trying to mix PlotBlock and BaseBlock leads to all kinds of issues. - // Since BaseBlock has more features than PlotBlock, simply convert - // all PlotBlocks to BaseBlocks - return setBlock(x, y, z, id.getBaseBlock()); + @Override public boolean setBlock(int x, int y, int z, BlockState id) { + // Trying to mix BlockState and BaseBlock leads to all kinds of issues. + // Since BaseBlock has more features than BlockState, simply convert + // all BlockStates to BaseBlocks + return setBlock(x, y, z, id.toBaseBlock()); } @Override public final boolean setBiome(int x, int z, String biome) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java new file mode 100644 index 000000000..c83375edc --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BlockUtil.java @@ -0,0 +1,89 @@ +package com.github.intellectualsites.plotsquared.plot.util.block; + +import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerializable; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.internal.registry.InputParser; +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 com.sk89q.worldedit.world.block.FuzzyBlockState; +import com.sk89q.worldedit.world.registry.LegacyMapper; +import lombok.NonNull; + +import java.util.Map; + +public final class BlockUtil { + private BlockUtil(){} + + private static final ParserContext PARSER_CONTEXT = new ParserContext(); + + private static final InputParser PARSER; + + static { + PARSER_CONTEXT.setRestricted(false); + PARSER_CONTEXT.setPreferringWildcard(false); + PARSER_CONTEXT.setTryLegacy(true); + PARSER = WorldEdit.getInstance().getBlockFactory().getParsers().get(0); + } + + public static final BlockState get(int id) { + return LegacyMapper.getInstance().getBlockFromLegacy(id); + } + + public static final BlockState get(int id, int data) { + return LegacyMapper.getInstance().getBlockFromLegacy(id, data); + } + + public static final BlockState get(String id) { + if (id.length() == 1 && id.charAt(0) == '*') { + return FuzzyBlockState.builder().type(BlockTypes.AIR).build(); + } + BlockType type = BlockType.REGISTRY.get(id); + if (type != null) { + return type.getDefaultState(); + } + if (Character.isDigit(id.charAt(0))) { + String[] split = id.split(":"); + if (MathMan.isInteger(split[0])) { + if (split.length == 2) { + if (MathMan.isInteger(split[1])) { + return get(Integer.parseInt(split[0]), Integer.parseInt(split[1])); + } + } else { + return get(Integer.parseInt(split[0])); + } + } + } + try { + BaseBlock block = PARSER.parseFromInput(id, PARSER_CONTEXT); + return block.toImmutableState(); + } catch (InputParseException e) { + e.printStackTrace(); + return null; + } + } + + public static final BlockState[] parse(String commaDelimited) { + String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])"); + BlockState[] result = new BlockState[split.length]; + for (int i = 0; i < split.length; i++) { + result[i] = get(split[i]); + } + return result; + } + + public static BlockState deserialize(@NonNull final Map map) { + if (map.containsKey("material")) { + final Object object = map.get("material"); + return get(object.toString()); + } + return null; + } + +} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java index c5c17b4a4..61e08a208 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/DelegateLocalBlockQueue.java @@ -1,6 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.util.block; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BaseBlock; public class DelegateLocalBlockQueue extends LocalBlockQueue { @@ -62,11 +64,11 @@ public class DelegateLocalBlockQueue extends LocalBlockQueue { return parent.setBlock(x, y, z, id); } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { return parent.setBlock(x, y, z, id); } - @Override public PlotBlock getBlock(int x, int y, int z) { + @Override public BlockState getBlock(int x, int y, int z) { return parent.getBlock(x, y, z); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java index 049b13d32..3aadb6ebf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/GlobalBlockQueue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java new file mode 100644 index 000000000..243d098ab --- /dev/null +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ItemUtil.java @@ -0,0 +1,30 @@ +package com.github.intellectualsites.plotsquared.plot.util.block; + +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; + +import java.util.Locale; + +public final class ItemUtil { + private ItemUtil(){} + + public static ItemType get(String input) { + input = input.toLowerCase(Locale.ROOT); + if (Character.isDigit(input.charAt(0))) { + String[] split = input.split(":"); + if (MathMan.isInteger(split[0])) { + if (split.length == 2) { + if (MathMan.isInteger(split[1])) { + return LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1])); + } + } else { + return LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0])); + } + } + } + if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input; + return ItemTypes.get(input); + } +} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java index 1ce8ccd11..8fc6011e2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java @@ -1,8 +1,10 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -53,7 +55,7 @@ public abstract class LocalBlockQueue { * @param z the z coordinate from 0 to 15 inclusive * @param id the id to set the block to */ - public abstract boolean setBlock(final int x, final int y, final int z, final PlotBlock id); + public abstract boolean setBlock(final int x, final int y, final int z, final BlockState id); public abstract boolean setBlock(final int x, final int y, final int z, final BaseBlock id); @@ -62,7 +64,7 @@ public abstract class LocalBlockQueue { return true; } - public abstract PlotBlock getBlock(int x, int y, int z); + public abstract BlockState getBlock(int x, int y, int z); public abstract boolean setBiome(int x, int z, String biome); @@ -100,7 +102,7 @@ public abstract class LocalBlockQueue { return GlobalBlockQueue.IMP.enqueue(this); } - public void setCuboid(Location pos1, Location pos2, PlotBlock block) { + public void setCuboid(Location pos1, Location pos2, BlockState block) { int yMin = Math.min(pos1.getY(), pos2.getY()); int yMax = Math.min(255, Math.max(pos1.getY(), pos2.getY())); int xMin = Math.min(pos1.getX(), pos2.getX()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java index d0a561111..075865ff5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/OffsetLocalBlockQueue.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.sk89q.worldedit.world.block.BaseBlock; public class OffsetLocalBlockQueue extends DelegateLocalBlockQueue { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java index 3c96e0d5f..aebe4707d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/QueueProvider.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public abstract class QueueProvider { public static QueueProvider of(final Class primary, final Class fallback) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java index 7e41887ed..0c404c548 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/ScopedLocalBlockQueue.java @@ -1,10 +1,12 @@ package com.github.intellectualsites.plotsquared.plot.util.block; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.sk89q.worldedit.world.block.BaseBlock; @@ -55,7 +57,7 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { .setBlock(x + minX, y + minY, z + minZ, id); } - @Override public boolean setBlock(int x, int y, int z, PlotBlock id) { + @Override public boolean setBlock(int x, int y, int z, BlockState id) { return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super .setBlock(x + minX, y + minY, z + minZ, id); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java index dbd9773f0..906b15247 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java index ab95068da..95f4067f2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpirySettings.java @@ -1,4 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + public class ExpirySettings { } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java index e959948b4..3e1c964dd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpiryTask.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java index 484759d66..4f18151cc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/PlotAnalysis.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.expiry; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java index c10d9507b..1733d93b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpMenu.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java index 9981dd0f1..01c8e5f29 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java index 5b165d32a..c701b2b9b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util.helpmenu; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.commands.CommandCaller; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.config.Captions; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java index c2a0af542..58f0ed56b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/uuid/UUIDWrapper.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.uuid; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import org.jetbrains.annotations.NotNull; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java index c2b81a729..4b94e58a2 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/FlagTest.java @@ -1,20 +1,24 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.AbstractDBTest; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.EventUtilTest; +import com.sk89q.worldedit.world.block.BlockType; import org.junit.Before; import org.junit.Test; import java.util.Collection; import java.util.HashSet; import java.util.Optional; +import java.util.Set; import java.util.UUID; import static org.junit.Assert.assertEquals; @@ -36,13 +40,13 @@ public class FlagTest { Optional flag = plot.getFlag(use); if (flag.isPresent()) { System.out.println(Flags.USE.valueToString(flag.get())); - testBlock = PlotBlock.get((short) 1, (byte) 0); + testBlock = BlockUtil.get((short) 1, (byte) 0); flag.get().add(testBlock); } flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection))); - Optional> flag2 = plot.getFlag(Flags.USE); + Optional> flag2 = plot.getFlag(Flags.USE); if (flag2.isPresent()) { - // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); + // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); } if (flag.isPresent() && flag2.isPresent()) { assertEquals(flag.get(), flag2.get()); diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java index 069c886da..d5570365f 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.junit.Test; public class PlotVersionTest { diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java index a2cc07d1b..37e7d8ba6 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.database; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java index a421137c0..da13420fa 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/object/LocationTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import org.junit.Test; import java.util.logging.Logger; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java index fd2a8db15..f5cfba022 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/EventUtilTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java index 58e43ff65..15b6ded37 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java @@ -1,5 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.util; +import com.github.intellectualsites.plotsquared.plot.util.block.BlockUtil; + import com.github.intellectualsites.plotsquared.plot.database.AbstractDBTest; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; diff --git a/build.gradle b/build.gradle index 667ba16f8..99e3b3d1c 100644 --- a/build.gradle +++ b/build.gradle @@ -48,6 +48,14 @@ version = String.format("%s.%s", rootVersion, buildNumber) description = rootProject.name +allprojects { + gradle.projectsEvaluated { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xmaxerrs" << "1000" + } + } +} + subprojects { apply(plugin: "java") apply(plugin: "maven")