From 3d5ee7b5719eb4b53874e5f07412332d2c1cd894 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 13 Nov 2015 19:12:55 -0500 Subject: [PATCH] Gradle-ize. Prep for Sponge. Old Bukkit code can still be found in the worldguard-legacy folder and built with `gradle worldguard-legacy:build`. Hopefully nothing got lost in the gradle-ization. --- .gitignore | 4 + build.gradle | 131 ++ config/checkstyle/checkstyle.xml | 64 + config/checkstyle/header.txt | 4 +- config/checkstyle/import-control.xml | 53 +- gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 51017 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 164 ++ gradlew.bat | 90 + settings.gradle | 3 + worldguard-core/build.gradle | 23 + worldguard-core/worldguard-core.iml | 33 + worldguard-legacy/build.gradle | 42 + .../config}/assembly/default.xml | 0 .../config/checkstyle/header.txt | 18 + .../config/checkstyle/import-control.xml | 41 + .../config}/markdown/footer.html | 0 .../config}/markdown/header.html | 0 .../contrib}/blacklist_table.sql | 0 .../region_manual_update_20110325.sql | 0 .../defaults}/blacklist.txt | 128 +- .../defaults}/config.yml | 42 +- .../defaults}/config_world.yml | 40 +- .../migrations/region/mysql/V1__Initial.sql | 0 .../region/mysql/V2__Bug_fix_and_UUID.sql | 0 .../migrations/region/sqlite/V1__Initial.sql | 0 .../defaults}/plugin.yml | 8 +- pom.xml => worldguard-legacy/pom.xml | 0 .../com/sk89q/worldguard/LocalPlayer.java | 244 +- .../sk89q/worldguard/blacklist/Blacklist.java | 0 .../worldguard/blacklist/BlacklistEntry.java | 0 .../blacklist/BlacklistLoggerHandler.java | 0 .../worldguard/blacklist/MatcherIndex.java | 0 .../worldguard/blacklist/TrackedEvent.java | 0 .../worldguard/blacklist/action/Action.java | 0 .../blacklist/action/ActionResult.java | 0 .../blacklist/action/ActionType.java | 0 .../blacklist/action/AllowAction.java | 0 .../blacklist/action/BanAction.java | 0 .../blacklist/action/DenyAction.java | 0 .../blacklist/action/KickAction.java | 0 .../blacklist/action/LogAction.java | 0 .../blacklist/action/NotifyAction.java | 0 .../blacklist/action/RepeatGuardedAction.java | 0 .../blacklist/action/TellAction.java | 0 .../event/AbstractBlacklistEvent.java | 0 .../blacklist/event/BlacklistEvent.java | 0 .../blacklist/event/BlockBlacklistEvent.java | 0 .../event/BlockBreakBlacklistEvent.java | 0 .../event/BlockDispenseBlacklistEvent.java | 0 .../event/BlockInteractBlacklistEvent.java | 0 .../event/BlockPlaceBlacklistEvent.java | 0 .../worldguard/blacklist/event/EventType.java | 0 .../event/ItemAcquireBlacklistEvent.java | 0 .../blacklist/event/ItemBlacklistEvent.java | 0 .../event/ItemDestroyWithBlacklistEvent.java | 0 .../event/ItemDropBlacklistEvent.java | 0 .../event/ItemUseBlacklistEvent.java | 0 .../blacklist/logger/ConsoleHandler.java | 0 .../blacklist/logger/DatabaseHandler.java | 0 .../blacklist/logger/FileHandler.java | 0 .../blacklist/logger/LogFileWriter.java | 0 .../blacklist/logger/LoggerHandler.java | 0 .../worldguard/blacklist/target/DataMask.java | 0 .../target/DataValueRangeMatcher.java | 0 .../blacklist/target/MaterialTarget.java | 0 .../blacklist/target/RangeMask.java | 0 .../worldguard/blacklist/target/Target.java | 0 .../blacklist/target/TargetMatcher.java | 0 .../target/TargetMatcherParseException.java | 0 .../blacklist/target/TargetMatcherParser.java | 0 .../blacklist/target/WildcardDataMatcher.java | 0 .../bukkit/BukkitOfflinePlayer.java | 0 .../sk89q/worldguard/bukkit/BukkitPlayer.java | 222 +- .../sk89q/worldguard/bukkit/BukkitUtil.java | 816 +++---- .../bukkit/ConfigurationManager.java | 0 .../worldguard/bukkit/ProtectionQuery.java | 0 .../sk89q/worldguard/bukkit/QueryCache.java | 0 .../worldguard/bukkit/RegionContainer.java | 0 .../sk89q/worldguard/bukkit/RegionQuery.java | 0 .../com/sk89q/worldguard/bukkit/WGBukkit.java | 0 .../worldguard/bukkit/WorldConfiguration.java | 0 .../worldguard/bukkit/WorldGuardPlugin.java | 2032 ++++++++--------- .../sk89q/worldguard/bukkit/cause/Cause.java | 0 .../bukkit/commands/AsyncCommandHelper.java | 0 .../bukkit/commands/CommandUtils.java | 0 .../bukkit/commands/DebuggingCommands.java | 0 .../commands/FutureProgressListener.java | 0 .../bukkit/commands/GeneralCommands.java | 622 ++--- .../commands/MessageFutureCallback.java | 0 .../bukkit/commands/MessageTimerTask.java | 0 .../bukkit/commands/ProtectionCommands.java | 92 +- .../bukkit/commands/ToggleCommands.java | 330 +-- .../bukkit/commands/WorldGuardCommands.java | 592 ++--- .../commands/region/MemberCommands.java | 0 .../commands/region/RegionCommands.java | 0 .../commands/region/RegionCommandsBase.java | 0 .../region/RegionPrintoutBuilder.java | 0 .../bukkit/commands/task/RegionAdder.java | 0 .../bukkit/commands/task/RegionLister.java | 0 .../commands/task/RegionManagerReloader.java | 0 .../commands/task/RegionManagerSaver.java | 0 .../bukkit/commands/task/RegionRemover.java | 0 .../worldguard/bukkit/event/BulkEvent.java | 0 .../bukkit/event/DelegateEvent.java | 0 .../bukkit/event/DelegateEvents.java | 0 .../worldguard/bukkit/event/Handleable.java | 0 .../event/block/AbstractBlockEvent.java | 0 .../bukkit/event/block/BreakBlockEvent.java | 0 .../bukkit/event/block/PlaceBlockEvent.java | 0 .../bukkit/event/block/UseBlockEvent.java | 0 .../bukkit/event/debug/CancelAttempt.java | 0 .../bukkit/event/debug/CancelLogger.java | 0 .../bukkit/event/debug/CancelLogging.java | 0 .../event/debug/LoggingBlockBreakEvent.java | 0 .../event/debug/LoggingBlockPlaceEvent.java | 0 .../LoggingEntityDamageByEntityEvent.java | 0 .../debug/LoggingPlayerInteractEvent.java | 0 .../event/entity/AbstractEntityEvent.java | 0 .../event/entity/DamageEntityEvent.java | 0 .../event/entity/DestroyEntityEvent.java | 0 .../bukkit/event/entity/SpawnEntityEvent.java | 0 .../bukkit/event/entity/UseEntityEvent.java | 0 .../bukkit/event/inventory/UseItemEvent.java | 0 .../event/player/ProcessPlayerEvent.java | 0 .../bukkit/internal/BukkitBlacklist.java | 0 .../bukkit/internal/TargetMatcherSet.java | 0 .../bukkit/internal/WGMetadata.java | 0 .../bukkit/listener/AbstractListener.java | 0 .../bukkit/listener/BlacklistListener.java | 0 .../listener/BlockStateAsBlockFunction.java | 0 .../listener/BlockedPotionsListener.java | 0 .../listener/BuildPermissionListener.java | 0 .../listener/ChestProtectionListener.java | 0 .../bukkit/listener/DebuggingListener.java | 0 .../listener/EventAbstractionListener.java | 0 .../listener/InvincibilityListener.java | 0 .../bukkit/listener/PlayerModesListener.java | 0 .../bukkit/listener/PlayerMoveListener.java | 0 .../bukkit/listener/RegionFlagsListener.java | 0 .../listener/RegionProtectionListener.java | 0 .../bukkit/listener/SpongeUtil.java | 0 .../listener/WorldGuardBlockListener.java | 0 .../WorldGuardCommandBookListener.java | 0 .../listener/WorldGuardEntityListener.java | 0 .../listener/WorldGuardHangingListener.java | 0 .../listener/WorldGuardPlayerListener.java | 0 .../listener/WorldGuardServerListener.java | 0 .../listener/WorldGuardVehicleListener.java | 0 .../listener/WorldGuardWeatherListener.java | 0 .../listener/WorldGuardWorldListener.java | 0 .../bukkit/listener/WorldRulesListener.java | 0 .../listener/debounce/BlockBlockPair.java | 0 .../listener/debounce/BlockMaterialPair.java | 0 .../debounce/BlockPistonExtendKey.java | 0 .../debounce/BlockPistonRetractKey.java | 0 .../listener/debounce/EventDebounce.java | 0 .../legacy/AbstractEventDebounce.java | 0 .../legacy/BlockEntityEventDebounce.java | 0 .../legacy/EntityEntityEventDebounce.java | 0 .../InventoryMoveItemEventDebounce.java | 0 .../permission/AbstractPermissionModel.java | 0 .../permission/RegionPermissionModel.java | 0 .../DelayedRegionOverlapAssociation.java | 0 .../sk89q/worldguard/bukkit/util/Blocks.java | 0 .../worldguard/bukkit/util/Entities.java | 0 .../sk89q/worldguard/bukkit/util/Events.java | 0 .../worldguard/bukkit/util/HandlerTracer.java | 0 .../worldguard/bukkit/util/InteropUtils.java | 0 .../worldguard/bukkit/util/Locations.java | 0 .../worldguard/bukkit/util/Materials.java | 0 .../util/logging/LoggerToChatHandler.java | 0 .../bukkit/util/report/ConfigReport.java | 0 .../bukkit/util/report/PerformanceReport.java | 0 .../bukkit/util/report/PluginReport.java | 0 .../bukkit/util/report/SchedulerReport.java | 0 .../bukkit/util/report/ServerReport.java | 0 .../bukkit/util/report/ServicesReport.java | 0 .../bukkit/util/report/WorldReport.java | 0 .../worldguard/chest/ChestProtection.java | 152 +- .../worldguard/chest/SignChestProtection.java | 318 +-- .../sk89q/worldguard/domains/Association.java | 0 .../worldguard/domains/DefaultDomain.java | 742 +++--- .../com/sk89q/worldguard/domains/Domain.java | 146 +- .../worldguard/domains/DomainCollection.java | 182 +- .../sk89q/worldguard/domains/GroupDomain.java | 302 +-- .../worldguard/domains/PlayerDomain.java | 420 ++-- .../worldguard/internal/PermissionModel.java | 0 .../internal/util/sql/StatementUtils.java | 0 .../protection/AbstractRegionSet.java | 0 .../protection/ApplicableRegionSet.java | 488 ++-- .../protection/FailedLoadRegionSet.java | 0 .../protection/FlagValueCalculator.java | 0 .../protection/GlobalRegionManager.java | 0 .../protection/PermissiveRegionSet.java | 0 .../protection/RegionResultSet.java | 0 .../UnsupportedIntersectionException.java | 60 +- .../protection/association/Associables.java | 0 .../association/ConstantAssociation.java | 0 .../association/RegionAssociable.java | 0 .../association/RegionOverlapAssociation.java | 0 .../protection/events/DisallowedPVPEvent.java | 162 +- .../protection/flags/BooleanFlag.java | 140 +- .../protection/flags/BuildFlag.java | 0 .../protection/flags/CommandStringFlag.java | 124 +- .../protection/flags/DefaultFlag.java | 0 .../protection/flags/DoubleFlag.java | 0 .../protection/flags/EntityTypeFlag.java | 106 +- .../worldguard/protection/flags/EnumFlag.java | 208 +- .../worldguard/protection/flags/Flag.java | 0 .../protection/flags/IntegerFlag.java | 0 .../protection/flags/InvalidFlagFormat.java | 58 +- .../protection/flags/LazyLocation.java | 0 .../protection/flags/LocationFlag.java | 0 .../protection/flags/RegionGroup.java | 0 .../protection/flags/RegionGroupFlag.java | 0 .../worldguard/protection/flags/SetFlag.java | 204 +- .../protection/flags/StateFlag.java | 0 .../protection/flags/StringFlag.java | 0 .../protection/flags/VectorFlag.java | 0 .../managers/RegionContainerImpl.java | 0 .../protection/managers/RegionDifference.java | 0 .../protection/managers/RegionManager.java | 0 .../protection/managers/RemovalStrategy.java | 0 .../managers/index/AbstractRegionIndex.java | 0 .../managers/index/ChunkHashTable.java | 0 .../managers/index/ConcurrentRegionIndex.java | 0 .../managers/index/HashMapIndex.java | 0 .../managers/index/PriorityRTreeIndex.java | 0 .../managers/index/RegionIndex.java | 0 .../managers/migration/AbstractMigration.java | 0 .../managers/migration/DriverMigration.java | 0 .../managers/migration/Migration.java | 0 .../migration/MigrationException.java | 0 .../managers/migration/UUIDMigration.java | 0 .../storage/DifferenceSaveException.java | 0 .../managers/storage/DriverType.java | 0 .../storage/MemoryRegionDatabase.java | 0 .../managers/storage/RegionDatabase.java | 0 .../managers/storage/RegionDatabaseUtils.java | 0 .../managers/storage/RegionDriver.java | 0 .../managers/storage/StorageException.java | 0 .../storage/file/DirectoryYamlDriver.java | 0 .../managers/storage/file/YamlRegionFile.java | 0 .../managers/storage/sql/DataLoader.java | 0 .../managers/storage/sql/DataUpdater.java | 0 .../storage/sql/DomainTableCache.java | 0 .../managers/storage/sql/RegionInserter.java | 0 .../managers/storage/sql/RegionRemover.java | 0 .../managers/storage/sql/RegionUpdater.java | 0 .../managers/storage/sql/SQLDriver.java | 0 .../storage/sql/SQLRegionDatabase.java | 0 .../managers/storage/sql/StatementBatch.java | 0 .../managers/storage/sql/TableCache.java | 0 .../regions/GlobalProtectedRegion.java | 184 +- .../regions/ProtectedCuboidRegion.java | 0 .../regions/ProtectedPolygonalRegion.java | 0 .../protection/regions/ProtectedRegion.java | 0 .../regions/ProtectedRegionMBRConverter.java | 0 .../protection/regions/RegionType.java | 0 .../protection/util/DomainInputResolver.java | 0 .../protection/util/NormativeOrders.java | 0 .../util/RegionCollectionConsumer.java | 0 .../util/UnresolvedNamesException.java | 0 .../sk89q/worldguard/session/MoveType.java | 0 .../com/sk89q/worldguard/session/Session.java | 0 .../worldguard/session/SessionManager.java | 0 .../worldguard/session/WorldPlayerTuple.java | 0 .../worldguard/session/handler/EntryFlag.java | 0 .../worldguard/session/handler/ExitFlag.java | 0 .../session/handler/FarewellFlag.java | 0 .../worldguard/session/handler/FeedFlag.java | 0 .../handler/FlagValueChangeHandler.java | 0 .../session/handler/GameModeFlag.java | 0 .../worldguard/session/handler/GodMode.java | 0 .../session/handler/GreetingFlag.java | 0 .../worldguard/session/handler/Handler.java | 0 .../worldguard/session/handler/HealFlag.java | 0 .../session/handler/InvincibilityFlag.java | 0 .../session/handler/NotifyEntryFlag.java | 0 .../session/handler/NotifyExitFlag.java | 0 .../session/handler/TimeLockFlag.java | 0 .../session/handler/WaterBreathing.java | 0 .../session/handler/WeatherLockFlag.java | 0 .../sk89q/worldguard/util/ChangeTracked.java | 0 .../java/com/sk89q/worldguard/util/Enums.java | 0 .../com/sk89q/worldguard/util/MathUtils.java | 0 .../com/sk89q/worldguard/util/Normal.java | 0 .../worldguard/util/collect/EntryBase.java | 0 .../util/collect/LongBaseHashTable.java | 0 .../worldguard/util/collect/LongHash.java | 0 .../worldguard/util/collect/LongHashSet.java | 0 .../util/collect/LongHashTable.java | 0 .../util/command/CommandFilter.java | 0 .../util/concurrent/EvenMoreExecutors.java | 0 .../com/sk89q/worldguard/util/io/Closer.java | 0 .../util/logging/ClassSourceValidator.java | 0 .../util/logging/RecordMessagePrefixer.java | 0 .../worldguard/util/net/HttpRequest.java | 0 .../worldguard/util/paste/EngineHubPaste.java | 0 .../sk89q/worldguard/util/paste/Pastebin.java | 0 .../sk89q/worldguard/util/paste/Paster.java | 0 .../sk89q/worldguard/util/paste/Pasters.java | 0 .../util/profiler/SamplerBuilder.java | 0 .../worldguard/util/profiler/StackNode.java | 0 .../util/profiler/StackTraceNode.java | 0 .../util/profiler/ThreadIdFilter.java | 0 .../util/profiler/ThreadNameFilter.java | 0 .../worldguard/util/report/CancelReport.java | 0 .../worldguard/util/report/DataReport.java | 0 .../worldguard/util/report/RegionReport.java | 0 .../sk89q/worldguard/util/report/Report.java | 0 .../worldguard/util/report/ReportList.java | 0 .../util/report/ShallowObjectReport.java | 0 .../util/report/StackTraceReport.java | 0 .../util/report/SystemInfoReport.java | 0 .../worldguard/util/report/Unreported.java | 0 .../worldguard/util/sql/DataSourceConfig.java | 0 .../worldguard/util/task/AbstractTask.java | 0 .../util/task/FutureForwardingTask.java | 0 .../util/task/SimpleSupervisor.java | 0 .../worldguard/util/task/Supervisor.java | 0 .../com/sk89q/worldguard/util/task/Task.java | 0 .../util/task/TaskStateComparator.java | 0 .../util/task/progress/Progress.java | 0 .../util/task/progress/ProgressIterator.java | 0 .../task/progress/ProgressObservable.java | 0 .../src/main/resources/defaults/blacklist.txt | 65 + .../src/main/resources/defaults/config.yml | 22 + .../main/resources/defaults/config_world.yml | 21 + .../migrations/region/mysql/V1__Initial.sql | 212 ++ .../region/mysql/V2__Bug_fix_and_UUID.sql | 27 + .../migrations/region/sqlite/V1__Initial.sql | 160 ++ .../src/main/resources/plugin.yml | 4 + .../java/com/sk89q/worldguard/TestPlayer.java | 174 +- .../worldguard/domains/DefaultDomainTest.java | 0 .../protection/ApplicableRegionSetTest.java | 1282 +++++------ .../protection/FlagValueCalculatorTest.java | 0 .../protection/HashMapIndexPriorityTest.java | 0 .../HashMapIndexRegionOverlapTest.java | 0 .../protection/HashMapIndexTest.java | 0 .../protection/MockApplicableRegionSet.java | 198 +- .../protection/PriorityRTreeIndexTest.java | 0 .../PriorityRTreeRegionEntryExitTest.java | 0 .../PriorityRTreeRegionOverlapTest.java | 0 .../PriorityRTreeRegionPriorityTest.java | 0 .../protection/RegionEntryExitTest.java | 0 .../protection/RegionOverlapTest.java | 362 +-- .../protection/RegionPriorityTest.java | 320 +-- .../regions/RegionIntersectTest.java | 0 .../worldguard/util/CommandFilterTest.java | 0 worldguard-legacy/worldguard-legacy.iml | 47 + worldguard-sponge/build.gradle | 16 + worldguard-sponge/worldguard-sponge.iml | 38 + 354 files changed, 7006 insertions(+), 5782 deletions(-) create mode 100644 build.gradle create mode 100644 config/checkstyle/checkstyle.xml create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle create mode 100644 worldguard-core/build.gradle create mode 100644 worldguard-core/worldguard-core.iml create mode 100644 worldguard-legacy/build.gradle rename {config => worldguard-legacy/config}/assembly/default.xml (100%) create mode 100644 worldguard-legacy/config/checkstyle/header.txt create mode 100644 worldguard-legacy/config/checkstyle/import-control.xml rename {config => worldguard-legacy/config}/markdown/footer.html (100%) rename {config => worldguard-legacy/config}/markdown/header.html (100%) rename {contrib => worldguard-legacy/contrib}/blacklist_table.sql (100%) rename {contrib => worldguard-legacy/contrib}/region_manual_update_20110325.sql (100%) rename {src/main/resources => worldguard-legacy/defaults}/blacklist.txt (97%) rename {src/main/resources => worldguard-legacy/defaults}/config.yml (97%) rename {src/main/resources => worldguard-legacy/defaults}/config_world.yml (97%) rename {src/main/resources => worldguard-legacy/defaults}/migrations/region/mysql/V1__Initial.sql (100%) rename {src/main/resources => worldguard-legacy/defaults}/migrations/region/mysql/V2__Bug_fix_and_UUID.sql (100%) rename {src/main/resources => worldguard-legacy/defaults}/migrations/region/sqlite/V1__Initial.sql (100%) rename {src/main/resources => worldguard-legacy/defaults}/plugin.yml (97%) rename pom.xml => worldguard-legacy/pom.xml (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/LocalPlayer.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/Blacklist.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/BlacklistEntry.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/BlacklistLoggerHandler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/MatcherIndex.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/TrackedEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/Action.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/ActionResult.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/ActionType.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/AllowAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/BanAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/DenyAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/KickAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/LogAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/NotifyAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/RepeatGuardedAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/action/TellAction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/AbstractBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/BlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/BlockBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/BlockBreakBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/BlockDispenseBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/BlockInteractBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/BlockPlaceBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/EventType.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/ItemAcquireBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/ItemBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/ItemDestroyWithBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/ItemDropBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/event/ItemUseBlacklistEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/logger/ConsoleHandler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/logger/DatabaseHandler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/logger/FileHandler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/logger/LogFileWriter.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/logger/LoggerHandler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/DataMask.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/DataValueRangeMatcher.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/MaterialTarget.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/RangeMask.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/Target.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcher.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParseException.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParser.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/blacklist/target/WildcardDataMatcher.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/BukkitOfflinePlayer.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/BukkitPlayer.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/ConfigurationManager.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/ProtectionQuery.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/QueryCache.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/RegionContainer.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/RegionQuery.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/WGBukkit.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/AsyncCommandHelper.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/CommandUtils.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/DebuggingCommands.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/FutureProgressListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/MessageFutureCallback.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/MessageTimerTask.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/ProtectionCommands.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/ToggleCommands.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/region/MemberCommands.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommands.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommandsBase.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionPrintoutBuilder.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionAdder.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionLister.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerReloader.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerSaver.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionRemover.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/BulkEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvents.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/Handleable.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/block/AbstractBlockEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/block/BreakBlockEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/block/PlaceBlockEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/block/UseBlockEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelAttempt.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogger.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogging.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockBreakEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockPlaceEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingEntityDamageByEntityEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingPlayerInteractEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/entity/AbstractEntityEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/entity/DamageEntityEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/entity/DestroyEntityEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/entity/SpawnEntityEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/entity/UseEntityEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/inventory/UseItemEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/event/player/ProcessPlayerEvent.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/internal/BukkitBlacklist.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/internal/TargetMatcherSet.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/internal/WGMetadata.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/AbstractListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/BlacklistListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/BlockStateAsBlockFunction.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/BlockedPotionsListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/BuildPermissionListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/ChestProtectionListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/DebuggingListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/InvincibilityListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/PlayerModesListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/PlayerMoveListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/RegionFlagsListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/SpongeUtil.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardCommandBookListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardEntityListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardHangingListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardServerListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardVehicleListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWeatherListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWorldListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/WorldRulesListener.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockBlockPair.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockMaterialPair.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonExtendKey.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonRetractKey.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/EventDebounce.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/AbstractEventDebounce.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/BlockEntityEventDebounce.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/EntityEntityEventDebounce.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/InventoryMoveItemEventDebounce.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/permission/AbstractPermissionModel.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/permission/RegionPermissionModel.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/protection/DelayedRegionOverlapAssociation.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/Blocks.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/Entities.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/Events.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/HandlerTracer.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/InteropUtils.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/Locations.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/Materials.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/logging/LoggerToChatHandler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/report/ConfigReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/report/PerformanceReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/report/PluginReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/report/SchedulerReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/report/ServicesReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/bukkit/util/report/WorldReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/chest/ChestProtection.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/chest/SignChestProtection.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/domains/Association.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/domains/DefaultDomain.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/domains/Domain.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/domains/DomainCollection.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/domains/GroupDomain.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/domains/PlayerDomain.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/internal/PermissionModel.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/internal/util/sql/StatementUtils.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/AbstractRegionSet.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/FailedLoadRegionSet.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/FlagValueCalculator.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/PermissiveRegionSet.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/RegionResultSet.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/UnsupportedIntersectionException.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/association/Associables.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/association/ConstantAssociation.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/association/RegionAssociable.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/association/RegionOverlapAssociation.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/events/DisallowedPVPEvent.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/BooleanFlag.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/BuildFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/CommandStringFlag.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/DoubleFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/EntityTypeFlag.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/EnumFlag.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/Flag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/IntegerFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/InvalidFlagFormat.java (97%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/LazyLocation.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/RegionGroup.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/SetFlag.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/StateFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/StringFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/flags/VectorFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/RegionContainerImpl.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/RegionDifference.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/RegionManager.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/RemovalStrategy.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/index/AbstractRegionIndex.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/index/ChunkHashTable.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/index/ConcurrentRegionIndex.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/index/HashMapIndex.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/index/PriorityRTreeIndex.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/index/RegionIndex.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/migration/AbstractMigration.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/migration/DriverMigration.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/migration/Migration.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/migration/MigrationException.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/migration/UUIDMigration.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/DifferenceSaveException.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/DriverType.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/MemoryRegionDatabase.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabase.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabaseUtils.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDriver.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/StorageException.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/file/DirectoryYamlDriver.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataLoader.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataUpdater.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DomainTableCache.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionInserter.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionRemover.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionUpdater.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLDriver.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLRegionDatabase.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/StatementBatch.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/managers/storage/sql/TableCache.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java (96%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/regions/ProtectedCuboidRegion.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/regions/ProtectedPolygonalRegion.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegionMBRConverter.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/regions/RegionType.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/util/DomainInputResolver.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/util/NormativeOrders.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/util/RegionCollectionConsumer.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/protection/util/UnresolvedNamesException.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/MoveType.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/Session.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/SessionManager.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/WorldPlayerTuple.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/EntryFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/ExitFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/FarewellFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/FeedFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/GameModeFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/GodMode.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/GreetingFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/Handler.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/HealFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/InvincibilityFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/NotifyEntryFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/NotifyExitFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/TimeLockFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/WaterBreathing.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/session/handler/WeatherLockFlag.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/ChangeTracked.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/Enums.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/MathUtils.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/Normal.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/collect/EntryBase.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/collect/LongBaseHashTable.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/collect/LongHash.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/collect/LongHashSet.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/collect/LongHashTable.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/command/CommandFilter.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/concurrent/EvenMoreExecutors.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/io/Closer.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/logging/ClassSourceValidator.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/logging/RecordMessagePrefixer.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/net/HttpRequest.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/paste/EngineHubPaste.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/paste/Pastebin.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/paste/Paster.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/paste/Pasters.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/profiler/SamplerBuilder.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/profiler/StackNode.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/profiler/StackTraceNode.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/profiler/ThreadIdFilter.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/profiler/ThreadNameFilter.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/CancelReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/DataReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/RegionReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/Report.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/ReportList.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/ShallowObjectReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/StackTraceReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/SystemInfoReport.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/report/Unreported.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/sql/DataSourceConfig.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/AbstractTask.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/FutureForwardingTask.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/SimpleSupervisor.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/Supervisor.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/Task.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/TaskStateComparator.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/progress/Progress.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/progress/ProgressIterator.java (100%) rename {src => worldguard-legacy/src}/main/java/com/sk89q/worldguard/util/task/progress/ProgressObservable.java (100%) create mode 100644 worldguard-legacy/src/main/resources/defaults/blacklist.txt create mode 100644 worldguard-legacy/src/main/resources/defaults/config.yml create mode 100644 worldguard-legacy/src/main/resources/defaults/config_world.yml create mode 100644 worldguard-legacy/src/main/resources/migrations/region/mysql/V1__Initial.sql create mode 100644 worldguard-legacy/src/main/resources/migrations/region/mysql/V2__Bug_fix_and_UUID.sql create mode 100644 worldguard-legacy/src/main/resources/migrations/region/sqlite/V1__Initial.sql create mode 100644 worldguard-legacy/src/main/resources/plugin.yml rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/TestPlayer.java (96%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/domains/DefaultDomainTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/ApplicableRegionSetTest.java (97%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/FlagValueCalculatorTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/HashMapIndexPriorityTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/HashMapIndexRegionOverlapTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/HashMapIndexTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java (97%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/PriorityRTreeIndexTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionEntryExitTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionOverlapTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionPriorityTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/RegionEntryExitTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java (97%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java (97%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/protection/regions/RegionIntersectTest.java (100%) rename {src => worldguard-legacy/src}/test/java/com/sk89q/worldguard/util/CommandFilterTest.java (100%) create mode 100644 worldguard-legacy/worldguard-legacy.iml create mode 100644 worldguard-sponge/build.gradle create mode 100644 worldguard-sponge/worldguard-sponge.iml diff --git a/.gitignore b/.gitignore index 9e3c43b2..8f30c6e0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /target .DS_Store + /*.iml /.idea @@ -11,3 +12,6 @@ /dependency-reduced-pom.xml *-private.sh +/.gradle +**/build + diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..7103b3f3 --- /dev/null +++ b/build.gradle @@ -0,0 +1,131 @@ +println """ +******************************************* + You are building WorldGuard! + + If you encounter trouble: + 1) Read COMPILING.md if you haven't yet + 2) Try running 'build' in a separate Gradle run + 3) Use gradlew and not gradle + 4) If you still need help, ask on IRC! irc.esper.net #sk89q + + Output files will be in [subproject]/build/libs +******************************************* +""" + +buildscript { + repositories { + mavenCentral() + maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } + jcenter() + } + + configurations.all { + resolutionStrategy { + force 'com.google.guava:guava:17.0' + } + } + + dependencies { + classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0' + classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1' + classpath 'org.ajoberstar:gradle-git:0.12.0' + } +} + +if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" +if (!project.hasProperty("artifactory_user")) ext.artifactory_user = "guest" +if (!project.hasProperty("artifactory_password")) ext.artifactory_password = "" + +if (!project.hasProperty("gitCommitHash")) { + try { + def repo = Grgit.open(project.file('.')) + ext.gitCommitHash = repo.head().abbreviatedId + } catch (Exception e) { + ext.gitCommitHash = "no_git_id" + } +} + +subprojects { + apply plugin: 'java' + apply plugin: 'maven' + apply plugin: 'checkstyle' + apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: 'com.jfrog.artifactory-upload' + + group = 'com.sk89q.worldguard' + version = '7.0.0-SNAPSHOT' + ext.internalVersion = version + ";" + gitCommitHash + + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + + checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml") + + repositories { + mavenCentral() + maven { url "http://repo.spongepowered.org/maven/" } + maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } + maven { url "http://maven.sk89q.com/repo/" } + maven { url "http://repo.maven.apache.org/maven2" } + } + + if (JavaVersion.current().isJava8Compatible()) { + // Java 8 turns on doclint which we fail + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } + } + + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives jar + archives sourcesJar + archives javadocJar + } + + build.dependsOn(checkstyleMain) + build.dependsOn(checkstyleTest) + build.dependsOn(sourcesJar) + build.dependsOn(javadocJar) + + shadowJar { + classifier 'dist' + dependencies { + include(dependency('org.khelekore:prtree:1.5.0')) + } + exclude 'GradleStart**' + exclude '.cache' + exclude 'LICENSE*' + } + + artifactory { + contextUrl = "${artifactory_contextUrl}" + publish { + repository { + repoKey = project.version.contains("SNAPSHOT") ? 'libs-snapshot-local' : 'libs-release-local' + username = "${artifactory_user}" + password = "${artifactory_password}" + maven = true + + } + } + + resolve { + repository { + repoKey = 'repo' + username = "${artifactory_user}" + password = "${artifactory_password}" + maven = true + } + } + } +} diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..9627da2b --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/header.txt b/config/checkstyle/header.txt index 3451a2a9..2ba46c92 100644 --- a/config/checkstyle/header.txt +++ b/config/checkstyle/header.txt @@ -1,5 +1,5 @@ /* - * WorldGuard, a suite of tools for Minecraft + * WorldGuard * Copyright (C) sk89q * Copyright (C) WorldGuard team and contributors * @@ -15,4 +15,4 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . - */ \ No newline at end of file + */ diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml index fbeae964..636bbc0f 100644 --- a/config/checkstyle/import-control.xml +++ b/config/checkstyle/import-control.xml @@ -1,22 +1,3 @@ - - @@ -25,17 +6,29 @@ - - + - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..b7612167031001b7b84baf2a959e8ea8ad03c011 GIT binary patch literal 51017 zcmaI7W0WY(vMt)SZQHhOcduS;+qP}nwr$(CZEH2&I&bfL-u=$q_vNUpQ9mL_Wky9t z&WM<$APo!x1poj60q`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Y}uGBWam#lU|%q zYC^0{T}{}%O=Npyz>QE15jhuV>f*A7ce(HS-apqV-wjygg=(~XMw1!wA+ZmvtdJd@ zcVXDL!;jt*hM$xSWb|V5;N_5f_WUa%=fLiHZc=RwAP?g{1k$#IJ@rpQDzM0S==wqV zuQs2k@FdSjX9xiXc>%x&AMp91!w2jezS%A5 z{J&%pJdz@U0D{d>Y6F%W(OF!a{d&jI}FEa3CvNAhp4S}!cX0_+zN zM5tbbqX9~92`Kr0n&1a$t=Gf<0DQWv11#_yop|hQ4FUSIMmj&mm7g;19x2%r16Y;; zAEF;@-(Iy|_JBP6p$H;>mErp?^C=!^k@Kn=pajx@)YN~&dj~KU{{ioNU~+kY1iY|? znVz_Xg^8WzpP_L!)tCDKAh&>C`t3ycucy`v0`ia00Nq_vI~%|)GC?C#Jsuq$JsTSd zEpsh{zoH#H&AU#8SMxhS-Vp!>y}#!j_xT?Q6u-yD0N6V8jSTDn64n4Y_dn-d+6~ue z8&D;ffV|WFm2tqk)@u-;E%1kGdD@=BfPf9A|1IO@hXg%X0N)TRKsLYKTl(v%_4`q>gm}1pXm5g)bQ@uPecGzKL9GlUy%PPK0d%O^9R)L{rCs=w@m-JBAy0N{R_I* zD@gEiR!<|wLgV_sx^ z=C zzWm)Q_GzY{IvxHb_?-MN2!0)<{#=5mE?++h=F)y6_-mH0@h4Sa;XhIRkGb^eDceujy`q1D{V`zt z!w`yT~*Y9Ibd^H}j4%`dP&3iSQ;4`bg`L*Y++h3bES t|KH7qPwVTc?c*oWQQiM74F8)Y \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..4f4305ae --- /dev/null +++ b/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'worldguard' + +include 'worldguard-core', 'worldguard-sponge', 'worldguard-legacy' diff --git a/worldguard-core/build.gradle b/worldguard-core/build.gradle new file mode 100644 index 00000000..0a0e9f6d --- /dev/null +++ b/worldguard-core/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'eclipse' +apply plugin: 'idea' + +dependencies { + compile 'com.sk89q.worldedit:worldedit-core:6.1.1-SNAPSHOT' + compile 'com.sk89q.intake:intake:4.2-SNAPSHOT' + compile 'com.sk89q:squirrelid:0.1.0' + compile 'org.flywaydb:flyway-core:3.0' + compile 'org.khelekore:prtree:1.5.0' +} + +sourceSets { + main { + java { + srcDir 'src/main/java' + } + resources { + srcDir 'src/main/resources' + } + } +} + +build.dependsOn(shadowJar) diff --git a/worldguard-core/worldguard-core.iml b/worldguard-core/worldguard-core.iml new file mode 100644 index 00000000..6c1e626f --- /dev/null +++ b/worldguard-core/worldguard-core.iml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldguard-legacy/build.gradle b/worldguard-legacy/build.gradle new file mode 100644 index 00000000..8f90c185 --- /dev/null +++ b/worldguard-legacy/build.gradle @@ -0,0 +1,42 @@ +apply plugin: 'eclipse' +apply plugin: 'idea' + +version '6.1.2-SNAPSHOT' + +tasks.withType(Checkstyle) { + exclude '**/**' +} + +dependencies { + compile 'org.khelekore:prtree:1.5.0' + compile 'org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT' + compile 'com.sk89q.worldedit:worldedit-bukkit:6.1.1-SNAPSHOT' + compile 'com.sk89q:squirrelid:0.1.0' + compile 'com.sk89q:guavabackport:1.1' + compile 'org.flywaydb:flyway-core:3.0' + compile 'com.sk89q:commandbook:2.3' + compile 'net.sf.opencsv:opencsv:2.0' + compile 'com.googlecode.json-simple:json-simple:1.1.1' + compile 'com.google.code.findbugs:jsr305:1.3.9' + testCompile 'junit:junit:4.11' + testCompile 'org.hamcrest:hamcrest-library:1.2.1' +} + +shadowJar { + dependencies { + include(dependency('org.khelekore:prtree:1.5.0')) + include(dependency('com.sk89q:guavabackport:1.1')) + include(dependency('com.sk89q:squirrelid:0.1.0')) + include(dependency('org.flywaydb:flyway-core:3.0')) + include(dependency('com.googlecode.json-simple:json-simple:1.1.1')) + include(dependency('net.sf.opencsv:opencsv:2.0')) + } + + relocate('com.sk89q.guavabackport', 'com.sk89q.worldguard.internal.guava') + relocate('org.flywaydb', 'com.sk89q.worldguard.internal.flywaydb') + relocate('com.sk89q.squirrelid', 'com.sk89q.worldguard.util.profile') + relocate('org.json.simple', 'com.sk89q.worldguard.util.jsonsimple') + +} + +build.dependsOn(shadowJar) diff --git a/config/assembly/default.xml b/worldguard-legacy/config/assembly/default.xml similarity index 100% rename from config/assembly/default.xml rename to worldguard-legacy/config/assembly/default.xml diff --git a/worldguard-legacy/config/checkstyle/header.txt b/worldguard-legacy/config/checkstyle/header.txt new file mode 100644 index 00000000..3451a2a9 --- /dev/null +++ b/worldguard-legacy/config/checkstyle/header.txt @@ -0,0 +1,18 @@ +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ \ No newline at end of file diff --git a/worldguard-legacy/config/checkstyle/import-control.xml b/worldguard-legacy/config/checkstyle/import-control.xml new file mode 100644 index 00000000..fbeae964 --- /dev/null +++ b/worldguard-legacy/config/checkstyle/import-control.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/markdown/footer.html b/worldguard-legacy/config/markdown/footer.html similarity index 100% rename from config/markdown/footer.html rename to worldguard-legacy/config/markdown/footer.html diff --git a/config/markdown/header.html b/worldguard-legacy/config/markdown/header.html similarity index 100% rename from config/markdown/header.html rename to worldguard-legacy/config/markdown/header.html diff --git a/contrib/blacklist_table.sql b/worldguard-legacy/contrib/blacklist_table.sql similarity index 100% rename from contrib/blacklist_table.sql rename to worldguard-legacy/contrib/blacklist_table.sql diff --git a/contrib/region_manual_update_20110325.sql b/worldguard-legacy/contrib/region_manual_update_20110325.sql similarity index 100% rename from contrib/region_manual_update_20110325.sql rename to worldguard-legacy/contrib/region_manual_update_20110325.sql diff --git a/src/main/resources/blacklist.txt b/worldguard-legacy/defaults/blacklist.txt similarity index 97% rename from src/main/resources/blacklist.txt rename to worldguard-legacy/defaults/blacklist.txt index 432513d8..8ed6e0de 100644 --- a/src/main/resources/blacklist.txt +++ b/worldguard-legacy/defaults/blacklist.txt @@ -1,65 +1,65 @@ -# -# WorldGuard blacklist -# -# The blacklist lets you block actions, blocks, and items from being used. -# You choose a set of "items to affect" and a list of "actions to perform." -# -############################################################################### -# -# Example to block some ore mining and placement: -# [coalore,goldore,ironore] -# on-break=deny,log,kick -# on-place=deny,tell -# -# Events that you can detect: -# - on-break (when a block of this type is about to be broken) -# - on-destroy-with (the item/block held by the user while destroying) -# - on-place (a block is being placed) -# - on-use (an item like flint and steel or a bucket is being used) -# - on-interact (when a block in used (doors, chests, etc.)) -# - on-drop (an item is being dropped from the player's inventory) -# - on-acquire (an item enters a player's inventory via some method) -# - on-dispense (a dispenser is about to dispense an item) -# -# Actions (for events): -# - deny (deny completely, used blacklist mode) -# - allow (used in whitelist mode) -# - notify (notify admins with the 'worldguard.notify' permission) -# - log (log to console/file/database) -# - tell (tell a player that that's not allowed) -# - kick (kick player) -# - ban (ban player) -# -# Options: -# - ignore-groups (comma-separated list of groups to not affect) -# - ignore-perms (comma-separated list of permissions to not affect - make up -# your very own permissions!) -# - comment (message for yourself that is printed with 'log' and 'notify') -# - message (optional message to show the user instead; %s is the item name) -# -############################################################################### -# -# For more information, see: -# http://wiki.sk89q.com/wiki/WorldGuard/Blacklist -# -############################################################################### -# -# Some examples follow. -# REMEMBER: If a line has # in front, it will be ignored. -# - -# Deny lava buckets -#[lavabucket] -#ignore-perms=my.own.madeup.permission -#ignore-groups=admins,mods -#on-use=deny,tell - -# Deny some ore -#[coalore,goldore,ironore] -#ignore-groups=admins,mods -#on-break=notify,deny,log - -# Some funky data value tests -#[wood:0;>=2] -#ignore-groups=admins,mods +# +# WorldGuard blacklist +# +# The blacklist lets you block actions, blocks, and items from being used. +# You choose a set of "items to affect" and a list of "actions to perform." +# +############################################################################### +# +# Example to block some ore mining and placement: +# [coalore,goldore,ironore] +# on-break=deny,log,kick +# on-place=deny,tell +# +# Events that you can detect: +# - on-break (when a block of this type is about to be broken) +# - on-destroy-with (the item/block held by the user while destroying) +# - on-place (a block is being placed) +# - on-use (an item like flint and steel or a bucket is being used) +# - on-interact (when a block in used (doors, chests, etc.)) +# - on-drop (an item is being dropped from the player's inventory) +# - on-acquire (an item enters a player's inventory via some method) +# - on-dispense (a dispenser is about to dispense an item) +# +# Actions (for events): +# - deny (deny completely, used blacklist mode) +# - allow (used in whitelist mode) +# - notify (notify admins with the 'worldguard.notify' permission) +# - log (log to console/file/database) +# - tell (tell a player that that's not allowed) +# - kick (kick player) +# - ban (ban player) +# +# Options: +# - ignore-groups (comma-separated list of groups to not affect) +# - ignore-perms (comma-separated list of permissions to not affect - make up +# your very own permissions!) +# - comment (message for yourself that is printed with 'log' and 'notify') +# - message (optional message to show the user instead; %s is the item name) +# +############################################################################### +# +# For more information, see: +# http://wiki.sk89q.com/wiki/WorldGuard/Blacklist +# +############################################################################### +# +# Some examples follow. +# REMEMBER: If a line has # in front, it will be ignored. +# + +# Deny lava buckets +#[lavabucket] +#ignore-perms=my.own.madeup.permission +#ignore-groups=admins,mods +#on-use=deny,tell + +# Deny some ore +#[coalore,goldore,ironore] +#ignore-groups=admins,mods +#on-break=notify,deny,log + +# Some funky data value tests +#[wood:0;>=2] +#ignore-groups=admins,mods #on-break=notify,deny,log \ No newline at end of file diff --git a/src/main/resources/config.yml b/worldguard-legacy/defaults/config.yml similarity index 97% rename from src/main/resources/config.yml rename to worldguard-legacy/defaults/config.yml index f5f94db6..4501e6fb 100644 --- a/src/main/resources/config.yml +++ b/worldguard-legacy/defaults/config.yml @@ -1,22 +1,22 @@ -# -# WorldGuard's configuration file -# -# About editing this file: -# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If -# you use an editor like Notepad++ (recommended for Windows users), you -# must configure it to "replace tabs with spaces." In Notepad++, this can -# be changed in Settings > Preferences > Language Menu. -# - Don't get rid of the indents. They are indented so some entries are -# in categories (like "enforce-single-session" is in the "protection" -# category. -# - If you want to check the format of this file before putting it -# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/ -# and see if it gives "ERROR:". -# - Lines starting with # are commentsand so they are ignored. -# -# WARNING: -# Remember to check the compatibility spreadsheet for WorldGuard to see -# if any features are currently broken in your version of Bukkit. -# - +# +# WorldGuard's configuration file +# +# About editing this file: +# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If +# you use an editor like Notepad++ (recommended for Windows users), you +# must configure it to "replace tabs with spaces." In Notepad++, this can +# be changed in Settings > Preferences > Language Menu. +# - Don't get rid of the indents. They are indented so some entries are +# in categories (like "enforce-single-session" is in the "protection" +# category. +# - If you want to check the format of this file before putting it +# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/ +# and see if it gives "ERROR:". +# - Lines starting with # are commentsand so they are ignored. +# +# WARNING: +# Remember to check the compatibility spreadsheet for WorldGuard to see +# if any features are currently broken in your version of Bukkit. +# + # -- This should be automatically replaced by the plugin in-game -- \ No newline at end of file diff --git a/src/main/resources/config_world.yml b/worldguard-legacy/defaults/config_world.yml similarity index 97% rename from src/main/resources/config_world.yml rename to worldguard-legacy/defaults/config_world.yml index 6a6c5a90..db29fa3a 100644 --- a/src/main/resources/config_world.yml +++ b/worldguard-legacy/defaults/config_world.yml @@ -1,21 +1,21 @@ -# -# WorldGuard's configuration file. -# -# This is the a per-world configuration file. It only affects one -# corresponding world. -# -# About editing this file: -# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If -# you use an editor like Notepad++ (recommended for Windows users), you -# must configure it to "replace tabs with spaces." In Notepad++, this can -# be changed in Settings > Preferences > Language Menu. -# - Don't get rid of the indents. They are indented so some entries are -# in categories (like "enforce-single-session" is in the "protection" -# category. -# - If you want to check the format of this file before putting it -# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/ -# and see if it gives "ERROR:". -# - Lines starting with # are comments and so they are ignored. -# - +# +# WorldGuard's configuration file. +# +# This is the a per-world configuration file. It only affects one +# corresponding world. +# +# About editing this file: +# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If +# you use an editor like Notepad++ (recommended for Windows users), you +# must configure it to "replace tabs with spaces." In Notepad++, this can +# be changed in Settings > Preferences > Language Menu. +# - Don't get rid of the indents. They are indented so some entries are +# in categories (like "enforce-single-session" is in the "protection" +# category. +# - If you want to check the format of this file before putting it +# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/ +# and see if it gives "ERROR:". +# - Lines starting with # are comments and so they are ignored. +# + # -- This should be automatically replaced by the plugin in-game -- \ No newline at end of file diff --git a/src/main/resources/migrations/region/mysql/V1__Initial.sql b/worldguard-legacy/defaults/migrations/region/mysql/V1__Initial.sql similarity index 100% rename from src/main/resources/migrations/region/mysql/V1__Initial.sql rename to worldguard-legacy/defaults/migrations/region/mysql/V1__Initial.sql diff --git a/src/main/resources/migrations/region/mysql/V2__Bug_fix_and_UUID.sql b/worldguard-legacy/defaults/migrations/region/mysql/V2__Bug_fix_and_UUID.sql similarity index 100% rename from src/main/resources/migrations/region/mysql/V2__Bug_fix_and_UUID.sql rename to worldguard-legacy/defaults/migrations/region/mysql/V2__Bug_fix_and_UUID.sql diff --git a/src/main/resources/migrations/region/sqlite/V1__Initial.sql b/worldguard-legacy/defaults/migrations/region/sqlite/V1__Initial.sql similarity index 100% rename from src/main/resources/migrations/region/sqlite/V1__Initial.sql rename to worldguard-legacy/defaults/migrations/region/sqlite/V1__Initial.sql diff --git a/src/main/resources/plugin.yml b/worldguard-legacy/defaults/plugin.yml similarity index 97% rename from src/main/resources/plugin.yml rename to worldguard-legacy/defaults/plugin.yml index 1981a12a..b0aacf55 100644 --- a/src/main/resources/plugin.yml +++ b/worldguard-legacy/defaults/plugin.yml @@ -1,4 +1,4 @@ -name: WorldGuard -main: com.sk89q.worldguard.bukkit.WorldGuardPlugin -version: "${project.version}" -softdepend: [WorldEdit, CommandBook] +name: WorldGuard +main: com.sk89q.worldguard.bukkit.WorldGuardPlugin +version: "${project.version}" +softdepend: [WorldEdit, CommandBook] diff --git a/pom.xml b/worldguard-legacy/pom.xml similarity index 100% rename from pom.xml rename to worldguard-legacy/pom.xml diff --git a/src/main/java/com/sk89q/worldguard/LocalPlayer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/LocalPlayer.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/LocalPlayer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/LocalPlayer.java index 46689110..cf64cd17 100644 --- a/src/main/java/com/sk89q/worldguard/LocalPlayer.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/LocalPlayer.java @@ -1,122 +1,122 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldguard.domains.Association; -import com.sk89q.worldguard.protection.association.RegionAssociable; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; - -import java.util.List; -import java.util.UUID; - -public abstract class LocalPlayer implements RegionAssociable { - - /** - * Get this player's name. - * - * @return The player's name - */ - public abstract String getName(); - - /** - * Get this player's unique ID. - * - * @return a UUID - */ - public abstract UUID getUniqueId(); - - /** - * Returns true if this player is inside a group. - * - * @param group The group to check - * @return Whether this player is in {@code group} - */ - public abstract boolean hasGroup(String group); - - /** - * Get this player's position. - * - * @return The player's position - */ - public abstract Vector getPosition(); - - /** - * Kick this player. - * - * @param msg The message to kick the player with - */ - public abstract void kick(String msg); - - /** - * Ban this player. - * - * @param msg The message to ban the player with - */ - public abstract void ban(String msg); - - /** - * Send this player a message. - * - * @param msg The message to send to the player - */ - public abstract void printRaw(String msg); - - /** - * Get this player's list of groups. - * - * @return The groups this player is in - */ - public abstract String[] getGroups(); - - /** - * Returns whether this player has permission. - * - * @param perm The permission to check - * @return Whether this player has {@code perm} - */ - public abstract boolean hasPermission(String perm); - - @Override - public Association getAssociation(List regions) { - boolean member = false; - - for (ProtectedRegion region : regions) { - if (region.isOwner(this)) { - return Association.OWNER; - } else if (!member && region.isMember(this)) { - member = true; - } - } - - return member ? Association.MEMBER : Association.NON_MEMBER; - } - - @Override - public boolean equals(Object obj) { - return obj instanceof LocalPlayer && ((LocalPlayer) obj).getName().equals(getName()); - } - - @Override - public int hashCode() { - return getName().hashCode(); - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldguard.domains.Association; +import com.sk89q.worldguard.protection.association.RegionAssociable; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; + +import java.util.List; +import java.util.UUID; + +public abstract class LocalPlayer implements RegionAssociable { + + /** + * Get this player's name. + * + * @return The player's name + */ + public abstract String getName(); + + /** + * Get this player's unique ID. + * + * @return a UUID + */ + public abstract UUID getUniqueId(); + + /** + * Returns true if this player is inside a group. + * + * @param group The group to check + * @return Whether this player is in {@code group} + */ + public abstract boolean hasGroup(String group); + + /** + * Get this player's position. + * + * @return The player's position + */ + public abstract Vector getPosition(); + + /** + * Kick this player. + * + * @param msg The message to kick the player with + */ + public abstract void kick(String msg); + + /** + * Ban this player. + * + * @param msg The message to ban the player with + */ + public abstract void ban(String msg); + + /** + * Send this player a message. + * + * @param msg The message to send to the player + */ + public abstract void printRaw(String msg); + + /** + * Get this player's list of groups. + * + * @return The groups this player is in + */ + public abstract String[] getGroups(); + + /** + * Returns whether this player has permission. + * + * @param perm The permission to check + * @return Whether this player has {@code perm} + */ + public abstract boolean hasPermission(String perm); + + @Override + public Association getAssociation(List regions) { + boolean member = false; + + for (ProtectedRegion region : regions) { + if (region.isOwner(this)) { + return Association.OWNER; + } else if (!member && region.isMember(this)) { + member = true; + } + } + + return member ? Association.MEMBER : Association.NON_MEMBER; + } + + @Override + public boolean equals(Object obj) { + return obj instanceof LocalPlayer && ((LocalPlayer) obj).getName().equals(getName()); + } + + @Override + public int hashCode() { + return getName().hashCode(); + } + +} diff --git a/src/main/java/com/sk89q/worldguard/blacklist/Blacklist.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/Blacklist.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/Blacklist.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/Blacklist.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/BlacklistEntry.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/BlacklistEntry.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/BlacklistEntry.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/BlacklistEntry.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/BlacklistLoggerHandler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/BlacklistLoggerHandler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/BlacklistLoggerHandler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/BlacklistLoggerHandler.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/MatcherIndex.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/MatcherIndex.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/MatcherIndex.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/MatcherIndex.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/TrackedEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/TrackedEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/TrackedEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/TrackedEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/Action.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/Action.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/Action.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/Action.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/ActionResult.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/ActionResult.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/ActionResult.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/ActionResult.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/ActionType.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/ActionType.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/ActionType.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/ActionType.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/AllowAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/AllowAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/AllowAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/AllowAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/BanAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/BanAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/BanAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/BanAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/DenyAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/DenyAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/DenyAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/DenyAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/KickAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/KickAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/KickAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/KickAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/LogAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/LogAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/LogAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/LogAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/NotifyAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/NotifyAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/NotifyAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/NotifyAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/RepeatGuardedAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/RepeatGuardedAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/RepeatGuardedAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/RepeatGuardedAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/action/TellAction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/TellAction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/action/TellAction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/action/TellAction.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/AbstractBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/AbstractBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/AbstractBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/AbstractBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/BlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/BlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/BlockBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBreakBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBreakBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/BlockBreakBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBreakBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/BlockDispenseBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockDispenseBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/BlockDispenseBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockDispenseBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/BlockInteractBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockInteractBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/BlockInteractBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockInteractBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/BlockPlaceBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockPlaceBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/BlockPlaceBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/BlockPlaceBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/EventType.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/EventType.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/EventType.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/EventType.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/ItemAcquireBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemAcquireBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/ItemAcquireBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemAcquireBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/ItemBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/ItemBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDestroyWithBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDestroyWithBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/ItemDestroyWithBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDestroyWithBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDropBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDropBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/ItemDropBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDropBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/event/ItemUseBlacklistEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemUseBlacklistEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/event/ItemUseBlacklistEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/event/ItemUseBlacklistEvent.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/logger/ConsoleHandler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/ConsoleHandler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/logger/ConsoleHandler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/ConsoleHandler.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/logger/DatabaseHandler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/DatabaseHandler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/logger/DatabaseHandler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/DatabaseHandler.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/logger/FileHandler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/FileHandler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/logger/FileHandler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/FileHandler.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/logger/LogFileWriter.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/LogFileWriter.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/logger/LogFileWriter.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/LogFileWriter.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/logger/LoggerHandler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/LoggerHandler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/logger/LoggerHandler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/logger/LoggerHandler.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/DataMask.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/DataMask.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/DataMask.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/DataMask.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/DataValueRangeMatcher.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/DataValueRangeMatcher.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/DataValueRangeMatcher.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/DataValueRangeMatcher.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/MaterialTarget.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/MaterialTarget.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/MaterialTarget.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/MaterialTarget.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/RangeMask.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/RangeMask.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/RangeMask.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/RangeMask.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/Target.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/Target.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/Target.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/Target.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcher.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcher.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcher.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcher.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParseException.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParseException.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParseException.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParseException.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParser.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParser.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParser.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/TargetMatcherParser.java diff --git a/src/main/java/com/sk89q/worldguard/blacklist/target/WildcardDataMatcher.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/WildcardDataMatcher.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/blacklist/target/WildcardDataMatcher.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/blacklist/target/WildcardDataMatcher.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/BukkitOfflinePlayer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitOfflinePlayer.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/BukkitOfflinePlayer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitOfflinePlayer.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/BukkitPlayer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitPlayer.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/bukkit/BukkitPlayer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitPlayer.java index 5cefcc50..be32d3d3 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/BukkitPlayer.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitPlayer.java @@ -1,111 +1,111 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.bukkit; - -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldguard.LocalPlayer; - -import java.util.UUID; - -import static com.google.common.base.Preconditions.checkNotNull; - -public class BukkitPlayer extends LocalPlayer { - - private final WorldGuardPlugin plugin; - private final Player player; - private final String name; - private final boolean silenced; - - public BukkitPlayer(WorldGuardPlugin plugin, Player player) { - this(plugin, player, false); - } - - BukkitPlayer(WorldGuardPlugin plugin, Player player, boolean silenced) { - checkNotNull(plugin); - checkNotNull(player); - - this.plugin = plugin; - this.player = player; - // getName() takes longer than before in newer versions of Minecraft - this.name = player.getName(); - this.silenced = silenced; - } - - @Override - public String getName() { - return name; - } - - @Override - public UUID getUniqueId() { - return player.getUniqueId(); - } - - @Override - public boolean hasGroup(String group) { - return plugin.inGroup(player, group); - } - - @Override - public Vector getPosition() { - Location loc = player.getLocation(); - return new Vector(loc.getX(), loc.getY(), loc.getZ()); - } - - @Override - public void kick(String msg) { - if (!silenced) { - player.kickPlayer(msg); - } - } - - @Override - public void ban(String msg) { - if (!silenced) { - player.setBanned(true); - player.kickPlayer(msg); - } - } - - @Override - public String[] getGroups() { - return plugin.getGroups(player); - } - - @Override - public void printRaw(String msg) { - if (!silenced) { - player.sendMessage(msg); - } - } - - @Override - public boolean hasPermission(String perm) { - return plugin.hasPermission(player, perm); - } - - public Player getPlayer() { - return player; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.bukkit; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldguard.LocalPlayer; + +import java.util.UUID; + +import static com.google.common.base.Preconditions.checkNotNull; + +public class BukkitPlayer extends LocalPlayer { + + private final WorldGuardPlugin plugin; + private final Player player; + private final String name; + private final boolean silenced; + + public BukkitPlayer(WorldGuardPlugin plugin, Player player) { + this(plugin, player, false); + } + + BukkitPlayer(WorldGuardPlugin plugin, Player player, boolean silenced) { + checkNotNull(plugin); + checkNotNull(player); + + this.plugin = plugin; + this.player = player; + // getName() takes longer than before in newer versions of Minecraft + this.name = player.getName(); + this.silenced = silenced; + } + + @Override + public String getName() { + return name; + } + + @Override + public UUID getUniqueId() { + return player.getUniqueId(); + } + + @Override + public boolean hasGroup(String group) { + return plugin.inGroup(player, group); + } + + @Override + public Vector getPosition() { + Location loc = player.getLocation(); + return new Vector(loc.getX(), loc.getY(), loc.getZ()); + } + + @Override + public void kick(String msg) { + if (!silenced) { + player.kickPlayer(msg); + } + } + + @Override + public void ban(String msg) { + if (!silenced) { + player.setBanned(true); + player.kickPlayer(msg); + } + } + + @Override + public String[] getGroups() { + return plugin.getGroups(player); + } + + @Override + public void printRaw(String msg) { + if (!silenced) { + player.sendMessage(msg); + } + } + + @Override + public boolean hasPermission(String perm) { + return plugin.hasPermission(player, perm); + } + + public Player getPlayer() { + return player; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java index 3bbf5f16..8f50a1f1 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java @@ -1,408 +1,408 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.bukkit; - -import com.google.common.collect.ImmutableList; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; -import com.sk89q.worldedit.blocks.ItemID; -import com.sk89q.worldguard.blacklist.target.MaterialTarget; -import com.sk89q.worldguard.blacklist.target.Target; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.util.Enums; -import org.bukkit.*; -import org.bukkit.block.Block; -import org.bukkit.entity.*; -import org.bukkit.inventory.ItemStack; - -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.List; - -import static com.google.common.base.Preconditions.checkNotNull; - -public class BukkitUtil { - - private static Method ONLINE_PLAYERS_METHOD; - - private BukkitUtil() { - - } - - /** - * Converts the location of a Bukkit block to a WorldEdit vector. - * - * @param block The block to convert - * @return The block's location as a BlockVector - */ - public static BlockVector toVector(Block block) { - return new BlockVector(block.getX(), block.getY(), block.getZ()); - } - - /** - * Converts a Bukkit location to a WorldEdit vector. - * - * @param loc A Bukkit Location - * @return A Vector with the location's x, y, and z values - */ - public static Vector toVector(Location loc) { - return new Vector(loc.getX(), loc.getY(), loc.getZ()); - } - - /** - * Converts a Bukkit vector to a WorldEdit vector. - * - * @param vector The Bukkit vector - * @return A WorldEdit vector with the same values as the Bukkit vector. - */ - public static Vector toVector(org.bukkit.util.Vector vector) { - return new Vector(vector.getX(), vector.getY(), vector.getZ()); - } - - /** - * Converts a WorldEdit vector to a Bukkit location. - * - * @param world The World to create the new Location with - * @param vec The vector to use for coordinates - * @return The Vector as a location with a World of world - */ - public static Location toLocation(World world, Vector vec) { - return new Location(world, vec.getX(), vec.getY(), vec.getZ()); - } - - /** - * Create a dummy region that encompasses the size of a chunk. - * - * @param chunk The chunk - * @return The dummy region - */ - public static ProtectedRegion toRegion(Chunk chunk) { - World world = chunk.getWorld(); - - int minX = chunk.getX() << 4; - int minZ = chunk.getZ() << 4; - return new ProtectedCuboidRegion("_", new BlockVector(minX, 0, minZ), new BlockVector(minX + 15, world.getMaxHeight(), minZ + 15)); - } - - /** - * Matches one player based on name. - * - * @param server The server to check - * @param name The name to attempt to match - * @deprecated see {@link WorldGuardPlugin#matchSinglePlayer(org.bukkit.command.CommandSender, String)} - * @return The matched player if any, otherwise null - */ - @Deprecated - public static Player matchSinglePlayer(Server server, String name) { - List players = server.matchPlayer(name); - if (players.size() == 0) { - return null; - } - return players.get(0); - } - - /** - * Drops a sign item and removes a sign. - * - * @param block The block - * @deprecated see {@link org.bukkit.block.Block#breakNaturally()} - */ - @Deprecated - public static void dropSign(Block block) { - block.setTypeId(0); - block.getWorld().dropItemNaturally(block.getLocation(), - new ItemStack(ItemID.SIGN, 1)); - } - - /** - * Sets the given block to fluid water. - * Used by addSpongeWater() - * - * @param world - * @param ox - * @param oy - * @param oz - */ - public static void setBlockToWater(World world, int ox, int oy, int oz) { - Block block = world.getBlockAt(ox, oy, oz); - int id = block.getTypeId(); - if (id == 0) { - block.setTypeId(8); - } - } - - /** - * Checks if the given block is water - * - * @param world the world - * @param ox x - * @param oy y - * @param oz z - * @return true if it's water - */ - public static boolean isBlockWater(World world, int ox, int oy, int oz) { - Block block = world.getBlockAt(ox, oy, oz); - int id = block.getTypeId(); - return id == 8 || id == 9; - } - - /** - * Checks if the given potion is a vial of water. - * - * @param item the item to check - * @return true if it's a water vial - */ - public static boolean isWaterPotion(ItemStack item) { - return (item.getDurability() & 0x3F) == 0; - } - - /** - * Get just the potion effect bits. This is to work around bugs with potion - * parsing. - * - * @param item item - * @return new bits - */ - public static int getPotionEffectBits(ItemStack item) { - return item.getDurability() & 0x3F; - } - - /** - * Find a position for the player to stand that is not inside a block. - * Blocks above the player will be iteratively tested until there is - * a series of two free blocks. The player will be teleported to - * that free position. - * - * @param player - */ - public static void findFreePosition(Player player) { - Location loc = player.getLocation(); - int x = loc.getBlockX(); - int y = Math.max(0, loc.getBlockY()); - int origY = y; - int z = loc.getBlockZ(); - World world = player.getWorld(); - - byte free = 0; - - while (y <= world.getMaxHeight() + 1) { - if (BlockType.canPassThrough(world.getBlockTypeIdAt(x, y, z))) { - free++; - } else { - free = 0; - } - - if (free == 2) { - if (y - 1 != origY || y == 1) { - loc.setX(x + 0.5); - loc.setY(y); - loc.setZ(z + 0.5); - if (y <= 2 && world.getBlockAt(x,0,z).getTypeId() == BlockID.AIR) { - world.getBlockAt(x,0,z).setTypeId(20); - loc.setY(2); - } - player.setFallDistance(0F); - player.teleport(loc); - } - return; - } - - y++; - } - } - - /** - * Replace color macros in a string. The macros are in the form of `[char] - * where char represents the color. R is for red, Y is for yellow, - * G is for green, C is for cyan, B is for blue, and P is for purple. - * The uppercase versions of those are the darker shades, while the - * lowercase versions are the lighter shades. For white, it's 'w', and - * 0-2 are black, dark grey, and grey, respectively. - * - * @param str - * @return color-coded string - */ - public static String replaceColorMacros(String str) { - str = str.replace("&r", ChatColor.RED.toString()); - str = str.replace("&R", ChatColor.DARK_RED.toString()); - - str = str.replace("&y", ChatColor.YELLOW.toString()); - str = str.replace("&Y", ChatColor.GOLD.toString()); - - str = str.replace("&g", ChatColor.GREEN.toString()); - str = str.replace("&G", ChatColor.DARK_GREEN.toString()); - - str = str.replace("&c", ChatColor.AQUA.toString()); - str = str.replace("&C", ChatColor.DARK_AQUA.toString()); - - str = str.replace("&b", ChatColor.BLUE.toString()); - str = str.replace("&B", ChatColor.DARK_BLUE.toString()); - - str = str.replace("&p", ChatColor.LIGHT_PURPLE.toString()); - str = str.replace("&P", ChatColor.DARK_PURPLE.toString()); - - str = str.replace("&0", ChatColor.BLACK.toString()); - str = str.replace("&1", ChatColor.DARK_GRAY.toString()); - str = str.replace("&2", ChatColor.GRAY.toString()); - str = str.replace("&w", ChatColor.WHITE.toString()); - - str = str.replace("&k", ChatColor.MAGIC.toString()); - str = str.replace("&l", ChatColor.BOLD.toString()); - str = str.replace("&m", ChatColor.STRIKETHROUGH.toString()); - str = str.replace("&n", ChatColor.UNDERLINE.toString()); - str = str.replace("&o", ChatColor.ITALIC.toString()); - - str = str.replace("&x", ChatColor.RESET.toString()); - - return str; - } - - private static final org.bukkit.entity.EntityType armorStandType = - Enums.findByValue(org.bukkit.entity.EntityType.class, "ARMOR_STAND"); - - /** - * Returns whether an entity should be removed for the halt activity mode. - * - * @param entity - * @return true if it's to be removed - */ - public static boolean isIntensiveEntity(Entity entity) { - return entity instanceof Item - || entity instanceof TNTPrimed - || entity instanceof ExperienceOrb - || entity instanceof FallingBlock - || (entity instanceof LivingEntity - && !(entity instanceof Tameable) - && !(entity instanceof Player) - && !(entity.getType() == armorStandType)); - } - - /** - * Search an enum for a value, and return the first one found. Return null if the - * enum entry is not found. - * - * @param enumType enum class - * @param values values to test - * @return a value in the enum or null - * @deprecated use {@link Enums#findByValue(Class, String...)} - */ - @Deprecated - public static > T tryEnum(Class enumType, String ... values) { - for (String val : values) { - try { - return Enum.valueOf(enumType, val); - } catch (IllegalArgumentException e) { - } - } - - return null; - } - - /** - * Get a blacklist target for the given block. - * - * @param block the block - * @return a target - */ - public static Target createTarget(Block block) { - checkNotNull(block); - return new MaterialTarget(block.getTypeId(), block.getData()); - } - - /** - * Get a blacklist target for the given block. - * - * @param block the block - * @param material a fallback material - * @return a target - */ - public static Target createTarget(Block block, Material material) { - checkNotNull(material); - if (block.getType() == material) { - return new MaterialTarget(block.getTypeId(), block.getData()); - } else { - return new MaterialTarget(material.getId(), (short) 0); - } - } - - /** - * Get a blacklist target for the given item. - * - * @param item the item - * @return a target - */ - public static Target createTarget(ItemStack item) { - checkNotNull(item); - return new MaterialTarget(item.getTypeId(), item.getDurability()); - } - - /** - * Get a blacklist target for the given material. - * - * @param material the material - * @return a target - */ - public static Target createTarget(Material material) { - checkNotNull(material); - return new MaterialTarget(material.getId(), (short) 0); - } - - /** - * Get a collection of the currently online players. - * - * @return The online players - */ - @SuppressWarnings("unchecked") - public static Collection getOnlinePlayers() { - try { - return Bukkit.getServer().getOnlinePlayers(); - } catch (NoSuchMethodError ignored) { - } - - try { - if (ONLINE_PLAYERS_METHOD == null) { - ONLINE_PLAYERS_METHOD = getOnlinePlayersMethod(); - } - - Object result = ONLINE_PLAYERS_METHOD.invoke(Bukkit.getServer()); - if (result instanceof Player[]) { - return ImmutableList.copyOf((Player[]) result); - } else if (result instanceof Collection) { - return (Collection) result; - } else { - throw new RuntimeException("Result of getOnlinePlayers() call was not a known data type"); - } - } catch (Exception e) { - throw new RuntimeException("WorldGuard is not compatible with this version of Bukkit", e); - } - } - - private static Method getOnlinePlayersMethod() throws NoSuchMethodException { - try { - return Server.class.getMethod("getOnlinePlayers"); - } catch (NoSuchMethodException e1) { - return Server.class.getMethod("_INVALID_getOnlinePlayers"); - } - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.bukkit; + +import com.google.common.collect.ImmutableList; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.ItemID; +import com.sk89q.worldguard.blacklist.target.MaterialTarget; +import com.sk89q.worldguard.blacklist.target.Target; +import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import com.sk89q.worldguard.util.Enums; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.entity.*; +import org.bukkit.inventory.ItemStack; + +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.List; + +import static com.google.common.base.Preconditions.checkNotNull; + +public class BukkitUtil { + + private static Method ONLINE_PLAYERS_METHOD; + + private BukkitUtil() { + + } + + /** + * Converts the location of a Bukkit block to a WorldEdit vector. + * + * @param block The block to convert + * @return The block's location as a BlockVector + */ + public static BlockVector toVector(Block block) { + return new BlockVector(block.getX(), block.getY(), block.getZ()); + } + + /** + * Converts a Bukkit location to a WorldEdit vector. + * + * @param loc A Bukkit Location + * @return A Vector with the location's x, y, and z values + */ + public static Vector toVector(Location loc) { + return new Vector(loc.getX(), loc.getY(), loc.getZ()); + } + + /** + * Converts a Bukkit vector to a WorldEdit vector. + * + * @param vector The Bukkit vector + * @return A WorldEdit vector with the same values as the Bukkit vector. + */ + public static Vector toVector(org.bukkit.util.Vector vector) { + return new Vector(vector.getX(), vector.getY(), vector.getZ()); + } + + /** + * Converts a WorldEdit vector to a Bukkit location. + * + * @param world The World to create the new Location with + * @param vec The vector to use for coordinates + * @return The Vector as a location with a World of world + */ + public static Location toLocation(World world, Vector vec) { + return new Location(world, vec.getX(), vec.getY(), vec.getZ()); + } + + /** + * Create a dummy region that encompasses the size of a chunk. + * + * @param chunk The chunk + * @return The dummy region + */ + public static ProtectedRegion toRegion(Chunk chunk) { + World world = chunk.getWorld(); + + int minX = chunk.getX() << 4; + int minZ = chunk.getZ() << 4; + return new ProtectedCuboidRegion("_", new BlockVector(minX, 0, minZ), new BlockVector(minX + 15, world.getMaxHeight(), minZ + 15)); + } + + /** + * Matches one player based on name. + * + * @param server The server to check + * @param name The name to attempt to match + * @deprecated see {@link WorldGuardPlugin#matchSinglePlayer(org.bukkit.command.CommandSender, String)} + * @return The matched player if any, otherwise null + */ + @Deprecated + public static Player matchSinglePlayer(Server server, String name) { + List players = server.matchPlayer(name); + if (players.size() == 0) { + return null; + } + return players.get(0); + } + + /** + * Drops a sign item and removes a sign. + * + * @param block The block + * @deprecated see {@link org.bukkit.block.Block#breakNaturally()} + */ + @Deprecated + public static void dropSign(Block block) { + block.setTypeId(0); + block.getWorld().dropItemNaturally(block.getLocation(), + new ItemStack(ItemID.SIGN, 1)); + } + + /** + * Sets the given block to fluid water. + * Used by addSpongeWater() + * + * @param world + * @param ox + * @param oy + * @param oz + */ + public static void setBlockToWater(World world, int ox, int oy, int oz) { + Block block = world.getBlockAt(ox, oy, oz); + int id = block.getTypeId(); + if (id == 0) { + block.setTypeId(8); + } + } + + /** + * Checks if the given block is water + * + * @param world the world + * @param ox x + * @param oy y + * @param oz z + * @return true if it's water + */ + public static boolean isBlockWater(World world, int ox, int oy, int oz) { + Block block = world.getBlockAt(ox, oy, oz); + int id = block.getTypeId(); + return id == 8 || id == 9; + } + + /** + * Checks if the given potion is a vial of water. + * + * @param item the item to check + * @return true if it's a water vial + */ + public static boolean isWaterPotion(ItemStack item) { + return (item.getDurability() & 0x3F) == 0; + } + + /** + * Get just the potion effect bits. This is to work around bugs with potion + * parsing. + * + * @param item item + * @return new bits + */ + public static int getPotionEffectBits(ItemStack item) { + return item.getDurability() & 0x3F; + } + + /** + * Find a position for the player to stand that is not inside a block. + * Blocks above the player will be iteratively tested until there is + * a series of two free blocks. The player will be teleported to + * that free position. + * + * @param player + */ + public static void findFreePosition(Player player) { + Location loc = player.getLocation(); + int x = loc.getBlockX(); + int y = Math.max(0, loc.getBlockY()); + int origY = y; + int z = loc.getBlockZ(); + World world = player.getWorld(); + + byte free = 0; + + while (y <= world.getMaxHeight() + 1) { + if (BlockType.canPassThrough(world.getBlockTypeIdAt(x, y, z))) { + free++; + } else { + free = 0; + } + + if (free == 2) { + if (y - 1 != origY || y == 1) { + loc.setX(x + 0.5); + loc.setY(y); + loc.setZ(z + 0.5); + if (y <= 2 && world.getBlockAt(x,0,z).getTypeId() == BlockID.AIR) { + world.getBlockAt(x,0,z).setTypeId(20); + loc.setY(2); + } + player.setFallDistance(0F); + player.teleport(loc); + } + return; + } + + y++; + } + } + + /** + * Replace color macros in a string. The macros are in the form of `[char] + * where char represents the color. R is for red, Y is for yellow, + * G is for green, C is for cyan, B is for blue, and P is for purple. + * The uppercase versions of those are the darker shades, while the + * lowercase versions are the lighter shades. For white, it's 'w', and + * 0-2 are black, dark grey, and grey, respectively. + * + * @param str + * @return color-coded string + */ + public static String replaceColorMacros(String str) { + str = str.replace("&r", ChatColor.RED.toString()); + str = str.replace("&R", ChatColor.DARK_RED.toString()); + + str = str.replace("&y", ChatColor.YELLOW.toString()); + str = str.replace("&Y", ChatColor.GOLD.toString()); + + str = str.replace("&g", ChatColor.GREEN.toString()); + str = str.replace("&G", ChatColor.DARK_GREEN.toString()); + + str = str.replace("&c", ChatColor.AQUA.toString()); + str = str.replace("&C", ChatColor.DARK_AQUA.toString()); + + str = str.replace("&b", ChatColor.BLUE.toString()); + str = str.replace("&B", ChatColor.DARK_BLUE.toString()); + + str = str.replace("&p", ChatColor.LIGHT_PURPLE.toString()); + str = str.replace("&P", ChatColor.DARK_PURPLE.toString()); + + str = str.replace("&0", ChatColor.BLACK.toString()); + str = str.replace("&1", ChatColor.DARK_GRAY.toString()); + str = str.replace("&2", ChatColor.GRAY.toString()); + str = str.replace("&w", ChatColor.WHITE.toString()); + + str = str.replace("&k", ChatColor.MAGIC.toString()); + str = str.replace("&l", ChatColor.BOLD.toString()); + str = str.replace("&m", ChatColor.STRIKETHROUGH.toString()); + str = str.replace("&n", ChatColor.UNDERLINE.toString()); + str = str.replace("&o", ChatColor.ITALIC.toString()); + + str = str.replace("&x", ChatColor.RESET.toString()); + + return str; + } + + private static final org.bukkit.entity.EntityType armorStandType = + Enums.findByValue(org.bukkit.entity.EntityType.class, "ARMOR_STAND"); + + /** + * Returns whether an entity should be removed for the halt activity mode. + * + * @param entity + * @return true if it's to be removed + */ + public static boolean isIntensiveEntity(Entity entity) { + return entity instanceof Item + || entity instanceof TNTPrimed + || entity instanceof ExperienceOrb + || entity instanceof FallingBlock + || (entity instanceof LivingEntity + && !(entity instanceof Tameable) + && !(entity instanceof Player) + && !(entity.getType() == armorStandType)); + } + + /** + * Search an enum for a value, and return the first one found. Return null if the + * enum entry is not found. + * + * @param enumType enum class + * @param values values to test + * @return a value in the enum or null + * @deprecated use {@link Enums#findByValue(Class, String...)} + */ + @Deprecated + public static > T tryEnum(Class enumType, String ... values) { + for (String val : values) { + try { + return Enum.valueOf(enumType, val); + } catch (IllegalArgumentException e) { + } + } + + return null; + } + + /** + * Get a blacklist target for the given block. + * + * @param block the block + * @return a target + */ + public static Target createTarget(Block block) { + checkNotNull(block); + return new MaterialTarget(block.getTypeId(), block.getData()); + } + + /** + * Get a blacklist target for the given block. + * + * @param block the block + * @param material a fallback material + * @return a target + */ + public static Target createTarget(Block block, Material material) { + checkNotNull(material); + if (block.getType() == material) { + return new MaterialTarget(block.getTypeId(), block.getData()); + } else { + return new MaterialTarget(material.getId(), (short) 0); + } + } + + /** + * Get a blacklist target for the given item. + * + * @param item the item + * @return a target + */ + public static Target createTarget(ItemStack item) { + checkNotNull(item); + return new MaterialTarget(item.getTypeId(), item.getDurability()); + } + + /** + * Get a blacklist target for the given material. + * + * @param material the material + * @return a target + */ + public static Target createTarget(Material material) { + checkNotNull(material); + return new MaterialTarget(material.getId(), (short) 0); + } + + /** + * Get a collection of the currently online players. + * + * @return The online players + */ + @SuppressWarnings("unchecked") + public static Collection getOnlinePlayers() { + try { + return Bukkit.getServer().getOnlinePlayers(); + } catch (NoSuchMethodError ignored) { + } + + try { + if (ONLINE_PLAYERS_METHOD == null) { + ONLINE_PLAYERS_METHOD = getOnlinePlayersMethod(); + } + + Object result = ONLINE_PLAYERS_METHOD.invoke(Bukkit.getServer()); + if (result instanceof Player[]) { + return ImmutableList.copyOf((Player[]) result); + } else if (result instanceof Collection) { + return (Collection) result; + } else { + throw new RuntimeException("Result of getOnlinePlayers() call was not a known data type"); + } + } catch (Exception e) { + throw new RuntimeException("WorldGuard is not compatible with this version of Bukkit", e); + } + } + + private static Method getOnlinePlayersMethod() throws NoSuchMethodException { + try { + return Server.class.getMethod("getOnlinePlayers"); + } catch (NoSuchMethodException e1) { + return Server.class.getMethod("_INVALID_getOnlinePlayers"); + } + } + +} diff --git a/src/main/java/com/sk89q/worldguard/bukkit/ConfigurationManager.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/ConfigurationManager.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/ConfigurationManager.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/ConfigurationManager.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/ProtectionQuery.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/ProtectionQuery.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/ProtectionQuery.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/ProtectionQuery.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/QueryCache.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/QueryCache.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/QueryCache.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/QueryCache.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/RegionContainer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/RegionContainer.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/RegionContainer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/RegionContainer.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/RegionQuery.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/RegionQuery.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/RegionQuery.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/RegionQuery.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WGBukkit.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/WGBukkit.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/WGBukkit.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/WGBukkit.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java index 7b14d4e2..3b0bf4fa 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java @@ -1,1016 +1,1016 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.bukkit; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; -import com.sk89q.bukkit.util.CommandsManagerRegistration; -import com.sk89q.minecraft.util.commands.*; -import com.sk89q.squirrelid.cache.HashMapCache; -import com.sk89q.squirrelid.cache.ProfileCache; -import com.sk89q.squirrelid.cache.SQLiteCache; -import com.sk89q.squirrelid.resolver.*; -import com.sk89q.wepif.PermissionsResolverManager; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.bukkit.commands.GeneralCommands; -import com.sk89q.worldguard.bukkit.commands.ProtectionCommands; -import com.sk89q.worldguard.bukkit.commands.ToggleCommands; -import com.sk89q.worldguard.bukkit.event.player.ProcessPlayerEvent; -import com.sk89q.worldguard.bukkit.listener.*; -import com.sk89q.worldguard.bukkit.util.Events; -import com.sk89q.worldguard.protection.GlobalRegionManager; -import com.sk89q.worldguard.protection.flags.Flag; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.managers.storage.StorageException; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.util.UnresolvedNamesException; -import com.sk89q.worldguard.session.SessionManager; -import com.sk89q.worldguard.util.concurrent.EvenMoreExecutors; -import com.sk89q.worldguard.util.logging.ClassSourceValidator; -import com.sk89q.worldguard.util.logging.RecordMessagePrefixer; -import com.sk89q.worldguard.util.task.SimpleSupervisor; -import com.sk89q.worldguard.util.task.Supervisor; -import com.sk89q.worldguard.util.task.Task; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.World; -import org.bukkit.World.Environment; -import org.bukkit.block.Block; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; - -import javax.annotation.Nullable; -import java.io.*; -import java.util.*; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.jar.JarFile; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.zip.ZipEntry; - -/** - * The main class for WorldGuard as a Bukkit plugin. - */ -public class WorldGuardPlugin extends JavaPlugin { - - private static final Logger log = Logger.getLogger(WorldGuardPlugin.class.getCanonicalName()); - - private static WorldGuardPlugin inst; - private final CommandsManager commands; - private final ConfigurationManager configuration = new ConfigurationManager(this); - private final RegionContainer regionContainer = new RegionContainer(this); - private final GlobalRegionManager globalRegionManager = new GlobalRegionManager(this, regionContainer); - private SessionManager sessionManager; - private final Supervisor supervisor = new SimpleSupervisor(); - private ListeningExecutorService executorService; - private ProfileService profileService; - private ProfileCache profileCache; - private PlayerMoveListener playerMoveListener; - - /** - * Construct objects. Actual loading occurs when the plugin is enabled, so - * this merely instantiates the objects. - */ - public WorldGuardPlugin() { - final WorldGuardPlugin plugin = inst = this; - commands = new CommandsManager() { - @Override - public boolean hasPermission(CommandSender player, String perm) { - return plugin.hasPermission(player, perm); - } - }; - } - - /** - * Get the current instance of WorldGuard - * @return WorldGuardPlugin instance - */ - public static WorldGuardPlugin inst() { - return inst; - } - - /** - * Called on plugin enable. - */ - @Override - @SuppressWarnings("deprecation") - public void onEnable() { - configureLogger(); - - getDataFolder().mkdirs(); // Need to create the plugins/WorldGuard folder - - executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20)); - - sessionManager = new SessionManager(this); - - // Set the proper command injector - commands.setInjector(new SimpleInjector(this)); - - // Catch bad things being done by naughty plugins that include - // WorldGuard's classes - ClassSourceValidator verifier = new ClassSourceValidator(this); - verifier.reportMismatches(ImmutableList.of(WGBukkit.class, ProtectedRegion.class, ProtectedCuboidRegion.class, Flag.class)); - - // Register command classes - final CommandsManagerRegistration reg = new CommandsManagerRegistration(this, commands); - reg.register(ToggleCommands.class); - reg.register(ProtectionCommands.class); - - getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { - @Override - public void run() { - if (!getGlobalStateManager().hasCommandBookGodMode()) { - reg.register(GeneralCommands.class); - } - } - }, 0L); - - File cacheDir = new File(getDataFolder(), "cache"); - cacheDir.mkdirs(); - try { - profileCache = new SQLiteCache(new File(cacheDir, "profiles.sqlite")); - } catch (IOException e) { - log.log(Level.WARNING, "Failed to initialize SQLite profile cache"); - profileCache = new HashMapCache(); - } - - profileService = new CacheForwardingService( - new CombinedProfileService( - BukkitPlayerService.getInstance(), - HttpRepositoryService.forMinecraft()), - profileCache); - - PermissionsResolverManager.initialize(this); - configuration.load(); - - log.info("Loading region data..."); - regionContainer.initialize(); - - getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, SessionManager.RUN_DELAY, SessionManager.RUN_DELAY); - - // Register events - getServer().getPluginManager().registerEvents(sessionManager, this); - (new WorldGuardPlayerListener(this)).registerEvents(); - (new WorldGuardBlockListener(this)).registerEvents(); - (new WorldGuardEntityListener(this)).registerEvents(); - (new WorldGuardWeatherListener(this)).registerEvents(); - (new WorldGuardVehicleListener(this)).registerEvents(); - (new WorldGuardServerListener(this)).registerEvents(); - (new WorldGuardHangingListener(this)).registerEvents(); - - // Modules - (playerMoveListener = new PlayerMoveListener(this)).registerEvents(); - (new BlacklistListener(this)).registerEvents(); - (new ChestProtectionListener(this)).registerEvents(); - (new RegionProtectionListener(this)).registerEvents(); - (new RegionFlagsListener(this)).registerEvents(); - (new WorldRulesListener(this)).registerEvents(); - (new BlockedPotionsListener(this)).registerEvents(); - (new EventAbstractionListener(this)).registerEvents(); - (new PlayerModesListener(this)).registerEvents(); - (new BuildPermissionListener(this)).registerEvents(); - (new InvincibilityListener(this)).registerEvents(); - if ("true".equalsIgnoreCase(System.getProperty("worldguard.debug.listener"))) { - (new DebuggingListener(this, log)).registerEvents(); - } - - configuration.updateCommandBookGodMode(); - - if (getServer().getPluginManager().isPluginEnabled("CommandBook")) { - getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this); - } - - // handle worlds separately to initialize already loaded worlds - WorldGuardWorldListener worldListener = (new WorldGuardWorldListener(this)); - for (World world : getServer().getWorlds()) { - worldListener.initWorld(world); - } - worldListener.registerEvents(); - - for (Player player : BukkitUtil.getOnlinePlayers()) { - ProcessPlayerEvent event = new ProcessPlayerEvent(player); - Events.fire(event); - } - } - - @Override - public void onDisable() { - executorService.shutdown(); - - try { - log.log(Level.INFO, "Shutting down executor and waiting for any pending tasks..."); - - List> tasks = supervisor.getTasks(); - if (!tasks.isEmpty()) { - StringBuilder builder = new StringBuilder("Known tasks:"); - for (Task task : tasks) { - builder.append("\n"); - builder.append(task.getName()); - } - log.log(Level.INFO, builder.toString()); - } - - Futures.successfulAsList(tasks).get(); - executorService.awaitTermination(Integer.MAX_VALUE, TimeUnit.DAYS); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (ExecutionException e) { - log.log(Level.WARNING, "Some tasks failed while waiting for remaining tasks to finish", e); - } - - regionContainer.unload(); - configuration.unload(); - this.getServer().getScheduler().cancelTasks(this); - } - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - try { - commands.execute(cmd.getName(), args, sender, sender); - } catch (CommandPermissionsException e) { - sender.sendMessage(ChatColor.RED + "You don't have permission."); - } catch (MissingNestedCommandException e) { - sender.sendMessage(ChatColor.RED + e.getUsage()); - } catch (CommandUsageException e) { - sender.sendMessage(ChatColor.RED + e.getMessage()); - sender.sendMessage(ChatColor.RED + e.getUsage()); - } catch (WrappedCommandException e) { - sender.sendMessage(ChatColor.RED + convertThrowable(e.getCause())); - } catch (CommandException e) { - sender.sendMessage(ChatColor.RED + e.getMessage()); - } - - return true; - } - - /** - * Convert the throwable into a somewhat friendly message. - * - * @param throwable the throwable - * @return a message - */ - public String convertThrowable(@Nullable Throwable throwable) { - if (throwable instanceof NumberFormatException) { - return "Number expected, string received instead."; - } else if (throwable instanceof StorageException) { - log.log(Level.WARNING, "Error loading/saving regions", throwable); - return "Region data could not be loaded/saved: " + throwable.getMessage(); - } else if (throwable instanceof RejectedExecutionException) { - return "There are currently too many tasks queued to add yours. Use /wg running to list queued and running tasks."; - } else if (throwable instanceof CancellationException) { - return "WorldGuard: Task was cancelled"; - } else if (throwable instanceof InterruptedException) { - return "WorldGuard: Task was interrupted"; - } else if (throwable instanceof UnresolvedNamesException) { - return throwable.getMessage(); - } else if (throwable instanceof CommandException) { - return throwable.getMessage(); - } else { - log.log(Level.WARNING, "WorldGuard encountered an unexpected error", throwable); - return "WorldGuard: An unexpected error occurred! Please see the server console."; - } - } - - /** - * Get the GlobalRegionManager. - * - * @return the plugin's global region manager - * @deprecated use {@link #getRegionContainer()} - */ - @Deprecated - public GlobalRegionManager getGlobalRegionManager() { - return globalRegionManager; - } - - /** - * Get the object that manages region data. - * - * @return the region container - */ - public RegionContainer getRegionContainer() { - return regionContainer; - } - - /** - * Get the WorldGuard Configuration. - * - * @return ConfigurationManager - * @deprecated Use {@link #getGlobalStateManager()} instead - */ - @Deprecated - public ConfigurationManager getGlobalConfiguration() { - return getGlobalStateManager(); - } - - /** - * Gets the flag state manager. - * - * @return The flag state manager - */ - public SessionManager getSessionManager() { - return sessionManager; - } - - /** - * Get the global ConfigurationManager. - * USe this to access global configuration values and per-world configuration values. - * @return The global ConfigurationManager - */ - public ConfigurationManager getGlobalStateManager() { - return configuration; - } - - /** - * Get the supervisor. - * - * @return the supervisor - */ - public Supervisor getSupervisor() { - return supervisor; - } - - /** - * Get the global executor service for internal usage (please use your - * own executor service). - * - * @return the global executor service - */ - public ListeningExecutorService getExecutorService() { - return executorService; - } - - /** - * Get the profile lookup service. - * - * @return the profile lookup service - */ - public ProfileService getProfileService() { - return profileService; - } - - /** - * Get the profile cache. - * - * @return the profile cache - */ - public ProfileCache getProfileCache() { - return profileCache; - } - - /** - * Check whether a player is in a group. - * This calls the corresponding method in PermissionsResolverManager - * - * @param player The player to check - * @param group The group - * @return whether {@code player} is in {@code group} - */ - public boolean inGroup(Player player, String group) { - try { - return PermissionsResolverManager.getInstance().inGroup(player, group); - } catch (Throwable t) { - t.printStackTrace(); - return false; - } - } - - /** - * Get the groups of a player. - * This calls the corresponding method in PermissionsResolverManager. - * @param player The player to check - * @return The names of each group the playe is in. - */ - public String[] getGroups(Player player) { - try { - return PermissionsResolverManager.getInstance().getGroups(player); - } catch (Throwable t) { - t.printStackTrace(); - return new String[0]; - } - } - - /** - * Gets the name of a command sender. This is a unique name and this - * method should never return a "display name". - * - * @param sender The sender to get the name of - * @return The unique name of the sender. - */ - public String toUniqueName(CommandSender sender) { - if (sender instanceof ConsoleCommandSender) { - return "*Console*"; - } else { - return sender.getName(); - } - } - - /** - * Gets the name of a command sender. This play be a display name. - * - * @param sender The CommandSender to get the name of. - * @return The name of the given sender - */ - public String toName(CommandSender sender) { - if (sender instanceof ConsoleCommandSender) { - return "*Console*"; - } else if (sender instanceof Player) { - return ((Player) sender).getDisplayName(); - } else { - return sender.getName(); - } - } - - /** - * Checks permissions. - * - * @param sender The sender to check the permission on. - * @param perm The permission to check the permission on. - * @return whether {@code sender} has {@code perm} - */ - public boolean hasPermission(CommandSender sender, String perm) { - if (sender.isOp()) { - if (sender instanceof Player) { - if (this.getGlobalStateManager().get(((Player) sender). - getWorld()).opPermissions) { - return true; - } - } else { - return true; - } - } - - // Invoke the permissions resolver - if (sender instanceof Player) { - Player player = (Player) sender; - return PermissionsResolverManager.getInstance().hasPermission(player.getWorld().getName(), player, perm); - } - - return false; - } - - /** - * Checks permissions and throws an exception if permission is not met. - * - * @param sender The sender to check the permission on. - * @param perm The permission to check the permission on. - * @throws CommandPermissionsException if {@code sender} doesn't have {@code perm} - */ - public void checkPermission(CommandSender sender, String perm) - throws CommandPermissionsException { - if (!hasPermission(sender, perm)) { - throw new CommandPermissionsException(); - } - } - - /** - * Checks to see if the sender is a player, otherwise throw an exception. - * - * @param sender The {@link CommandSender} to check - * @return {@code sender} casted to a player - * @throws CommandException if {@code sender} isn't a {@link Player} - */ - public Player checkPlayer(CommandSender sender) - throws CommandException { - if (sender instanceof Player) { - return (Player) sender; - } else { - throw new CommandException("A player is expected."); - } - } - - /** - * Match player names. - * - * The filter string uses the following format: - * @[name] looks up all players with the exact {@code name} - * *[name] matches any player whose name contains {@code name} - * [name] matches any player whose name starts with {@code name} - * - * @param filter The filter string to check. - * @return A {@link List} of players who match {@code filter} - */ - public List matchPlayerNames(String filter) { - Collection players = BukkitUtil.getOnlinePlayers(); - - filter = filter.toLowerCase(); - - // Allow exact name matching - if (filter.charAt(0) == '@' && filter.length() >= 2) { - filter = filter.substring(1); - - for (Player player : players) { - if (player.getName().equalsIgnoreCase(filter)) { - List list = new ArrayList(); - list.add(player); - return list; - } - } - - return new ArrayList(); - // Allow partial name matching - } else if (filter.charAt(0) == '*' && filter.length() >= 2) { - filter = filter.substring(1); - - List list = new ArrayList(); - - for (Player player : players) { - if (player.getName().toLowerCase().contains(filter)) { - list.add(player); - } - } - - return list; - - // Start with name matching - } else { - List list = new ArrayList(); - - for (Player player : players) { - if (player.getName().toLowerCase().startsWith(filter)) { - list.add(player); - } - } - - return list; - } - } - - /** - * Checks if the given list of players is greater than size 0, otherwise - * throw an exception. - * - * @param players The {@link List} to check - * @return {@code players} as an {@link Iterable} - * @throws CommandException If {@code players} is empty - */ - protected Iterable checkPlayerMatch(List players) - throws CommandException { - // Check to see if there were any matches - if (players.size() == 0) { - throw new CommandException("No players matched query."); - } - - return players; - } - - /** - * Matches players based on the specified filter string - * - * The filter string format is as follows: - * * returns all the players currently online - * If {@code sender} is a {@link Player}: - * #world returns all players in the world that {@code sender} is in - * #near reaturns all players within 30 blocks of {@code sender}'s location - * Otherwise, the format is as specified in {@link #matchPlayerNames(String)} - * - * @param source The CommandSender who is trying to find a player - * @param filter The filter string for players - * @return iterator for players - * @throws CommandException if no matches are found - */ - public Iterable matchPlayers(CommandSender source, String filter) - throws CommandException { - - if (BukkitUtil.getOnlinePlayers().isEmpty()) { - throw new CommandException("No players matched query."); - } - - if (filter.equals("*")) { - return checkPlayerMatch(Lists.newArrayList(BukkitUtil.getOnlinePlayers())); - } - - // Handle special hash tag groups - if (filter.charAt(0) == '#') { - // Handle #world, which matches player of the same world as the - // calling source - if (filter.equalsIgnoreCase("#world")) { - List players = new ArrayList(); - Player sourcePlayer = checkPlayer(source); - World sourceWorld = sourcePlayer.getWorld(); - - for (Player player : BukkitUtil.getOnlinePlayers()) { - if (player.getWorld().equals(sourceWorld)) { - players.add(player); - } - } - - return checkPlayerMatch(players); - - // Handle #near, which is for nearby players. - } else if (filter.equalsIgnoreCase("#near")) { - List players = new ArrayList(); - Player sourcePlayer = checkPlayer(source); - World sourceWorld = sourcePlayer.getWorld(); - org.bukkit.util.Vector sourceVector - = sourcePlayer.getLocation().toVector(); - - for (Player player : BukkitUtil.getOnlinePlayers()) { - if (player.getWorld().equals(sourceWorld) - && player.getLocation().toVector().distanceSquared( - sourceVector) < 900) { - players.add(player); - } - } - - return checkPlayerMatch(players); - - } else { - throw new CommandException("Invalid group '" + filter + "'."); - } - } - - List players = matchPlayerNames(filter); - - return checkPlayerMatch(players); - } - - /** - * Match only a single player. - * - * @param sender The {@link CommandSender} who is requesting a player match - * @param filter The filter string. - * @see #matchPlayers(org.bukkit.entity.Player) for filter string syntax - * @return The single player - * @throws CommandException If more than one player match was found - */ - public Player matchSinglePlayer(CommandSender sender, String filter) - throws CommandException { - // This will throw an exception if there are no matches - Iterator players = matchPlayers(sender, filter).iterator(); - - Player match = players.next(); - - // We don't want to match the wrong person, so fail if if multiple - // players were found (we don't want to just pick off the first one, - // as that may be the wrong player) - if (players.hasNext()) { - throw new CommandException("More than one player found! " + - "Use @ for exact matching."); - } - - return match; - } - - /** - * Match only a single player or console. - * - * The filter string syntax is as follows: - * #console, *console, or ! return the server console - * All syntax from {@link #matchSinglePlayer(org.bukkit.command.CommandSender, String)} - * @param sender The sender trying to match a CommandSender - * @param filter The filter string - * @return The resulting CommandSender - * @throws CommandException if either zero or more than one player matched. - */ - public CommandSender matchPlayerOrConsole(CommandSender sender, String filter) - throws CommandException { - - // Let's see if console is wanted - if (filter.equalsIgnoreCase("#console") - || filter.equalsIgnoreCase("*console*") - || filter.equalsIgnoreCase("!")) { - return getServer().getConsoleSender(); - } - - return matchSinglePlayer(sender, filter); - } - - /** - * Get a single player as an iterator for players. - * - * @param player The player to return in an Iterable - * @return iterator for player - */ - public Iterable matchPlayers(Player player) { - return Arrays.asList(player); - } - - /** - * Match a world. - * - * The filter string syntax is as follows: - * #main returns the main world - * #normal returns the first world with a normal environment - * #nether return the first world with a nether environment - * #player:[name] returns the world that a player named {@code name} is located in, if the player is online. - * [name] A world with the name {@code name} - * - * @param sender The sender requesting a match - * @param filter The filter string - * @return The resulting world - * @throws CommandException if no world matches - */ - public World matchWorld(CommandSender sender, String filter) throws CommandException { - List worlds = getServer().getWorlds(); - - // Handle special hash tag groups - if (filter.charAt(0) == '#') { - // #main for the main world - if (filter.equalsIgnoreCase("#main")) { - return worlds.get(0); - - // #normal for the first normal world - } else if (filter.equalsIgnoreCase("#normal")) { - for (World world : worlds) { - if (world.getEnvironment() == Environment.NORMAL) { - return world; - } - } - - throw new CommandException("No normal world found."); - - // #nether for the first nether world - } else if (filter.equalsIgnoreCase("#nether")) { - for (World world : worlds) { - if (world.getEnvironment() == Environment.NETHER) { - return world; - } - } - - throw new CommandException("No nether world found."); - - // Handle getting a world from a player - } else if (filter.matches("^#player$")) { - String parts[] = filter.split(":", 2); - - // They didn't specify an argument for the player! - if (parts.length == 1) { - throw new CommandException("Argument expected for #player."); - } - - return matchPlayers(sender, parts[1]).iterator().next().getWorld(); - } else { - throw new CommandException("Invalid identifier '" + filter + "'."); - } - } - - for (World world : worlds) { - if (world.getName().equals(filter)) { - return world; - } - } - - throw new CommandException("No world by that exact name found."); - } - - /** - * Gets a copy of the WorldEdit plugin. - * - * @return The WorldEditPlugin instance - * @throws CommandException If there is no WorldEditPlugin available - */ - public WorldEditPlugin getWorldEdit() throws CommandException { - Plugin worldEdit = getServer().getPluginManager().getPlugin("WorldEdit"); - if (worldEdit == null) { - throw new CommandException("WorldEdit does not appear to be installed."); - } - - if (worldEdit instanceof WorldEditPlugin) { - return (WorldEditPlugin) worldEdit; - } else { - throw new CommandException("WorldEdit detection failed (report error)."); - } - } - - /** - * Wrap a player as a LocalPlayer. - * - * @param player The player to wrap - * @return The wrapped player - */ - public LocalPlayer wrapPlayer(Player player) { - return new BukkitPlayer(this, player); - } - - /** - * Wrap a player as a LocalPlayer. - * - * @param player The player to wrap - * @param silenced True to silence messages - * @return The wrapped player - */ - public LocalPlayer wrapPlayer(Player player, boolean silenced) { - return new BukkitPlayer(this, player, silenced); - } - - /** - * Wrap a player as a LocalPlayer. - * - *

This implementation is incomplete -- permissions cannot be checked.

- * - * @param player The player to wrap - * @return The wrapped player - */ - public LocalPlayer wrapOfflinePlayer(OfflinePlayer player) { - return new BukkitOfflinePlayer(player); - } - - /** - * Return a protection query helper object that can be used by another - * plugin to test whether WorldGuard permits an action at a particular - * place. - * - * @return an instance - */ - public ProtectionQuery createProtectionQuery() { - return new ProtectionQuery(); - } - - /** - * Configure WorldGuard's loggers. - */ - private void configureLogger() { - RecordMessagePrefixer.register(Logger.getLogger("com.sk89q.worldguard"), "[WorldGuard] "); - } - - /** - * Create a default configuration file from the .jar. - * - * @param actual The destination file - * @param defaultName The name of the file inside the jar's defaults folder - */ - public void createDefaultConfiguration(File actual, - String defaultName) { - - // Make parent directories - File parent = actual.getParentFile(); - if (!parent.exists()) { - parent.mkdirs(); - } - - if (actual.exists()) { - return; - } - - InputStream input = - null; - try { - JarFile file = new JarFile(getFile()); - ZipEntry copy = file.getEntry("defaults/" + defaultName); - if (copy == null) throw new FileNotFoundException(); - input = file.getInputStream(copy); - } catch (IOException e) { - log.severe("Unable to read default configuration: " + defaultName); - } - - if (input != null) { - FileOutputStream output = null; - - try { - output = new FileOutputStream(actual); - byte[] buf = new byte[8192]; - int length = 0; - while ((length = input.read(buf)) > 0) { - output.write(buf, 0, length); - } - - log.info("Default configuration file written: " - + actual.getAbsolutePath()); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (input != null) { - input.close(); - } - } catch (IOException ignore) { - } - - try { - if (output != null) { - output.close(); - } - } catch (IOException ignore) { - } - } - } - } - - /** - * Notifies all with the worldguard.notify permission. - * This will check both superperms and WEPIF, - * but makes sure WEPIF checks don't result in duplicate notifications - * - * @param msg The notification to broadcast - */ - public void broadcastNotification(String msg) { - getServer().broadcast(msg, "worldguard.notify"); - Set subs = getServer().getPluginManager().getPermissionSubscriptions("worldguard.notify"); - for (Player player : BukkitUtil.getOnlinePlayers()) { - if (!(subs.contains(player) && player.hasPermission("worldguard.notify")) && - hasPermission(player, "worldguard.notify")) { // Make sure the player wasn't already broadcasted to. - player.sendMessage(msg); - } - } - log.info(msg); - } - - /** - * Checks to see if a player can build at a location. This will return - * true if region protection is disabled. - * - * @param player The player to check. - * @param loc The location to check at. - * @see GlobalRegionManager#canBuild(org.bukkit.entity.Player, org.bukkit.Location) - * @return whether {@code player} can build at {@code loc} - */ - public boolean canBuild(Player player, Location loc) { - return getGlobalRegionManager().canBuild(player, loc); - } - - /** - * Checks to see if a player can build at a location. This will return - * true if region protection is disabled. - * - * @param player The player to check - * @param block The block to check at. - * @see GlobalRegionManager#canBuild(org.bukkit.entity.Player, org.bukkit.block.Block) - * @return whether {@code player} can build at {@code block}'s location - */ - public boolean canBuild(Player player, Block block) { - return getGlobalRegionManager().canBuild(player, block); - } - - /** - * Gets the region manager for a world. - * - * @param world world to get the region manager for - * @return the region manager or null if regions are not enabled - */ - public RegionManager getRegionManager(World world) { - if (!getGlobalStateManager().get(world).useRegions) { - return null; - } - - return getGlobalRegionManager().get(world); - } - - public PlayerMoveListener getPlayerMoveListener() { - return playerMoveListener; - } - - /** - * Replace macros in the text. - * - * The macros replaced are as follows: - * %name%: The name of {@code sender}. See {@link #toName(org.bukkit.command.CommandSender)} - * %id%: The unique name of the sender. See {@link #toUniqueName(org.bukkit.command.CommandSender)} - * %online%: The number of players currently online on the server - * If {@code sender} is a Player: - * %world%: The name of the world {@code sender} is located in - * %health%: The health of {@code sender}. See {@link org.bukkit.entity.Player#getHealth()} - * - * @param sender The sender to check - * @param message The message to replace macros in - * @return The message with macros replaced - */ - public String replaceMacros(CommandSender sender, String message) { - Collection online = BukkitUtil.getOnlinePlayers(); - - message = message.replace("%name%", toName(sender)); - message = message.replace("%id%", toUniqueName(sender)); - message = message.replace("%online%", String.valueOf(online.size())); - - if (sender instanceof Player) { - Player player = (Player) sender; - World world = player.getWorld(); - - message = message.replace("%world%", world.getName()); - message = message.replace("%health%", String.valueOf(player.getHealth())); - } - - return message; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.bukkit; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; +import com.sk89q.bukkit.util.CommandsManagerRegistration; +import com.sk89q.minecraft.util.commands.*; +import com.sk89q.squirrelid.cache.HashMapCache; +import com.sk89q.squirrelid.cache.ProfileCache; +import com.sk89q.squirrelid.cache.SQLiteCache; +import com.sk89q.squirrelid.resolver.*; +import com.sk89q.wepif.PermissionsResolverManager; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.bukkit.commands.GeneralCommands; +import com.sk89q.worldguard.bukkit.commands.ProtectionCommands; +import com.sk89q.worldguard.bukkit.commands.ToggleCommands; +import com.sk89q.worldguard.bukkit.event.player.ProcessPlayerEvent; +import com.sk89q.worldguard.bukkit.listener.*; +import com.sk89q.worldguard.bukkit.util.Events; +import com.sk89q.worldguard.protection.GlobalRegionManager; +import com.sk89q.worldguard.protection.flags.Flag; +import com.sk89q.worldguard.protection.managers.RegionManager; +import com.sk89q.worldguard.protection.managers.storage.StorageException; +import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import com.sk89q.worldguard.protection.util.UnresolvedNamesException; +import com.sk89q.worldguard.session.SessionManager; +import com.sk89q.worldguard.util.concurrent.EvenMoreExecutors; +import com.sk89q.worldguard.util.logging.ClassSourceValidator; +import com.sk89q.worldguard.util.logging.RecordMessagePrefixer; +import com.sk89q.worldguard.util.task.SimpleSupervisor; +import com.sk89q.worldguard.util.task.Supervisor; +import com.sk89q.worldguard.util.task.Task; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; +import org.bukkit.permissions.Permissible; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.JavaPlugin; + +import javax.annotation.Nullable; +import java.io.*; +import java.util.*; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.jar.JarFile; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.zip.ZipEntry; + +/** + * The main class for WorldGuard as a Bukkit plugin. + */ +public class WorldGuardPlugin extends JavaPlugin { + + private static final Logger log = Logger.getLogger(WorldGuardPlugin.class.getCanonicalName()); + + private static WorldGuardPlugin inst; + private final CommandsManager commands; + private final ConfigurationManager configuration = new ConfigurationManager(this); + private final RegionContainer regionContainer = new RegionContainer(this); + private final GlobalRegionManager globalRegionManager = new GlobalRegionManager(this, regionContainer); + private SessionManager sessionManager; + private final Supervisor supervisor = new SimpleSupervisor(); + private ListeningExecutorService executorService; + private ProfileService profileService; + private ProfileCache profileCache; + private PlayerMoveListener playerMoveListener; + + /** + * Construct objects. Actual loading occurs when the plugin is enabled, so + * this merely instantiates the objects. + */ + public WorldGuardPlugin() { + final WorldGuardPlugin plugin = inst = this; + commands = new CommandsManager() { + @Override + public boolean hasPermission(CommandSender player, String perm) { + return plugin.hasPermission(player, perm); + } + }; + } + + /** + * Get the current instance of WorldGuard + * @return WorldGuardPlugin instance + */ + public static WorldGuardPlugin inst() { + return inst; + } + + /** + * Called on plugin enable. + */ + @Override + @SuppressWarnings("deprecation") + public void onEnable() { + configureLogger(); + + getDataFolder().mkdirs(); // Need to create the plugins/WorldGuard folder + + executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20)); + + sessionManager = new SessionManager(this); + + // Set the proper command injector + commands.setInjector(new SimpleInjector(this)); + + // Catch bad things being done by naughty plugins that include + // WorldGuard's classes + ClassSourceValidator verifier = new ClassSourceValidator(this); + verifier.reportMismatches(ImmutableList.of(WGBukkit.class, ProtectedRegion.class, ProtectedCuboidRegion.class, Flag.class)); + + // Register command classes + final CommandsManagerRegistration reg = new CommandsManagerRegistration(this, commands); + reg.register(ToggleCommands.class); + reg.register(ProtectionCommands.class); + + getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + @Override + public void run() { + if (!getGlobalStateManager().hasCommandBookGodMode()) { + reg.register(GeneralCommands.class); + } + } + }, 0L); + + File cacheDir = new File(getDataFolder(), "cache"); + cacheDir.mkdirs(); + try { + profileCache = new SQLiteCache(new File(cacheDir, "profiles.sqlite")); + } catch (IOException e) { + log.log(Level.WARNING, "Failed to initialize SQLite profile cache"); + profileCache = new HashMapCache(); + } + + profileService = new CacheForwardingService( + new CombinedProfileService( + BukkitPlayerService.getInstance(), + HttpRepositoryService.forMinecraft()), + profileCache); + + PermissionsResolverManager.initialize(this); + configuration.load(); + + log.info("Loading region data..."); + regionContainer.initialize(); + + getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, SessionManager.RUN_DELAY, SessionManager.RUN_DELAY); + + // Register events + getServer().getPluginManager().registerEvents(sessionManager, this); + (new WorldGuardPlayerListener(this)).registerEvents(); + (new WorldGuardBlockListener(this)).registerEvents(); + (new WorldGuardEntityListener(this)).registerEvents(); + (new WorldGuardWeatherListener(this)).registerEvents(); + (new WorldGuardVehicleListener(this)).registerEvents(); + (new WorldGuardServerListener(this)).registerEvents(); + (new WorldGuardHangingListener(this)).registerEvents(); + + // Modules + (playerMoveListener = new PlayerMoveListener(this)).registerEvents(); + (new BlacklistListener(this)).registerEvents(); + (new ChestProtectionListener(this)).registerEvents(); + (new RegionProtectionListener(this)).registerEvents(); + (new RegionFlagsListener(this)).registerEvents(); + (new WorldRulesListener(this)).registerEvents(); + (new BlockedPotionsListener(this)).registerEvents(); + (new EventAbstractionListener(this)).registerEvents(); + (new PlayerModesListener(this)).registerEvents(); + (new BuildPermissionListener(this)).registerEvents(); + (new InvincibilityListener(this)).registerEvents(); + if ("true".equalsIgnoreCase(System.getProperty("worldguard.debug.listener"))) { + (new DebuggingListener(this, log)).registerEvents(); + } + + configuration.updateCommandBookGodMode(); + + if (getServer().getPluginManager().isPluginEnabled("CommandBook")) { + getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this); + } + + // handle worlds separately to initialize already loaded worlds + WorldGuardWorldListener worldListener = (new WorldGuardWorldListener(this)); + for (World world : getServer().getWorlds()) { + worldListener.initWorld(world); + } + worldListener.registerEvents(); + + for (Player player : BukkitUtil.getOnlinePlayers()) { + ProcessPlayerEvent event = new ProcessPlayerEvent(player); + Events.fire(event); + } + } + + @Override + public void onDisable() { + executorService.shutdown(); + + try { + log.log(Level.INFO, "Shutting down executor and waiting for any pending tasks..."); + + List> tasks = supervisor.getTasks(); + if (!tasks.isEmpty()) { + StringBuilder builder = new StringBuilder("Known tasks:"); + for (Task task : tasks) { + builder.append("\n"); + builder.append(task.getName()); + } + log.log(Level.INFO, builder.toString()); + } + + Futures.successfulAsList(tasks).get(); + executorService.awaitTermination(Integer.MAX_VALUE, TimeUnit.DAYS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + log.log(Level.WARNING, "Some tasks failed while waiting for remaining tasks to finish", e); + } + + regionContainer.unload(); + configuration.unload(); + this.getServer().getScheduler().cancelTasks(this); + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + try { + commands.execute(cmd.getName(), args, sender, sender); + } catch (CommandPermissionsException e) { + sender.sendMessage(ChatColor.RED + "You don't have permission."); + } catch (MissingNestedCommandException e) { + sender.sendMessage(ChatColor.RED + e.getUsage()); + } catch (CommandUsageException e) { + sender.sendMessage(ChatColor.RED + e.getMessage()); + sender.sendMessage(ChatColor.RED + e.getUsage()); + } catch (WrappedCommandException e) { + sender.sendMessage(ChatColor.RED + convertThrowable(e.getCause())); + } catch (CommandException e) { + sender.sendMessage(ChatColor.RED + e.getMessage()); + } + + return true; + } + + /** + * Convert the throwable into a somewhat friendly message. + * + * @param throwable the throwable + * @return a message + */ + public String convertThrowable(@Nullable Throwable throwable) { + if (throwable instanceof NumberFormatException) { + return "Number expected, string received instead."; + } else if (throwable instanceof StorageException) { + log.log(Level.WARNING, "Error loading/saving regions", throwable); + return "Region data could not be loaded/saved: " + throwable.getMessage(); + } else if (throwable instanceof RejectedExecutionException) { + return "There are currently too many tasks queued to add yours. Use /wg running to list queued and running tasks."; + } else if (throwable instanceof CancellationException) { + return "WorldGuard: Task was cancelled"; + } else if (throwable instanceof InterruptedException) { + return "WorldGuard: Task was interrupted"; + } else if (throwable instanceof UnresolvedNamesException) { + return throwable.getMessage(); + } else if (throwable instanceof CommandException) { + return throwable.getMessage(); + } else { + log.log(Level.WARNING, "WorldGuard encountered an unexpected error", throwable); + return "WorldGuard: An unexpected error occurred! Please see the server console."; + } + } + + /** + * Get the GlobalRegionManager. + * + * @return the plugin's global region manager + * @deprecated use {@link #getRegionContainer()} + */ + @Deprecated + public GlobalRegionManager getGlobalRegionManager() { + return globalRegionManager; + } + + /** + * Get the object that manages region data. + * + * @return the region container + */ + public RegionContainer getRegionContainer() { + return regionContainer; + } + + /** + * Get the WorldGuard Configuration. + * + * @return ConfigurationManager + * @deprecated Use {@link #getGlobalStateManager()} instead + */ + @Deprecated + public ConfigurationManager getGlobalConfiguration() { + return getGlobalStateManager(); + } + + /** + * Gets the flag state manager. + * + * @return The flag state manager + */ + public SessionManager getSessionManager() { + return sessionManager; + } + + /** + * Get the global ConfigurationManager. + * USe this to access global configuration values and per-world configuration values. + * @return The global ConfigurationManager + */ + public ConfigurationManager getGlobalStateManager() { + return configuration; + } + + /** + * Get the supervisor. + * + * @return the supervisor + */ + public Supervisor getSupervisor() { + return supervisor; + } + + /** + * Get the global executor service for internal usage (please use your + * own executor service). + * + * @return the global executor service + */ + public ListeningExecutorService getExecutorService() { + return executorService; + } + + /** + * Get the profile lookup service. + * + * @return the profile lookup service + */ + public ProfileService getProfileService() { + return profileService; + } + + /** + * Get the profile cache. + * + * @return the profile cache + */ + public ProfileCache getProfileCache() { + return profileCache; + } + + /** + * Check whether a player is in a group. + * This calls the corresponding method in PermissionsResolverManager + * + * @param player The player to check + * @param group The group + * @return whether {@code player} is in {@code group} + */ + public boolean inGroup(Player player, String group) { + try { + return PermissionsResolverManager.getInstance().inGroup(player, group); + } catch (Throwable t) { + t.printStackTrace(); + return false; + } + } + + /** + * Get the groups of a player. + * This calls the corresponding method in PermissionsResolverManager. + * @param player The player to check + * @return The names of each group the playe is in. + */ + public String[] getGroups(Player player) { + try { + return PermissionsResolverManager.getInstance().getGroups(player); + } catch (Throwable t) { + t.printStackTrace(); + return new String[0]; + } + } + + /** + * Gets the name of a command sender. This is a unique name and this + * method should never return a "display name". + * + * @param sender The sender to get the name of + * @return The unique name of the sender. + */ + public String toUniqueName(CommandSender sender) { + if (sender instanceof ConsoleCommandSender) { + return "*Console*"; + } else { + return sender.getName(); + } + } + + /** + * Gets the name of a command sender. This play be a display name. + * + * @param sender The CommandSender to get the name of. + * @return The name of the given sender + */ + public String toName(CommandSender sender) { + if (sender instanceof ConsoleCommandSender) { + return "*Console*"; + } else if (sender instanceof Player) { + return ((Player) sender).getDisplayName(); + } else { + return sender.getName(); + } + } + + /** + * Checks permissions. + * + * @param sender The sender to check the permission on. + * @param perm The permission to check the permission on. + * @return whether {@code sender} has {@code perm} + */ + public boolean hasPermission(CommandSender sender, String perm) { + if (sender.isOp()) { + if (sender instanceof Player) { + if (this.getGlobalStateManager().get(((Player) sender). + getWorld()).opPermissions) { + return true; + } + } else { + return true; + } + } + + // Invoke the permissions resolver + if (sender instanceof Player) { + Player player = (Player) sender; + return PermissionsResolverManager.getInstance().hasPermission(player.getWorld().getName(), player, perm); + } + + return false; + } + + /** + * Checks permissions and throws an exception if permission is not met. + * + * @param sender The sender to check the permission on. + * @param perm The permission to check the permission on. + * @throws CommandPermissionsException if {@code sender} doesn't have {@code perm} + */ + public void checkPermission(CommandSender sender, String perm) + throws CommandPermissionsException { + if (!hasPermission(sender, perm)) { + throw new CommandPermissionsException(); + } + } + + /** + * Checks to see if the sender is a player, otherwise throw an exception. + * + * @param sender The {@link CommandSender} to check + * @return {@code sender} casted to a player + * @throws CommandException if {@code sender} isn't a {@link Player} + */ + public Player checkPlayer(CommandSender sender) + throws CommandException { + if (sender instanceof Player) { + return (Player) sender; + } else { + throw new CommandException("A player is expected."); + } + } + + /** + * Match player names. + * + * The filter string uses the following format: + * @[name] looks up all players with the exact {@code name} + * *[name] matches any player whose name contains {@code name} + * [name] matches any player whose name starts with {@code name} + * + * @param filter The filter string to check. + * @return A {@link List} of players who match {@code filter} + */ + public List matchPlayerNames(String filter) { + Collection players = BukkitUtil.getOnlinePlayers(); + + filter = filter.toLowerCase(); + + // Allow exact name matching + if (filter.charAt(0) == '@' && filter.length() >= 2) { + filter = filter.substring(1); + + for (Player player : players) { + if (player.getName().equalsIgnoreCase(filter)) { + List list = new ArrayList(); + list.add(player); + return list; + } + } + + return new ArrayList(); + // Allow partial name matching + } else if (filter.charAt(0) == '*' && filter.length() >= 2) { + filter = filter.substring(1); + + List list = new ArrayList(); + + for (Player player : players) { + if (player.getName().toLowerCase().contains(filter)) { + list.add(player); + } + } + + return list; + + // Start with name matching + } else { + List list = new ArrayList(); + + for (Player player : players) { + if (player.getName().toLowerCase().startsWith(filter)) { + list.add(player); + } + } + + return list; + } + } + + /** + * Checks if the given list of players is greater than size 0, otherwise + * throw an exception. + * + * @param players The {@link List} to check + * @return {@code players} as an {@link Iterable} + * @throws CommandException If {@code players} is empty + */ + protected Iterable checkPlayerMatch(List players) + throws CommandException { + // Check to see if there were any matches + if (players.size() == 0) { + throw new CommandException("No players matched query."); + } + + return players; + } + + /** + * Matches players based on the specified filter string + * + * The filter string format is as follows: + * * returns all the players currently online + * If {@code sender} is a {@link Player}: + * #world returns all players in the world that {@code sender} is in + * #near reaturns all players within 30 blocks of {@code sender}'s location + * Otherwise, the format is as specified in {@link #matchPlayerNames(String)} + * + * @param source The CommandSender who is trying to find a player + * @param filter The filter string for players + * @return iterator for players + * @throws CommandException if no matches are found + */ + public Iterable matchPlayers(CommandSender source, String filter) + throws CommandException { + + if (BukkitUtil.getOnlinePlayers().isEmpty()) { + throw new CommandException("No players matched query."); + } + + if (filter.equals("*")) { + return checkPlayerMatch(Lists.newArrayList(BukkitUtil.getOnlinePlayers())); + } + + // Handle special hash tag groups + if (filter.charAt(0) == '#') { + // Handle #world, which matches player of the same world as the + // calling source + if (filter.equalsIgnoreCase("#world")) { + List players = new ArrayList(); + Player sourcePlayer = checkPlayer(source); + World sourceWorld = sourcePlayer.getWorld(); + + for (Player player : BukkitUtil.getOnlinePlayers()) { + if (player.getWorld().equals(sourceWorld)) { + players.add(player); + } + } + + return checkPlayerMatch(players); + + // Handle #near, which is for nearby players. + } else if (filter.equalsIgnoreCase("#near")) { + List players = new ArrayList(); + Player sourcePlayer = checkPlayer(source); + World sourceWorld = sourcePlayer.getWorld(); + org.bukkit.util.Vector sourceVector + = sourcePlayer.getLocation().toVector(); + + for (Player player : BukkitUtil.getOnlinePlayers()) { + if (player.getWorld().equals(sourceWorld) + && player.getLocation().toVector().distanceSquared( + sourceVector) < 900) { + players.add(player); + } + } + + return checkPlayerMatch(players); + + } else { + throw new CommandException("Invalid group '" + filter + "'."); + } + } + + List players = matchPlayerNames(filter); + + return checkPlayerMatch(players); + } + + /** + * Match only a single player. + * + * @param sender The {@link CommandSender} who is requesting a player match + * @param filter The filter string. + * @see #matchPlayers(org.bukkit.entity.Player) for filter string syntax + * @return The single player + * @throws CommandException If more than one player match was found + */ + public Player matchSinglePlayer(CommandSender sender, String filter) + throws CommandException { + // This will throw an exception if there are no matches + Iterator players = matchPlayers(sender, filter).iterator(); + + Player match = players.next(); + + // We don't want to match the wrong person, so fail if if multiple + // players were found (we don't want to just pick off the first one, + // as that may be the wrong player) + if (players.hasNext()) { + throw new CommandException("More than one player found! " + + "Use @ for exact matching."); + } + + return match; + } + + /** + * Match only a single player or console. + * + * The filter string syntax is as follows: + * #console, *console, or ! return the server console + * All syntax from {@link #matchSinglePlayer(org.bukkit.command.CommandSender, String)} + * @param sender The sender trying to match a CommandSender + * @param filter The filter string + * @return The resulting CommandSender + * @throws CommandException if either zero or more than one player matched. + */ + public CommandSender matchPlayerOrConsole(CommandSender sender, String filter) + throws CommandException { + + // Let's see if console is wanted + if (filter.equalsIgnoreCase("#console") + || filter.equalsIgnoreCase("*console*") + || filter.equalsIgnoreCase("!")) { + return getServer().getConsoleSender(); + } + + return matchSinglePlayer(sender, filter); + } + + /** + * Get a single player as an iterator for players. + * + * @param player The player to return in an Iterable + * @return iterator for player + */ + public Iterable matchPlayers(Player player) { + return Arrays.asList(player); + } + + /** + * Match a world. + * + * The filter string syntax is as follows: + * #main returns the main world + * #normal returns the first world with a normal environment + * #nether return the first world with a nether environment + * #player:[name] returns the world that a player named {@code name} is located in, if the player is online. + * [name] A world with the name {@code name} + * + * @param sender The sender requesting a match + * @param filter The filter string + * @return The resulting world + * @throws CommandException if no world matches + */ + public World matchWorld(CommandSender sender, String filter) throws CommandException { + List worlds = getServer().getWorlds(); + + // Handle special hash tag groups + if (filter.charAt(0) == '#') { + // #main for the main world + if (filter.equalsIgnoreCase("#main")) { + return worlds.get(0); + + // #normal for the first normal world + } else if (filter.equalsIgnoreCase("#normal")) { + for (World world : worlds) { + if (world.getEnvironment() == Environment.NORMAL) { + return world; + } + } + + throw new CommandException("No normal world found."); + + // #nether for the first nether world + } else if (filter.equalsIgnoreCase("#nether")) { + for (World world : worlds) { + if (world.getEnvironment() == Environment.NETHER) { + return world; + } + } + + throw new CommandException("No nether world found."); + + // Handle getting a world from a player + } else if (filter.matches("^#player$")) { + String parts[] = filter.split(":", 2); + + // They didn't specify an argument for the player! + if (parts.length == 1) { + throw new CommandException("Argument expected for #player."); + } + + return matchPlayers(sender, parts[1]).iterator().next().getWorld(); + } else { + throw new CommandException("Invalid identifier '" + filter + "'."); + } + } + + for (World world : worlds) { + if (world.getName().equals(filter)) { + return world; + } + } + + throw new CommandException("No world by that exact name found."); + } + + /** + * Gets a copy of the WorldEdit plugin. + * + * @return The WorldEditPlugin instance + * @throws CommandException If there is no WorldEditPlugin available + */ + public WorldEditPlugin getWorldEdit() throws CommandException { + Plugin worldEdit = getServer().getPluginManager().getPlugin("WorldEdit"); + if (worldEdit == null) { + throw new CommandException("WorldEdit does not appear to be installed."); + } + + if (worldEdit instanceof WorldEditPlugin) { + return (WorldEditPlugin) worldEdit; + } else { + throw new CommandException("WorldEdit detection failed (report error)."); + } + } + + /** + * Wrap a player as a LocalPlayer. + * + * @param player The player to wrap + * @return The wrapped player + */ + public LocalPlayer wrapPlayer(Player player) { + return new BukkitPlayer(this, player); + } + + /** + * Wrap a player as a LocalPlayer. + * + * @param player The player to wrap + * @param silenced True to silence messages + * @return The wrapped player + */ + public LocalPlayer wrapPlayer(Player player, boolean silenced) { + return new BukkitPlayer(this, player, silenced); + } + + /** + * Wrap a player as a LocalPlayer. + * + *

This implementation is incomplete -- permissions cannot be checked.

+ * + * @param player The player to wrap + * @return The wrapped player + */ + public LocalPlayer wrapOfflinePlayer(OfflinePlayer player) { + return new BukkitOfflinePlayer(player); + } + + /** + * Return a protection query helper object that can be used by another + * plugin to test whether WorldGuard permits an action at a particular + * place. + * + * @return an instance + */ + public ProtectionQuery createProtectionQuery() { + return new ProtectionQuery(); + } + + /** + * Configure WorldGuard's loggers. + */ + private void configureLogger() { + RecordMessagePrefixer.register(Logger.getLogger("com.sk89q.worldguard"), "[WorldGuard] "); + } + + /** + * Create a default configuration file from the .jar. + * + * @param actual The destination file + * @param defaultName The name of the file inside the jar's defaults folder + */ + public void createDefaultConfiguration(File actual, + String defaultName) { + + // Make parent directories + File parent = actual.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + + if (actual.exists()) { + return; + } + + InputStream input = + null; + try { + JarFile file = new JarFile(getFile()); + ZipEntry copy = file.getEntry("defaults/" + defaultName); + if (copy == null) throw new FileNotFoundException(); + input = file.getInputStream(copy); + } catch (IOException e) { + log.severe("Unable to read default configuration: " + defaultName); + } + + if (input != null) { + FileOutputStream output = null; + + try { + output = new FileOutputStream(actual); + byte[] buf = new byte[8192]; + int length = 0; + while ((length = input.read(buf)) > 0) { + output.write(buf, 0, length); + } + + log.info("Default configuration file written: " + + actual.getAbsolutePath()); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (input != null) { + input.close(); + } + } catch (IOException ignore) { + } + + try { + if (output != null) { + output.close(); + } + } catch (IOException ignore) { + } + } + } + } + + /** + * Notifies all with the worldguard.notify permission. + * This will check both superperms and WEPIF, + * but makes sure WEPIF checks don't result in duplicate notifications + * + * @param msg The notification to broadcast + */ + public void broadcastNotification(String msg) { + getServer().broadcast(msg, "worldguard.notify"); + Set subs = getServer().getPluginManager().getPermissionSubscriptions("worldguard.notify"); + for (Player player : BukkitUtil.getOnlinePlayers()) { + if (!(subs.contains(player) && player.hasPermission("worldguard.notify")) && + hasPermission(player, "worldguard.notify")) { // Make sure the player wasn't already broadcasted to. + player.sendMessage(msg); + } + } + log.info(msg); + } + + /** + * Checks to see if a player can build at a location. This will return + * true if region protection is disabled. + * + * @param player The player to check. + * @param loc The location to check at. + * @see GlobalRegionManager#canBuild(org.bukkit.entity.Player, org.bukkit.Location) + * @return whether {@code player} can build at {@code loc} + */ + public boolean canBuild(Player player, Location loc) { + return getGlobalRegionManager().canBuild(player, loc); + } + + /** + * Checks to see if a player can build at a location. This will return + * true if region protection is disabled. + * + * @param player The player to check + * @param block The block to check at. + * @see GlobalRegionManager#canBuild(org.bukkit.entity.Player, org.bukkit.block.Block) + * @return whether {@code player} can build at {@code block}'s location + */ + public boolean canBuild(Player player, Block block) { + return getGlobalRegionManager().canBuild(player, block); + } + + /** + * Gets the region manager for a world. + * + * @param world world to get the region manager for + * @return the region manager or null if regions are not enabled + */ + public RegionManager getRegionManager(World world) { + if (!getGlobalStateManager().get(world).useRegions) { + return null; + } + + return getGlobalRegionManager().get(world); + } + + public PlayerMoveListener getPlayerMoveListener() { + return playerMoveListener; + } + + /** + * Replace macros in the text. + * + * The macros replaced are as follows: + * %name%: The name of {@code sender}. See {@link #toName(org.bukkit.command.CommandSender)} + * %id%: The unique name of the sender. See {@link #toUniqueName(org.bukkit.command.CommandSender)} + * %online%: The number of players currently online on the server + * If {@code sender} is a Player: + * %world%: The name of the world {@code sender} is located in + * %health%: The health of {@code sender}. See {@link org.bukkit.entity.Player#getHealth()} + * + * @param sender The sender to check + * @param message The message to replace macros in + * @return The message with macros replaced + */ + public String replaceMacros(CommandSender sender, String message) { + Collection online = BukkitUtil.getOnlinePlayers(); + + message = message.replace("%name%", toName(sender)); + message = message.replace("%id%", toUniqueName(sender)); + message = message.replace("%online%", String.valueOf(online.size())); + + if (sender instanceof Player) { + Player player = (Player) sender; + World world = player.getWorld(); + + message = message.replace("%world%", world.getName()); + message = message.replace("%health%", String.valueOf(player.getHealth())); + } + + return message; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/AsyncCommandHelper.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/AsyncCommandHelper.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/AsyncCommandHelper.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/AsyncCommandHelper.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/CommandUtils.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/CommandUtils.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/CommandUtils.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/CommandUtils.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/DebuggingCommands.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/DebuggingCommands.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/DebuggingCommands.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/DebuggingCommands.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/FutureProgressListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/FutureProgressListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/FutureProgressListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/FutureProgressListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java index bc6dd347..bbac5154 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java @@ -1,311 +1,311 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.bukkit.commands; - -import com.sk89q.minecraft.util.commands.Command; -import com.sk89q.minecraft.util.commands.CommandContext; -import com.sk89q.minecraft.util.commands.CommandException; -import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.blocks.ItemType; -import com.sk89q.worldguard.bukkit.ConfigurationManager; -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; -import com.sk89q.worldguard.session.Session; -import com.sk89q.worldguard.session.handler.GodMode; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class GeneralCommands { - private final WorldGuardPlugin plugin; - - public GeneralCommands(WorldGuardPlugin plugin) { - this.plugin = plugin; - } - - @SuppressWarnings("deprecation") - @Command(aliases = {"god"}, usage = "[player]", - desc = "Enable godmode on a player", flags = "s", max = 1) - public void god(CommandContext args, CommandSender sender) throws CommandException { - ConfigurationManager config = plugin.getGlobalStateManager(); - - Iterable targets = null; - boolean included = false; - - // Detect arguments based on the number of arguments provided - if (args.argsLength() == 0) { - targets = plugin.matchPlayers(plugin.checkPlayer(sender)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.god"); - } else { - targets = plugin.matchPlayers(sender, args.getString(0)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.god.other"); - } - - for (Player player : targets) { - Session session = plugin.getSessionManager().get(player); - - if (GodMode.set(player, session, true)) { - player.setFireTicks(0); - - // Tell the user - if (player.equals(sender)) { - player.sendMessage(ChatColor.YELLOW + "God mode enabled! Use /ungod to disable."); - - // Keep track of this - included = true; - } else { - player.sendMessage(ChatColor.YELLOW + "God enabled by " - + plugin.toName(sender) + "."); - - } - } - } - - // The player didn't receive any items, then we need to send the - // user a message so s/he know that something is indeed working - if (!included && args.hasFlag('s')) { - sender.sendMessage(ChatColor.YELLOW + "Players now have god mode."); - } - } - - @SuppressWarnings("deprecation") - @Command(aliases = {"ungod"}, usage = "[player]", - desc = "Disable godmode on a player", flags = "s", max = 1) - public void ungod(CommandContext args, CommandSender sender) throws CommandException { - ConfigurationManager config = plugin.getGlobalStateManager(); - - Iterable targets = null; - boolean included = false; - - // Detect arguments based on the number of arguments provided - if (args.argsLength() == 0) { - targets = plugin.matchPlayers(plugin.checkPlayer(sender)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.god"); - } else { - targets = plugin.matchPlayers(sender, args.getString(0)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.god.other"); - } - - for (Player player : targets) { - Session session = plugin.getSessionManager().get(player); - - if (GodMode.set(player, session, false)) { - // Tell the user - if (player.equals(sender)) { - player.sendMessage(ChatColor.YELLOW + "God mode disabled!"); - - // Keep track of this - included = true; - } else { - player.sendMessage(ChatColor.YELLOW + "God disabled by " - + plugin.toName(sender) + "."); - - } - } - } - - // The player didn't receive any items, then we need to send the - // user a message so s/he know that something is indeed working - if (!included && args.hasFlag('s')) { - sender.sendMessage(ChatColor.YELLOW + "Players no longer have god mode."); - } - } - - @Command(aliases = {"heal"}, usage = "[player]", desc = "Heal a player", flags = "s", max = 1) - public void heal(CommandContext args,CommandSender sender) throws CommandException { - - Iterable targets = null; - boolean included = false; - - // Detect arguments based on the number of arguments provided - if (args.argsLength() == 0) { - targets = plugin.matchPlayers(plugin.checkPlayer(sender)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.heal"); - } else if (args.argsLength() == 1) { - targets = plugin.matchPlayers(sender, args.getString(0)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.heal.other"); - } - - for (Player player : targets) { - player.setHealth(player.getMaxHealth()); - player.setFoodLevel(20); - - // Tell the user - if (player.equals(sender)) { - player.sendMessage(ChatColor.YELLOW + "Healed!"); - - // Keep track of this - included = true; - } else { - player.sendMessage(ChatColor.YELLOW + "Healed by " - + plugin.toName(sender) + "."); - - } - } - - // The player didn't receive any items, then we need to send the - // user a message so s/he know that something is indeed working - if (!included && args.hasFlag('s')) { - sender.sendMessage(ChatColor.YELLOW.toString() + "Players healed."); - } - } - - @Command(aliases = {"slay"}, usage = "[player]", desc = "Slay a player", flags = "s", max = 1) - public void slay(CommandContext args, CommandSender sender) throws CommandException { - - Iterable targets = null; - boolean included = false; - - // Detect arguments based on the number of arguments provided - if (args.argsLength() == 0) { - targets = plugin.matchPlayers(plugin.checkPlayer(sender)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.slay"); - } else if (args.argsLength() == 1) { - targets = plugin.matchPlayers(sender, args.getString(0)); - - // Check permissions! - plugin.checkPermission(sender, "worldguard.slay.other"); - } - - for (Player player : targets) { - player.setHealth(0); - - // Tell the user - if (player.equals(sender)) { - player.sendMessage(ChatColor.YELLOW + "Slain!"); - - // Keep track of this - included = true; - } else { - player.sendMessage(ChatColor.YELLOW + "Slain by " - + plugin.toName(sender) + "."); - - } - } - - // The player didn't receive any items, then we need to send the - // user a message so s/he know that something is indeed working - if (!included && args.hasFlag('s')) { - sender.sendMessage(ChatColor.YELLOW.toString() + "Players slain."); - } - } - - @Command(aliases = {"locate"}, usage = "[player]", desc = "Locate a player", max = 1) - @CommandPermissions({"worldguard.locate"}) - public void locate(CommandContext args, CommandSender sender) throws CommandException { - - Player player = plugin.checkPlayer(sender); - - if (args.argsLength() == 0) { - player.setCompassTarget(player.getWorld().getSpawnLocation()); - - sender.sendMessage(ChatColor.YELLOW.toString() + "Compass reset to spawn."); - } else { - Player target = plugin.matchSinglePlayer(sender, args.getString(0)); - player.setCompassTarget(target.getLocation()); - - sender.sendMessage(ChatColor.YELLOW.toString() + "Compass repointed."); - } - } - - @Command(aliases = {"stack", ";"}, usage = "", desc = "Stack items", max = 0) - @CommandPermissions({"worldguard.stack"}) - public void stack(CommandContext args, CommandSender sender) throws CommandException { - - Player player = plugin.checkPlayer(sender); - boolean ignoreMax = plugin.hasPermission(player, "worldguard.stack.illegitimate"); - boolean ignoreDamaged = plugin.hasPermission(player, "worldguard.stack.damaged"); - - ItemStack[] items = player.getInventory().getContents(); - int len = items.length; - - int affected = 0; - - for (int i = 0; i < len; i++) { - ItemStack item = items[i]; - - // Avoid infinite stacks and stacks with durability - if (item == null || item.getAmount() <= 0 - || (!ignoreMax && item.getMaxStackSize() == 1)) { - continue; - } - - int max = ignoreMax ? 64 : item.getMaxStackSize(); - - if (item.getAmount() < max) { - int needed = max - item.getAmount(); // Number of needed items until max - - // Find another stack of the same type - for (int j = i + 1; j < len; j++) { - ItemStack item2 = items[j]; - - // Avoid infinite stacks and stacks with durability - if (item2 == null || item2.getAmount() <= 0 - || (!ignoreMax && item.getMaxStackSize() == 1)) { - continue; - } - - // Same type? - // Blocks store their color in the damage value - if (item2.getTypeId() == item.getTypeId() && - ((!ItemType.usesDamageValue(item.getTypeId()) && ignoreDamaged) - || item.getDurability() == item2.getDurability()) && - ((item.getItemMeta() == null && item2.getItemMeta() == null) - || (item.getItemMeta() != null && - item.getItemMeta().equals(item2.getItemMeta())))) { - // This stack won't fit in the parent stack - if (item2.getAmount() > needed) { - item.setAmount(max); - item2.setAmount(item2.getAmount() - needed); - break; - // This stack will - } else { - items[j] = null; - item.setAmount(item.getAmount() + item2.getAmount()); - needed = max - item.getAmount(); - } - - affected++; - } - } - } - } - - if (affected > 0) { - player.getInventory().setContents(items); - } - - player.sendMessage(ChatColor.YELLOW + "Items compacted into stacks!"); - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.bukkit.commands; + +import com.sk89q.minecraft.util.commands.Command; +import com.sk89q.minecraft.util.commands.CommandContext; +import com.sk89q.minecraft.util.commands.CommandException; +import com.sk89q.minecraft.util.commands.CommandPermissions; +import com.sk89q.worldedit.blocks.ItemType; +import com.sk89q.worldguard.bukkit.ConfigurationManager; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; +import com.sk89q.worldguard.session.Session; +import com.sk89q.worldguard.session.handler.GodMode; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class GeneralCommands { + private final WorldGuardPlugin plugin; + + public GeneralCommands(WorldGuardPlugin plugin) { + this.plugin = plugin; + } + + @SuppressWarnings("deprecation") + @Command(aliases = {"god"}, usage = "[player]", + desc = "Enable godmode on a player", flags = "s", max = 1) + public void god(CommandContext args, CommandSender sender) throws CommandException { + ConfigurationManager config = plugin.getGlobalStateManager(); + + Iterable targets = null; + boolean included = false; + + // Detect arguments based on the number of arguments provided + if (args.argsLength() == 0) { + targets = plugin.matchPlayers(plugin.checkPlayer(sender)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.god"); + } else { + targets = plugin.matchPlayers(sender, args.getString(0)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.god.other"); + } + + for (Player player : targets) { + Session session = plugin.getSessionManager().get(player); + + if (GodMode.set(player, session, true)) { + player.setFireTicks(0); + + // Tell the user + if (player.equals(sender)) { + player.sendMessage(ChatColor.YELLOW + "God mode enabled! Use /ungod to disable."); + + // Keep track of this + included = true; + } else { + player.sendMessage(ChatColor.YELLOW + "God enabled by " + + plugin.toName(sender) + "."); + + } + } + } + + // The player didn't receive any items, then we need to send the + // user a message so s/he know that something is indeed working + if (!included && args.hasFlag('s')) { + sender.sendMessage(ChatColor.YELLOW + "Players now have god mode."); + } + } + + @SuppressWarnings("deprecation") + @Command(aliases = {"ungod"}, usage = "[player]", + desc = "Disable godmode on a player", flags = "s", max = 1) + public void ungod(CommandContext args, CommandSender sender) throws CommandException { + ConfigurationManager config = plugin.getGlobalStateManager(); + + Iterable targets = null; + boolean included = false; + + // Detect arguments based on the number of arguments provided + if (args.argsLength() == 0) { + targets = plugin.matchPlayers(plugin.checkPlayer(sender)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.god"); + } else { + targets = plugin.matchPlayers(sender, args.getString(0)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.god.other"); + } + + for (Player player : targets) { + Session session = plugin.getSessionManager().get(player); + + if (GodMode.set(player, session, false)) { + // Tell the user + if (player.equals(sender)) { + player.sendMessage(ChatColor.YELLOW + "God mode disabled!"); + + // Keep track of this + included = true; + } else { + player.sendMessage(ChatColor.YELLOW + "God disabled by " + + plugin.toName(sender) + "."); + + } + } + } + + // The player didn't receive any items, then we need to send the + // user a message so s/he know that something is indeed working + if (!included && args.hasFlag('s')) { + sender.sendMessage(ChatColor.YELLOW + "Players no longer have god mode."); + } + } + + @Command(aliases = {"heal"}, usage = "[player]", desc = "Heal a player", flags = "s", max = 1) + public void heal(CommandContext args,CommandSender sender) throws CommandException { + + Iterable targets = null; + boolean included = false; + + // Detect arguments based on the number of arguments provided + if (args.argsLength() == 0) { + targets = plugin.matchPlayers(plugin.checkPlayer(sender)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.heal"); + } else if (args.argsLength() == 1) { + targets = plugin.matchPlayers(sender, args.getString(0)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.heal.other"); + } + + for (Player player : targets) { + player.setHealth(player.getMaxHealth()); + player.setFoodLevel(20); + + // Tell the user + if (player.equals(sender)) { + player.sendMessage(ChatColor.YELLOW + "Healed!"); + + // Keep track of this + included = true; + } else { + player.sendMessage(ChatColor.YELLOW + "Healed by " + + plugin.toName(sender) + "."); + + } + } + + // The player didn't receive any items, then we need to send the + // user a message so s/he know that something is indeed working + if (!included && args.hasFlag('s')) { + sender.sendMessage(ChatColor.YELLOW.toString() + "Players healed."); + } + } + + @Command(aliases = {"slay"}, usage = "[player]", desc = "Slay a player", flags = "s", max = 1) + public void slay(CommandContext args, CommandSender sender) throws CommandException { + + Iterable targets = null; + boolean included = false; + + // Detect arguments based on the number of arguments provided + if (args.argsLength() == 0) { + targets = plugin.matchPlayers(plugin.checkPlayer(sender)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.slay"); + } else if (args.argsLength() == 1) { + targets = plugin.matchPlayers(sender, args.getString(0)); + + // Check permissions! + plugin.checkPermission(sender, "worldguard.slay.other"); + } + + for (Player player : targets) { + player.setHealth(0); + + // Tell the user + if (player.equals(sender)) { + player.sendMessage(ChatColor.YELLOW + "Slain!"); + + // Keep track of this + included = true; + } else { + player.sendMessage(ChatColor.YELLOW + "Slain by " + + plugin.toName(sender) + "."); + + } + } + + // The player didn't receive any items, then we need to send the + // user a message so s/he know that something is indeed working + if (!included && args.hasFlag('s')) { + sender.sendMessage(ChatColor.YELLOW.toString() + "Players slain."); + } + } + + @Command(aliases = {"locate"}, usage = "[player]", desc = "Locate a player", max = 1) + @CommandPermissions({"worldguard.locate"}) + public void locate(CommandContext args, CommandSender sender) throws CommandException { + + Player player = plugin.checkPlayer(sender); + + if (args.argsLength() == 0) { + player.setCompassTarget(player.getWorld().getSpawnLocation()); + + sender.sendMessage(ChatColor.YELLOW.toString() + "Compass reset to spawn."); + } else { + Player target = plugin.matchSinglePlayer(sender, args.getString(0)); + player.setCompassTarget(target.getLocation()); + + sender.sendMessage(ChatColor.YELLOW.toString() + "Compass repointed."); + } + } + + @Command(aliases = {"stack", ";"}, usage = "", desc = "Stack items", max = 0) + @CommandPermissions({"worldguard.stack"}) + public void stack(CommandContext args, CommandSender sender) throws CommandException { + + Player player = plugin.checkPlayer(sender); + boolean ignoreMax = plugin.hasPermission(player, "worldguard.stack.illegitimate"); + boolean ignoreDamaged = plugin.hasPermission(player, "worldguard.stack.damaged"); + + ItemStack[] items = player.getInventory().getContents(); + int len = items.length; + + int affected = 0; + + for (int i = 0; i < len; i++) { + ItemStack item = items[i]; + + // Avoid infinite stacks and stacks with durability + if (item == null || item.getAmount() <= 0 + || (!ignoreMax && item.getMaxStackSize() == 1)) { + continue; + } + + int max = ignoreMax ? 64 : item.getMaxStackSize(); + + if (item.getAmount() < max) { + int needed = max - item.getAmount(); // Number of needed items until max + + // Find another stack of the same type + for (int j = i + 1; j < len; j++) { + ItemStack item2 = items[j]; + + // Avoid infinite stacks and stacks with durability + if (item2 == null || item2.getAmount() <= 0 + || (!ignoreMax && item.getMaxStackSize() == 1)) { + continue; + } + + // Same type? + // Blocks store their color in the damage value + if (item2.getTypeId() == item.getTypeId() && + ((!ItemType.usesDamageValue(item.getTypeId()) && ignoreDamaged) + || item.getDurability() == item2.getDurability()) && + ((item.getItemMeta() == null && item2.getItemMeta() == null) + || (item.getItemMeta() != null && + item.getItemMeta().equals(item2.getItemMeta())))) { + // This stack won't fit in the parent stack + if (item2.getAmount() > needed) { + item.setAmount(max); + item2.setAmount(item2.getAmount() - needed); + break; + // This stack will + } else { + items[j] = null; + item.setAmount(item.getAmount() + item2.getAmount()); + needed = max - item.getAmount(); + } + + affected++; + } + } + } + } + + if (affected > 0) { + player.getInventory().setContents(items); + } + + player.sendMessage(ChatColor.YELLOW + "Items compacted into stacks!"); + } +} diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/MessageFutureCallback.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/MessageFutureCallback.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/MessageFutureCallback.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/MessageFutureCallback.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/MessageTimerTask.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/MessageTimerTask.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/MessageTimerTask.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/MessageTimerTask.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/ProtectionCommands.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/ProtectionCommands.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/ProtectionCommands.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/ProtectionCommands.java index d0a6db7a..bb44f50c 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/commands/ProtectionCommands.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/ProtectionCommands.java @@ -1,46 +1,46 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.bukkit.commands; - -import com.sk89q.worldguard.bukkit.commands.region.MemberCommands; -import com.sk89q.worldguard.bukkit.commands.region.RegionCommands; -import org.bukkit.command.CommandSender; - -import com.sk89q.minecraft.util.commands.Command; -import com.sk89q.minecraft.util.commands.CommandContext; -import com.sk89q.minecraft.util.commands.NestedCommand; -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; - -public class ProtectionCommands { - @SuppressWarnings("unused") - private final WorldGuardPlugin plugin; - - public ProtectionCommands(WorldGuardPlugin plugin) { - this.plugin = plugin; - } - - @Command(aliases = {"region", "regions", "rg"}, desc = "Region management commands") - @NestedCommand({RegionCommands.class, MemberCommands.class}) - public void region(CommandContext args, CommandSender sender) {} - - @Command(aliases = {"worldguard", "wg"}, desc = "WorldGuard commands") - @NestedCommand({WorldGuardCommands.class}) - public void worldGuard(CommandContext args, CommandSender sender) {} -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.bukkit.commands; + +import com.sk89q.worldguard.bukkit.commands.region.MemberCommands; +import com.sk89q.worldguard.bukkit.commands.region.RegionCommands; +import org.bukkit.command.CommandSender; + +import com.sk89q.minecraft.util.commands.Command; +import com.sk89q.minecraft.util.commands.CommandContext; +import com.sk89q.minecraft.util.commands.NestedCommand; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + +public class ProtectionCommands { + @SuppressWarnings("unused") + private final WorldGuardPlugin plugin; + + public ProtectionCommands(WorldGuardPlugin plugin) { + this.plugin = plugin; + } + + @Command(aliases = {"region", "regions", "rg"}, desc = "Region management commands") + @NestedCommand({RegionCommands.class, MemberCommands.class}) + public void region(CommandContext args, CommandSender sender) {} + + @Command(aliases = {"worldguard", "wg"}, desc = "WorldGuard commands") + @NestedCommand({WorldGuardCommands.class}) + public void worldGuard(CommandContext args, CommandSender sender) {} +} diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/ToggleCommands.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/ToggleCommands.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/ToggleCommands.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/ToggleCommands.java index 50740f77..785442fb 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/commands/ToggleCommands.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/ToggleCommands.java @@ -1,165 +1,165 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.bukkit.commands; - -import org.bukkit.ChatColor; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; - -import com.sk89q.minecraft.util.commands.Command; -import com.sk89q.minecraft.util.commands.CommandContext; -import com.sk89q.minecraft.util.commands.CommandException; -import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldguard.bukkit.BukkitUtil; -import com.sk89q.worldguard.bukkit.ConfigurationManager; -import com.sk89q.worldguard.bukkit.WorldConfiguration; -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; - -public class ToggleCommands { - private final WorldGuardPlugin plugin; - - public ToggleCommands(WorldGuardPlugin plugin) { - this.plugin = plugin; - } - - @Command(aliases = {"stopfire"}, usage = "[]", - desc = "Disables all fire spread temporarily", max = 1) - @CommandPermissions({"worldguard.fire-toggle.stop"}) - public void stopFire(CommandContext args, CommandSender sender) throws CommandException { - - World world; - - if (args.argsLength() == 0) { - world = plugin.checkPlayer(sender).getWorld(); - } else { - world = plugin.matchWorld(sender, args.getString(0)); - } - - WorldConfiguration wcfg = plugin.getGlobalStateManager().get(world); - - if (!wcfg.fireSpreadDisableToggle) { - plugin.getServer().broadcastMessage( - ChatColor.YELLOW - + "Fire spread has been globally disabled for '" + world.getName() + "' by " - + plugin.toName(sender) + "."); - } else { - sender.sendMessage( - ChatColor.YELLOW - + "Fire spread was already globally disabled."); - } - - wcfg.fireSpreadDisableToggle = true; - } - - @Command(aliases = {"allowfire"}, usage = "[]", - desc = "Allows all fire spread temporarily", max = 1) - @CommandPermissions({"worldguard.fire-toggle.stop"}) - public void allowFire(CommandContext args, CommandSender sender) throws CommandException { - - World world; - - if (args.argsLength() == 0) { - world = plugin.checkPlayer(sender).getWorld(); - } else { - world = plugin.matchWorld(sender, args.getString(0)); - } - - WorldConfiguration wcfg = plugin.getGlobalStateManager().get(world); - - if (wcfg.fireSpreadDisableToggle) { - plugin.getServer().broadcastMessage(ChatColor.YELLOW - + "Fire spread has been globally for '" + world.getName() + "' re-enabled by " - + plugin.toName(sender) + "."); - } else { - sender.sendMessage(ChatColor.YELLOW - + "Fire spread was already globally enabled."); - } - - wcfg.fireSpreadDisableToggle = false; - } - - @Command(aliases = {"halt-activity", "stoplag", "haltactivity"}, - desc = "Attempts to cease as much activity in order to stop lag", flags = "cis", max = 0) - @CommandPermissions({"worldguard.halt-activity"}) - public void stopLag(CommandContext args, CommandSender sender) throws CommandException { - - ConfigurationManager configManager = plugin.getGlobalStateManager(); - - if (args.hasFlag('i')) { - if (configManager.activityHaltToggle) { - sender.sendMessage(ChatColor.YELLOW - + "ALL intensive server activity is not allowed."); - } else { - sender.sendMessage(ChatColor.YELLOW - + "ALL intensive server activity is allowed."); - } - } else { - configManager.activityHaltToggle = !args.hasFlag('c'); - - if (configManager.activityHaltToggle) { - if (!(sender instanceof Player)) { - sender.sendMessage(ChatColor.YELLOW - + "ALL intensive server activity halted."); - } - - if (!args.hasFlag('s')) { - plugin.getServer().broadcastMessage(ChatColor.YELLOW - + "ALL intensive server activity halted by " - + plugin.toName(sender) + "."); - } else { - sender.sendMessage(ChatColor.YELLOW - + "(Silent) ALL intensive server activity halted by " - + plugin.toName(sender) + "."); - } - - for (World world : plugin.getServer().getWorlds()) { - int removed = 0; - - for (Entity entity : world.getEntities()) { - if (BukkitUtil.isIntensiveEntity(entity)) { - entity.remove(); - removed++; - } - } - - if (removed > 10) { - sender.sendMessage("" + removed + " entities (>10) auto-removed from " - + world.getName()); - } - } - } else { - if (!args.hasFlag('s')) { - plugin.getServer().broadcastMessage(ChatColor.YELLOW - + "ALL intensive server activity is now allowed."); - - if (!(sender instanceof Player)) { - sender.sendMessage(ChatColor.YELLOW - + "ALL intensive server activity is now allowed."); - } - } else { - sender.sendMessage(ChatColor.YELLOW - + "(Silent) ALL intensive server activity is now allowed."); - } - } - } - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.bukkit.commands; + +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import com.sk89q.minecraft.util.commands.Command; +import com.sk89q.minecraft.util.commands.CommandContext; +import com.sk89q.minecraft.util.commands.CommandException; +import com.sk89q.minecraft.util.commands.CommandPermissions; +import com.sk89q.worldguard.bukkit.BukkitUtil; +import com.sk89q.worldguard.bukkit.ConfigurationManager; +import com.sk89q.worldguard.bukkit.WorldConfiguration; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + +public class ToggleCommands { + private final WorldGuardPlugin plugin; + + public ToggleCommands(WorldGuardPlugin plugin) { + this.plugin = plugin; + } + + @Command(aliases = {"stopfire"}, usage = "[]", + desc = "Disables all fire spread temporarily", max = 1) + @CommandPermissions({"worldguard.fire-toggle.stop"}) + public void stopFire(CommandContext args, CommandSender sender) throws CommandException { + + World world; + + if (args.argsLength() == 0) { + world = plugin.checkPlayer(sender).getWorld(); + } else { + world = plugin.matchWorld(sender, args.getString(0)); + } + + WorldConfiguration wcfg = plugin.getGlobalStateManager().get(world); + + if (!wcfg.fireSpreadDisableToggle) { + plugin.getServer().broadcastMessage( + ChatColor.YELLOW + + "Fire spread has been globally disabled for '" + world.getName() + "' by " + + plugin.toName(sender) + "."); + } else { + sender.sendMessage( + ChatColor.YELLOW + + "Fire spread was already globally disabled."); + } + + wcfg.fireSpreadDisableToggle = true; + } + + @Command(aliases = {"allowfire"}, usage = "[]", + desc = "Allows all fire spread temporarily", max = 1) + @CommandPermissions({"worldguard.fire-toggle.stop"}) + public void allowFire(CommandContext args, CommandSender sender) throws CommandException { + + World world; + + if (args.argsLength() == 0) { + world = plugin.checkPlayer(sender).getWorld(); + } else { + world = plugin.matchWorld(sender, args.getString(0)); + } + + WorldConfiguration wcfg = plugin.getGlobalStateManager().get(world); + + if (wcfg.fireSpreadDisableToggle) { + plugin.getServer().broadcastMessage(ChatColor.YELLOW + + "Fire spread has been globally for '" + world.getName() + "' re-enabled by " + + plugin.toName(sender) + "."); + } else { + sender.sendMessage(ChatColor.YELLOW + + "Fire spread was already globally enabled."); + } + + wcfg.fireSpreadDisableToggle = false; + } + + @Command(aliases = {"halt-activity", "stoplag", "haltactivity"}, + desc = "Attempts to cease as much activity in order to stop lag", flags = "cis", max = 0) + @CommandPermissions({"worldguard.halt-activity"}) + public void stopLag(CommandContext args, CommandSender sender) throws CommandException { + + ConfigurationManager configManager = plugin.getGlobalStateManager(); + + if (args.hasFlag('i')) { + if (configManager.activityHaltToggle) { + sender.sendMessage(ChatColor.YELLOW + + "ALL intensive server activity is not allowed."); + } else { + sender.sendMessage(ChatColor.YELLOW + + "ALL intensive server activity is allowed."); + } + } else { + configManager.activityHaltToggle = !args.hasFlag('c'); + + if (configManager.activityHaltToggle) { + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.YELLOW + + "ALL intensive server activity halted."); + } + + if (!args.hasFlag('s')) { + plugin.getServer().broadcastMessage(ChatColor.YELLOW + + "ALL intensive server activity halted by " + + plugin.toName(sender) + "."); + } else { + sender.sendMessage(ChatColor.YELLOW + + "(Silent) ALL intensive server activity halted by " + + plugin.toName(sender) + "."); + } + + for (World world : plugin.getServer().getWorlds()) { + int removed = 0; + + for (Entity entity : world.getEntities()) { + if (BukkitUtil.isIntensiveEntity(entity)) { + entity.remove(); + removed++; + } + } + + if (removed > 10) { + sender.sendMessage("" + removed + " entities (>10) auto-removed from " + + world.getName()); + } + } + } else { + if (!args.hasFlag('s')) { + plugin.getServer().broadcastMessage(ChatColor.YELLOW + + "ALL intensive server activity is now allowed."); + + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.YELLOW + + "ALL intensive server activity is now allowed."); + } + } else { + sender.sendMessage(ChatColor.YELLOW + + "(Silent) ALL intensive server activity is now allowed."); + } + } + } + } +} diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java index 1320e036..3839fc00 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java @@ -1,296 +1,296 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.bukkit.commands; - -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.io.Files; -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.MoreExecutors; -import com.sk89q.minecraft.util.commands.*; -import com.sk89q.worldguard.bukkit.ConfigurationManager; -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; -import com.sk89q.worldguard.bukkit.util.logging.LoggerToChatHandler; -import com.sk89q.worldguard.bukkit.util.report.*; -import com.sk89q.worldguard.util.profiler.SamplerBuilder; -import com.sk89q.worldguard.util.profiler.SamplerBuilder.Sampler; -import com.sk89q.worldguard.util.profiler.ThreadIdFilter; -import com.sk89q.worldguard.util.profiler.ThreadNameFilter; -import com.sk89q.worldguard.util.report.ReportList; -import com.sk89q.worldguard.util.report.SystemInfoReport; -import com.sk89q.worldguard.util.task.Task; -import com.sk89q.worldguard.util.task.TaskStateComparator; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import javax.annotation.Nullable; -import java.io.File; -import java.io.IOException; -import java.lang.management.ThreadInfo; -import java.nio.charset.Charset; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class WorldGuardCommands { - - private static final Logger log = Logger.getLogger(WorldGuardCommands.class.getCanonicalName()); - - private final WorldGuardPlugin plugin; - @Nullable - private Sampler activeSampler; - - public WorldGuardCommands(WorldGuardPlugin plugin) { - this.plugin = plugin; - } - - @Command(aliases = {"version"}, desc = "Get the WorldGuard version", max = 0) - public void version(CommandContext args, CommandSender sender) throws CommandException { - sender.sendMessage(ChatColor.YELLOW - + "WorldGuard " + plugin.getDescription().getVersion()); - sender.sendMessage(ChatColor.YELLOW - + "http://www.sk89q.com"); - } - - @Command(aliases = {"reload"}, desc = "Reload WorldGuard configuration", max = 0) - @CommandPermissions({"worldguard.reload"}) - public void reload(CommandContext args, CommandSender sender) throws CommandException { - // TODO: This is subject to a race condition, but at least other commands are not being processed concurrently - List> tasks = plugin.getSupervisor().getTasks(); - if (!tasks.isEmpty()) { - throw new CommandException("There are currently pending tasks. Use /wg running to monitor these tasks first."); - } - - LoggerToChatHandler handler = null; - Logger minecraftLogger = null; - - if (sender instanceof Player) { - handler = new LoggerToChatHandler(sender); - handler.setLevel(Level.ALL); - minecraftLogger = Logger.getLogger("com.sk89q.worldguard"); - minecraftLogger.addHandler(handler); - } - - try { - ConfigurationManager config = plugin.getGlobalStateManager(); - config.unload(); - config.load(); - for (World world : Bukkit.getServer().getWorlds()) { - config.get(world); - } - plugin.getRegionContainer().reload(); - // WGBukkit.cleanCache(); - sender.sendMessage("WorldGuard configuration reloaded."); - } catch (Throwable t) { - sender.sendMessage("Error while reloading: " - + t.getMessage()); - } finally { - if (minecraftLogger != null) { - minecraftLogger.removeHandler(handler); - } - } - } - - @Command(aliases = {"report"}, desc = "Writes a report on WorldGuard", flags = "p", max = 0) - @CommandPermissions({"worldguard.report"}) - public void report(CommandContext args, final CommandSender sender) throws CommandException { - ReportList report = new ReportList("Report"); - report.add(new SystemInfoReport()); - report.add(new ServerReport()); - report.add(new PluginReport()); - report.add(new SchedulerReport()); - report.add(new ServicesReport()); - report.add(new WorldReport()); - report.add(new PerformanceReport()); - report.add(new ConfigReport(plugin)); - String result = report.toString(); - - try { - File dest = new File(plugin.getDataFolder(), "report.txt"); - Files.write(result, dest, Charset.forName("UTF-8")); - sender.sendMessage(ChatColor.YELLOW + "WorldGuard report written to " + dest.getAbsolutePath()); - } catch (IOException e) { - throw new CommandException("Failed to write report: " + e.getMessage()); - } - - if (args.hasFlag('p')) { - plugin.checkPermission(sender, "worldguard.report.pastebin"); - CommandUtils.pastebin(plugin, sender, result, "WorldGuard report: %s.report"); - } - } - - @Command(aliases = {"profile"}, usage = "[]", - desc = "Profile the CPU usage of the server", min = 0, max = 1, - flags = "t:p") - @CommandPermissions("worldguard.profile") - public void profile(final CommandContext args, final CommandSender sender) throws CommandException { - Predicate threadFilter; - String threadName = args.getFlag('t'); - final boolean pastebin; - - if (args.hasFlag('p')) { - plugin.checkPermission(sender, "worldguard.report.pastebin"); - pastebin = true; - } else { - pastebin = false; - } - - if (threadName == null) { - threadFilter = new ThreadIdFilter(Thread.currentThread().getId()); - } else if (threadName.equals("*")) { - threadFilter = Predicates.alwaysTrue(); - } else { - threadFilter = new ThreadNameFilter(threadName); - } - - int minutes; - if (args.argsLength() == 0) { - minutes = 5; - } else { - minutes = args.getInteger(0); - if (minutes < 1) { - throw new CommandException("You must run the profile for at least 1 minute."); - } else if (minutes > 10) { - throw new CommandException("You can profile for, at maximum, 10 minutes."); - } - } - - Sampler sampler; - - synchronized (this) { - if (activeSampler != null) { - throw new CommandException("A profile is currently in progress! Please use /wg stopprofile to stop the current profile."); - } - - SamplerBuilder builder = new SamplerBuilder(); - builder.setThreadFilter(threadFilter); - builder.setRunTime(minutes, TimeUnit.MINUTES); - sampler = activeSampler = builder.start(); - } - - AsyncCommandHelper.wrap(sampler.getFuture(), plugin, sender) - .formatUsing(minutes) - .registerWithSupervisor("Running CPU profiler for %d minute(s)...") - .sendMessageAfterDelay("(Please wait... profiling for %d minute(s)...)") - .thenTellErrorsOnly("CPU profiling failed."); - - sampler.getFuture().addListener(new Runnable() { - @Override - public void run() { - synchronized (WorldGuardCommands.this) { - activeSampler = null; - } - } - }, MoreExecutors.sameThreadExecutor()); - - Futures.addCallback(sampler.getFuture(), new FutureCallback() { - @Override - public void onSuccess(Sampler result) { - String output = result.toString(); - - try { - File dest = new File(plugin.getDataFolder(), "profile.txt"); - Files.write(output, dest, Charset.forName("UTF-8")); - sender.sendMessage(ChatColor.YELLOW + "CPU profiling data written to " + dest.getAbsolutePath()); - } catch (IOException e) { - sender.sendMessage(ChatColor.RED + "Failed to write CPU profiling data: " + e.getMessage()); - } - - if (pastebin) { - CommandUtils.pastebin(plugin, sender, output, "Profile result: %s.profile"); - } - } - - @Override - public void onFailure(Throwable throwable) { - } - }); - } - - @Command(aliases = {"stopprofile"}, usage = "",desc = "Stop a running profile", min = 0, max = 0) - @CommandPermissions("worldguard.profile") - public void stopProfile(CommandContext args, final CommandSender sender) throws CommandException { - synchronized (this) { - if (activeSampler == null) { - throw new CommandException("No CPU profile is currently running."); - } - - activeSampler.cancel(); - activeSampler = null; - } - - sender.sendMessage("The running CPU profile has been stopped."); - } - - @Command(aliases = {"flushstates", "clearstates"}, - usage = "[player]", desc = "Flush the state manager", max = 1) - @CommandPermissions("worldguard.flushstates") - public void flushStates(CommandContext args, CommandSender sender) throws CommandException { - if (args.argsLength() == 0) { - plugin.getSessionManager().resetAllStates(); - sender.sendMessage("Cleared all states."); - } else { - Player player = plugin.getServer().getPlayer(args.getString(0)); - if (player != null) { - plugin.getSessionManager().resetState(player); - sender.sendMessage("Cleared states for player \"" + player.getName() + "\"."); - } - } - } - - @Command(aliases = {"running", "queue"}, desc = "List running tasks", max = 0) - @CommandPermissions("worldguard.running") - public void listRunningTasks(CommandContext args, CommandSender sender) throws CommandException { - List> tasks = plugin.getSupervisor().getTasks(); - - if (!tasks.isEmpty()) { - Collections.sort(tasks, new TaskStateComparator()); - StringBuilder builder = new StringBuilder(); - builder.append(ChatColor.GRAY); - builder.append("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"); - builder.append(" Running tasks "); - builder.append("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"); - builder.append("\n").append(ChatColor.GRAY).append("Note: Some 'running' tasks may be waiting to be start."); - for (Task task : tasks) { - builder.append("\n"); - builder.append(ChatColor.BLUE).append("(").append(task.getState().name()).append(") "); - builder.append(ChatColor.YELLOW); - builder.append(CommandUtils.getOwnerName(task.getOwner())); - builder.append(": "); - builder.append(ChatColor.WHITE); - builder.append(task.getName()); - } - sender.sendMessage(builder.toString()); - } else { - sender.sendMessage(ChatColor.YELLOW + "There are currently no running tasks."); - } - } - - @Command(aliases = {"debug"}, desc = "Debugging commands") - @NestedCommand({DebuggingCommands.class}) - public void debug(CommandContext args, CommandSender sender) {} - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.bukkit.commands; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.io.Files; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.MoreExecutors; +import com.sk89q.minecraft.util.commands.*; +import com.sk89q.worldguard.bukkit.ConfigurationManager; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; +import com.sk89q.worldguard.bukkit.util.logging.LoggerToChatHandler; +import com.sk89q.worldguard.bukkit.util.report.*; +import com.sk89q.worldguard.util.profiler.SamplerBuilder; +import com.sk89q.worldguard.util.profiler.SamplerBuilder.Sampler; +import com.sk89q.worldguard.util.profiler.ThreadIdFilter; +import com.sk89q.worldguard.util.profiler.ThreadNameFilter; +import com.sk89q.worldguard.util.report.ReportList; +import com.sk89q.worldguard.util.report.SystemInfoReport; +import com.sk89q.worldguard.util.task.Task; +import com.sk89q.worldguard.util.task.TaskStateComparator; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import javax.annotation.Nullable; +import java.io.File; +import java.io.IOException; +import java.lang.management.ThreadInfo; +import java.nio.charset.Charset; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class WorldGuardCommands { + + private static final Logger log = Logger.getLogger(WorldGuardCommands.class.getCanonicalName()); + + private final WorldGuardPlugin plugin; + @Nullable + private Sampler activeSampler; + + public WorldGuardCommands(WorldGuardPlugin plugin) { + this.plugin = plugin; + } + + @Command(aliases = {"version"}, desc = "Get the WorldGuard version", max = 0) + public void version(CommandContext args, CommandSender sender) throws CommandException { + sender.sendMessage(ChatColor.YELLOW + + "WorldGuard " + plugin.getDescription().getVersion()); + sender.sendMessage(ChatColor.YELLOW + + "http://www.sk89q.com"); + } + + @Command(aliases = {"reload"}, desc = "Reload WorldGuard configuration", max = 0) + @CommandPermissions({"worldguard.reload"}) + public void reload(CommandContext args, CommandSender sender) throws CommandException { + // TODO: This is subject to a race condition, but at least other commands are not being processed concurrently + List> tasks = plugin.getSupervisor().getTasks(); + if (!tasks.isEmpty()) { + throw new CommandException("There are currently pending tasks. Use /wg running to monitor these tasks first."); + } + + LoggerToChatHandler handler = null; + Logger minecraftLogger = null; + + if (sender instanceof Player) { + handler = new LoggerToChatHandler(sender); + handler.setLevel(Level.ALL); + minecraftLogger = Logger.getLogger("com.sk89q.worldguard"); + minecraftLogger.addHandler(handler); + } + + try { + ConfigurationManager config = plugin.getGlobalStateManager(); + config.unload(); + config.load(); + for (World world : Bukkit.getServer().getWorlds()) { + config.get(world); + } + plugin.getRegionContainer().reload(); + // WGBukkit.cleanCache(); + sender.sendMessage("WorldGuard configuration reloaded."); + } catch (Throwable t) { + sender.sendMessage("Error while reloading: " + + t.getMessage()); + } finally { + if (minecraftLogger != null) { + minecraftLogger.removeHandler(handler); + } + } + } + + @Command(aliases = {"report"}, desc = "Writes a report on WorldGuard", flags = "p", max = 0) + @CommandPermissions({"worldguard.report"}) + public void report(CommandContext args, final CommandSender sender) throws CommandException { + ReportList report = new ReportList("Report"); + report.add(new SystemInfoReport()); + report.add(new ServerReport()); + report.add(new PluginReport()); + report.add(new SchedulerReport()); + report.add(new ServicesReport()); + report.add(new WorldReport()); + report.add(new PerformanceReport()); + report.add(new ConfigReport(plugin)); + String result = report.toString(); + + try { + File dest = new File(plugin.getDataFolder(), "report.txt"); + Files.write(result, dest, Charset.forName("UTF-8")); + sender.sendMessage(ChatColor.YELLOW + "WorldGuard report written to " + dest.getAbsolutePath()); + } catch (IOException e) { + throw new CommandException("Failed to write report: " + e.getMessage()); + } + + if (args.hasFlag('p')) { + plugin.checkPermission(sender, "worldguard.report.pastebin"); + CommandUtils.pastebin(plugin, sender, result, "WorldGuard report: %s.report"); + } + } + + @Command(aliases = {"profile"}, usage = "[]", + desc = "Profile the CPU usage of the server", min = 0, max = 1, + flags = "t:p") + @CommandPermissions("worldguard.profile") + public void profile(final CommandContext args, final CommandSender sender) throws CommandException { + Predicate threadFilter; + String threadName = args.getFlag('t'); + final boolean pastebin; + + if (args.hasFlag('p')) { + plugin.checkPermission(sender, "worldguard.report.pastebin"); + pastebin = true; + } else { + pastebin = false; + } + + if (threadName == null) { + threadFilter = new ThreadIdFilter(Thread.currentThread().getId()); + } else if (threadName.equals("*")) { + threadFilter = Predicates.alwaysTrue(); + } else { + threadFilter = new ThreadNameFilter(threadName); + } + + int minutes; + if (args.argsLength() == 0) { + minutes = 5; + } else { + minutes = args.getInteger(0); + if (minutes < 1) { + throw new CommandException("You must run the profile for at least 1 minute."); + } else if (minutes > 10) { + throw new CommandException("You can profile for, at maximum, 10 minutes."); + } + } + + Sampler sampler; + + synchronized (this) { + if (activeSampler != null) { + throw new CommandException("A profile is currently in progress! Please use /wg stopprofile to stop the current profile."); + } + + SamplerBuilder builder = new SamplerBuilder(); + builder.setThreadFilter(threadFilter); + builder.setRunTime(minutes, TimeUnit.MINUTES); + sampler = activeSampler = builder.start(); + } + + AsyncCommandHelper.wrap(sampler.getFuture(), plugin, sender) + .formatUsing(minutes) + .registerWithSupervisor("Running CPU profiler for %d minute(s)...") + .sendMessageAfterDelay("(Please wait... profiling for %d minute(s)...)") + .thenTellErrorsOnly("CPU profiling failed."); + + sampler.getFuture().addListener(new Runnable() { + @Override + public void run() { + synchronized (WorldGuardCommands.this) { + activeSampler = null; + } + } + }, MoreExecutors.sameThreadExecutor()); + + Futures.addCallback(sampler.getFuture(), new FutureCallback() { + @Override + public void onSuccess(Sampler result) { + String output = result.toString(); + + try { + File dest = new File(plugin.getDataFolder(), "profile.txt"); + Files.write(output, dest, Charset.forName("UTF-8")); + sender.sendMessage(ChatColor.YELLOW + "CPU profiling data written to " + dest.getAbsolutePath()); + } catch (IOException e) { + sender.sendMessage(ChatColor.RED + "Failed to write CPU profiling data: " + e.getMessage()); + } + + if (pastebin) { + CommandUtils.pastebin(plugin, sender, output, "Profile result: %s.profile"); + } + } + + @Override + public void onFailure(Throwable throwable) { + } + }); + } + + @Command(aliases = {"stopprofile"}, usage = "",desc = "Stop a running profile", min = 0, max = 0) + @CommandPermissions("worldguard.profile") + public void stopProfile(CommandContext args, final CommandSender sender) throws CommandException { + synchronized (this) { + if (activeSampler == null) { + throw new CommandException("No CPU profile is currently running."); + } + + activeSampler.cancel(); + activeSampler = null; + } + + sender.sendMessage("The running CPU profile has been stopped."); + } + + @Command(aliases = {"flushstates", "clearstates"}, + usage = "[player]", desc = "Flush the state manager", max = 1) + @CommandPermissions("worldguard.flushstates") + public void flushStates(CommandContext args, CommandSender sender) throws CommandException { + if (args.argsLength() == 0) { + plugin.getSessionManager().resetAllStates(); + sender.sendMessage("Cleared all states."); + } else { + Player player = plugin.getServer().getPlayer(args.getString(0)); + if (player != null) { + plugin.getSessionManager().resetState(player); + sender.sendMessage("Cleared states for player \"" + player.getName() + "\"."); + } + } + } + + @Command(aliases = {"running", "queue"}, desc = "List running tasks", max = 0) + @CommandPermissions("worldguard.running") + public void listRunningTasks(CommandContext args, CommandSender sender) throws CommandException { + List> tasks = plugin.getSupervisor().getTasks(); + + if (!tasks.isEmpty()) { + Collections.sort(tasks, new TaskStateComparator()); + StringBuilder builder = new StringBuilder(); + builder.append(ChatColor.GRAY); + builder.append("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"); + builder.append(" Running tasks "); + builder.append("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"); + builder.append("\n").append(ChatColor.GRAY).append("Note: Some 'running' tasks may be waiting to be start."); + for (Task task : tasks) { + builder.append("\n"); + builder.append(ChatColor.BLUE).append("(").append(task.getState().name()).append(") "); + builder.append(ChatColor.YELLOW); + builder.append(CommandUtils.getOwnerName(task.getOwner())); + builder.append(": "); + builder.append(ChatColor.WHITE); + builder.append(task.getName()); + } + sender.sendMessage(builder.toString()); + } else { + sender.sendMessage(ChatColor.YELLOW + "There are currently no running tasks."); + } + } + + @Command(aliases = {"debug"}, desc = "Debugging commands") + @NestedCommand({DebuggingCommands.class}) + public void debug(CommandContext args, CommandSender sender) {} + +} diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/region/MemberCommands.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/MemberCommands.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/region/MemberCommands.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/MemberCommands.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommands.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommands.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommands.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommands.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommandsBase.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommandsBase.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommandsBase.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommandsBase.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionPrintoutBuilder.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionPrintoutBuilder.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionPrintoutBuilder.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionPrintoutBuilder.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionAdder.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionAdder.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionAdder.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionAdder.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionLister.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionLister.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionLister.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionLister.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerReloader.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerReloader.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerReloader.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerReloader.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerSaver.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerSaver.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerSaver.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionManagerSaver.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionRemover.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionRemover.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionRemover.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/task/RegionRemover.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/BulkEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/BulkEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/BulkEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/BulkEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvents.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvents.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvents.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/DelegateEvents.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/Handleable.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/Handleable.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/Handleable.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/Handleable.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/block/AbstractBlockEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/AbstractBlockEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/block/AbstractBlockEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/AbstractBlockEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/block/BreakBlockEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/BreakBlockEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/block/BreakBlockEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/BreakBlockEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/block/PlaceBlockEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/PlaceBlockEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/block/PlaceBlockEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/PlaceBlockEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/block/UseBlockEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/UseBlockEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/block/UseBlockEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/block/UseBlockEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelAttempt.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelAttempt.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelAttempt.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelAttempt.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogger.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogger.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogger.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogger.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogging.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogging.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogging.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/CancelLogging.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockBreakEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockBreakEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockBreakEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockBreakEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockPlaceEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockPlaceEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockPlaceEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingBlockPlaceEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingEntityDamageByEntityEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingEntityDamageByEntityEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingEntityDamageByEntityEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingEntityDamageByEntityEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingPlayerInteractEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingPlayerInteractEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingPlayerInteractEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/debug/LoggingPlayerInteractEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/entity/AbstractEntityEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/AbstractEntityEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/entity/AbstractEntityEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/AbstractEntityEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/entity/DamageEntityEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/DamageEntityEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/entity/DamageEntityEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/DamageEntityEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/entity/DestroyEntityEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/DestroyEntityEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/entity/DestroyEntityEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/DestroyEntityEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/entity/SpawnEntityEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/SpawnEntityEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/entity/SpawnEntityEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/SpawnEntityEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/entity/UseEntityEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/UseEntityEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/entity/UseEntityEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/entity/UseEntityEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/inventory/UseItemEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/inventory/UseItemEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/inventory/UseItemEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/inventory/UseItemEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/event/player/ProcessPlayerEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/player/ProcessPlayerEvent.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/event/player/ProcessPlayerEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/event/player/ProcessPlayerEvent.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/internal/BukkitBlacklist.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/internal/BukkitBlacklist.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/internal/BukkitBlacklist.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/internal/BukkitBlacklist.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/internal/TargetMatcherSet.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/internal/TargetMatcherSet.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/internal/TargetMatcherSet.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/internal/TargetMatcherSet.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/internal/WGMetadata.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/internal/WGMetadata.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/internal/WGMetadata.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/internal/WGMetadata.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/AbstractListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/AbstractListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/AbstractListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/AbstractListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/BlacklistListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BlacklistListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/BlacklistListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BlacklistListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/BlockStateAsBlockFunction.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BlockStateAsBlockFunction.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/BlockStateAsBlockFunction.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BlockStateAsBlockFunction.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/BlockedPotionsListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BlockedPotionsListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/BlockedPotionsListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BlockedPotionsListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/BuildPermissionListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BuildPermissionListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/BuildPermissionListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BuildPermissionListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/ChestProtectionListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/ChestProtectionListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/ChestProtectionListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/ChestProtectionListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/DebuggingListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/DebuggingListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/DebuggingListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/DebuggingListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/InvincibilityListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/InvincibilityListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/InvincibilityListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/InvincibilityListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerModesListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerModesListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerModesListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerModesListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerMoveListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerMoveListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerMoveListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/PlayerMoveListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionFlagsListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionFlagsListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/RegionFlagsListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionFlagsListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/SpongeUtil.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/SpongeUtil.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/SpongeUtil.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/SpongeUtil.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardCommandBookListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardCommandBookListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardCommandBookListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardCommandBookListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardEntityListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardEntityListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardEntityListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardEntityListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardHangingListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardHangingListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardHangingListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardHangingListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardServerListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardServerListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardServerListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardServerListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardVehicleListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardVehicleListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardVehicleListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardVehicleListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWeatherListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWeatherListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWeatherListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWeatherListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWorldListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWorldListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWorldListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardWorldListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldRulesListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldRulesListener.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/WorldRulesListener.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldRulesListener.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockBlockPair.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockBlockPair.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockBlockPair.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockBlockPair.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockMaterialPair.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockMaterialPair.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockMaterialPair.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockMaterialPair.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonExtendKey.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonExtendKey.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonExtendKey.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonExtendKey.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonRetractKey.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonRetractKey.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonRetractKey.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/BlockPistonRetractKey.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/EventDebounce.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/EventDebounce.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/EventDebounce.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/EventDebounce.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/AbstractEventDebounce.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/AbstractEventDebounce.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/AbstractEventDebounce.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/AbstractEventDebounce.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/BlockEntityEventDebounce.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/BlockEntityEventDebounce.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/BlockEntityEventDebounce.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/BlockEntityEventDebounce.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/EntityEntityEventDebounce.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/EntityEntityEventDebounce.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/EntityEntityEventDebounce.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/EntityEntityEventDebounce.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/InventoryMoveItemEventDebounce.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/InventoryMoveItemEventDebounce.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/InventoryMoveItemEventDebounce.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/debounce/legacy/InventoryMoveItemEventDebounce.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/permission/AbstractPermissionModel.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/permission/AbstractPermissionModel.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/permission/AbstractPermissionModel.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/permission/AbstractPermissionModel.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/permission/RegionPermissionModel.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/permission/RegionPermissionModel.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/permission/RegionPermissionModel.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/permission/RegionPermissionModel.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/protection/DelayedRegionOverlapAssociation.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/protection/DelayedRegionOverlapAssociation.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/protection/DelayedRegionOverlapAssociation.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/protection/DelayedRegionOverlapAssociation.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/Blocks.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Blocks.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/Blocks.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Blocks.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/Events.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Events.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/Events.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Events.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/HandlerTracer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/HandlerTracer.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/HandlerTracer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/HandlerTracer.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/InteropUtils.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/InteropUtils.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/InteropUtils.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/InteropUtils.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/Locations.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Locations.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/Locations.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Locations.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/logging/LoggerToChatHandler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/logging/LoggerToChatHandler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/logging/LoggerToChatHandler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/logging/LoggerToChatHandler.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/report/ConfigReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ConfigReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/report/ConfigReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ConfigReport.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/report/PerformanceReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/PerformanceReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/report/PerformanceReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/PerformanceReport.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/report/PluginReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/PluginReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/report/PluginReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/PluginReport.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/report/SchedulerReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/SchedulerReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/report/SchedulerReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/SchedulerReport.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServicesReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServicesReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/report/ServicesReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServicesReport.java diff --git a/src/main/java/com/sk89q/worldguard/bukkit/util/report/WorldReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/WorldReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/bukkit/util/report/WorldReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/WorldReport.java diff --git a/src/main/java/com/sk89q/worldguard/chest/ChestProtection.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/chest/ChestProtection.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/chest/ChestProtection.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/chest/ChestProtection.java index 94fe6ed0..58f58cea 100644 --- a/src/main/java/com/sk89q/worldguard/chest/ChestProtection.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/chest/ChestProtection.java @@ -1,77 +1,77 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.chest; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; - -/** - * Interface for chest protection. - */ -public interface ChestProtection { - - /** - * Returns whether a block is protected. - * - * @param block The block to check - * @param player The player to check - * @return Whether the block is protected for player - */ - public boolean isProtected(Block block, Player player); - - /** - * Returns whether a location where a chest block is trying to be created - * is protected. - * - * @param block The block to check - * @param player The player to check - * @return Whether {@code player} can place a block at the specified block - */ - public boolean isProtectedPlacement(Block block, Player player); - - /** - * Returns whether an adjacent chest is protected. - * - * @param searchBlock The block to check - * @param player The player to check - * @return Whether {@code searchBlock} is protected from access by {@code player} - */ - public boolean isAdjacentChestProtected(Block searchBlock, Player player); - - /** - * Returns whether a material is a chest. - * - * @param material The material to check - * @deprecated see {@link #isChest(int)} - * @return {@link #isChest(int)} - */ - @Deprecated - public boolean isChest(Material material); - - /** - * Returns whether a material is a chest. - * - * @param type The type to check - * @return Whether type is a 'chest' (block that can be protected) - */ - public boolean isChest(int type); - +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.chest; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +/** + * Interface for chest protection. + */ +public interface ChestProtection { + + /** + * Returns whether a block is protected. + * + * @param block The block to check + * @param player The player to check + * @return Whether the block is protected for player + */ + public boolean isProtected(Block block, Player player); + + /** + * Returns whether a location where a chest block is trying to be created + * is protected. + * + * @param block The block to check + * @param player The player to check + * @return Whether {@code player} can place a block at the specified block + */ + public boolean isProtectedPlacement(Block block, Player player); + + /** + * Returns whether an adjacent chest is protected. + * + * @param searchBlock The block to check + * @param player The player to check + * @return Whether {@code searchBlock} is protected from access by {@code player} + */ + public boolean isAdjacentChestProtected(Block searchBlock, Player player); + + /** + * Returns whether a material is a chest. + * + * @param material The material to check + * @deprecated see {@link #isChest(int)} + * @return {@link #isChest(int)} + */ + @Deprecated + public boolean isChest(Material material); + + /** + * Returns whether a material is a chest. + * + * @param type The type to check + * @return Whether type is a 'chest' (block that can be protected) + */ + public boolean isChest(int type); + } \ No newline at end of file diff --git a/src/main/java/com/sk89q/worldguard/chest/SignChestProtection.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/chest/SignChestProtection.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/chest/SignChestProtection.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/chest/SignChestProtection.java index e31d7de5..1dcb5899 100644 --- a/src/main/java/com/sk89q/worldguard/chest/SignChestProtection.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/chest/SignChestProtection.java @@ -1,159 +1,159 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.chest; - -import com.sk89q.worldedit.blocks.BlockID; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; - -/** - * Sign-based chest protection. - * - * @author sk89q - */ -public class SignChestProtection implements ChestProtection { - - public boolean isProtected(Block block, Player player) { - if (isChest(block.getTypeId())) { - Block below = block.getRelative(0, -1, 0); - return isProtectedSignAround(below, player); - } else if (block.getTypeId() == BlockID.SIGN_POST) { - return isProtectedSignAndChestBinary(block, player); - } else { - Block above = block.getRelative(0, 1, 0); - Boolean res = isProtectedSign(above, player); - if (res != null) return res; - return false; - } - } - - public boolean isProtectedPlacement(Block block, Player player) { - return isProtectedSignAround(block, player); - } - - private boolean isProtectedSignAround(Block searchBlock, Player player) { - Block side; - Boolean res; - - side = searchBlock; - res = isProtectedSign(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(-1, 0, 0); - res = isProtectedSignAndChest(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(1, 0, 0); - res = isProtectedSignAndChest(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(0, 0, -1); - res = isProtectedSignAndChest(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(0, 0, 1); - res = isProtectedSignAndChest(side, player); - if (res != null && res) return res; - - return false; - } - - private Boolean isProtectedSign(Sign sign, Player player) { - if (sign.getLine(0).equalsIgnoreCase("[Lock]")) { - if (player == null) { // No player, no access - return true; - } - - String name = player.getName(); - if (name.equalsIgnoreCase(sign.getLine(1).trim()) - || name.equalsIgnoreCase(sign.getLine(2).trim()) - || name.equalsIgnoreCase(sign.getLine(3).trim())) { - return false; - } - - // No access! - return true; - } - - return null; - } - - private Boolean isProtectedSign(Block block, Player player) { - BlockState state = block.getState(); - if (state == null || !(state instanceof Sign)) { - return null; - } - return isProtectedSign((Sign) state, player); - } - - private Boolean isProtectedSignAndChest(Block block, Player player) { - if (!isChest(block.getRelative(0, 1, 0).getTypeId())) { - return null; - } - return isProtectedSign(block, player); - } - - private boolean isProtectedSignAndChestBinary(Block block, Player player) { - Boolean res = isProtectedSignAndChest(block, player); - return !(res == null || !res); - } - - public boolean isAdjacentChestProtected(Block searchBlock, Player player) { - Block side; - Boolean res; - - side = searchBlock; - res = isProtected(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(-1, 0, 0); - res = isProtected(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(1, 0, 0); - res = isProtected(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(0, 0, -1); - res = isProtected(side, player); - if (res != null && res) return res; - - side = searchBlock.getRelative(0, 0, 1); - res = isProtected(side, player); - if (res != null && res) return res; - - return false; - } - - @Deprecated - public boolean isChest(Material material) { - return isChest(material.getId()); - } - - public boolean isChest(int type) { - return type == BlockID.CHEST - || type == BlockID.DISPENSER - || type == BlockID.FURNACE - || type == BlockID.BURNING_FURNACE; - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.chest; + +import com.sk89q.worldedit.blocks.BlockID; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; +import org.bukkit.entity.Player; + +/** + * Sign-based chest protection. + * + * @author sk89q + */ +public class SignChestProtection implements ChestProtection { + + public boolean isProtected(Block block, Player player) { + if (isChest(block.getTypeId())) { + Block below = block.getRelative(0, -1, 0); + return isProtectedSignAround(below, player); + } else if (block.getTypeId() == BlockID.SIGN_POST) { + return isProtectedSignAndChestBinary(block, player); + } else { + Block above = block.getRelative(0, 1, 0); + Boolean res = isProtectedSign(above, player); + if (res != null) return res; + return false; + } + } + + public boolean isProtectedPlacement(Block block, Player player) { + return isProtectedSignAround(block, player); + } + + private boolean isProtectedSignAround(Block searchBlock, Player player) { + Block side; + Boolean res; + + side = searchBlock; + res = isProtectedSign(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(-1, 0, 0); + res = isProtectedSignAndChest(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(1, 0, 0); + res = isProtectedSignAndChest(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(0, 0, -1); + res = isProtectedSignAndChest(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(0, 0, 1); + res = isProtectedSignAndChest(side, player); + if (res != null && res) return res; + + return false; + } + + private Boolean isProtectedSign(Sign sign, Player player) { + if (sign.getLine(0).equalsIgnoreCase("[Lock]")) { + if (player == null) { // No player, no access + return true; + } + + String name = player.getName(); + if (name.equalsIgnoreCase(sign.getLine(1).trim()) + || name.equalsIgnoreCase(sign.getLine(2).trim()) + || name.equalsIgnoreCase(sign.getLine(3).trim())) { + return false; + } + + // No access! + return true; + } + + return null; + } + + private Boolean isProtectedSign(Block block, Player player) { + BlockState state = block.getState(); + if (state == null || !(state instanceof Sign)) { + return null; + } + return isProtectedSign((Sign) state, player); + } + + private Boolean isProtectedSignAndChest(Block block, Player player) { + if (!isChest(block.getRelative(0, 1, 0).getTypeId())) { + return null; + } + return isProtectedSign(block, player); + } + + private boolean isProtectedSignAndChestBinary(Block block, Player player) { + Boolean res = isProtectedSignAndChest(block, player); + return !(res == null || !res); + } + + public boolean isAdjacentChestProtected(Block searchBlock, Player player) { + Block side; + Boolean res; + + side = searchBlock; + res = isProtected(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(-1, 0, 0); + res = isProtected(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(1, 0, 0); + res = isProtected(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(0, 0, -1); + res = isProtected(side, player); + if (res != null && res) return res; + + side = searchBlock.getRelative(0, 0, 1); + res = isProtected(side, player); + if (res != null && res) return res; + + return false; + } + + @Deprecated + public boolean isChest(Material material) { + return isChest(material.getId()); + } + + public boolean isChest(int type) { + return type == BlockID.CHEST + || type == BlockID.DISPENSER + || type == BlockID.FURNACE + || type == BlockID.BURNING_FURNACE; + } +} diff --git a/src/main/java/com/sk89q/worldguard/domains/Association.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/Association.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/domains/Association.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/Association.java diff --git a/src/main/java/com/sk89q/worldguard/domains/DefaultDomain.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/DefaultDomain.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/domains/DefaultDomain.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/DefaultDomain.java index cdd15c4a..dc26904a 100644 --- a/src/main/java/com/sk89q/worldguard/domains/DefaultDomain.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/DefaultDomain.java @@ -1,371 +1,371 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.domains; - -import com.google.common.collect.ImmutableMap; -import com.sk89q.squirrelid.Profile; -import com.sk89q.squirrelid.cache.ProfileCache; -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.util.ChangeTracked; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.UUID; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * A combination of a {@link PlayerDomain} and a {@link GroupDomain}. - */ -public class DefaultDomain implements Domain, ChangeTracked { - - private PlayerDomain playerDomain = new PlayerDomain(); - private GroupDomain groupDomain = new GroupDomain(); - - /** - * Create a new domain. - */ - public DefaultDomain() { - } - - /** - * Create a new domain from an existing one, making a copy of all values. - * - * @param existing the other domain to copy values from - */ - public DefaultDomain(DefaultDomain existing) { - setPlayerDomain(existing.getPlayerDomain()); - setGroupDomain(existing.getGroupDomain()); - } - - /** - * Get the domain that holds the players. - * - * @return a domain - */ - public PlayerDomain getPlayerDomain() { - return playerDomain; - } - - /** - * Set a new player domain. - * - * @param playerDomain a domain - */ - public void setPlayerDomain(PlayerDomain playerDomain) { - checkNotNull(playerDomain); - this.playerDomain = new PlayerDomain(playerDomain); - } - - /** - * Set the domain that holds the groups. - * - * @return a domain - */ - public GroupDomain getGroupDomain() { - return groupDomain; - } - - /** - * Set a new group domain. - * - * @param groupDomain a domain - */ - public void setGroupDomain(GroupDomain groupDomain) { - checkNotNull(groupDomain); - this.groupDomain = new GroupDomain(groupDomain); - } - - /** - * Add the given player to the domain, identified by the player's name. - * - * @param name the name of the player - */ - public void addPlayer(String name) { - playerDomain.addPlayer(name); - } - - /** - * Remove the given player from the domain, identified by the player's name. - * - * @param name the name of the player - */ - public void removePlayer(String name) { - playerDomain.removePlayer(name); - } - - /** - * Remove the given player from the domain, identified by the player's UUID. - * - * @param uuid the UUID of the player - */ - public void removePlayer(UUID uuid) { - playerDomain.removePlayer(uuid); - } - - /** - * Add the given player to the domain, identified by the player's UUID. - * - * @param uniqueId the UUID of the player - */ - public void addPlayer(UUID uniqueId) { - playerDomain.addPlayer(uniqueId); - } - - /** - * Remove the given player from the domain, identified by either the - * player's name, the player's unique ID, or both. - * - * @param player the player - */ - public void removePlayer(LocalPlayer player) { - playerDomain.removePlayer(player); - } - - /** - * Add the given player to the domain, identified by the player's UUID. - * - * @param player the player - */ - public void addPlayer(LocalPlayer player) { - playerDomain.addPlayer(player); - } - - /** - * Add all the entries from another domain. - * - * @param other the other domain - */ - public void addAll(DefaultDomain other) { - checkNotNull(other); - for (String player : other.getPlayers()) { - addPlayer(player); - } - for (UUID uuid : other.getUniqueIds()) { - addPlayer(uuid); - } - for (String group : other.getGroups()) { - addGroup(group); - } - } - - /** - * Remove all the entries from another domain. - * - * @param other the other domain - */ - public void removeAll(DefaultDomain other) { - checkNotNull(other); - for (String player : other.getPlayers()) { - removePlayer(player); - } - for (UUID uuid : other.getUniqueIds()) { - removePlayer(uuid); - } - for (String group : other.getGroups()) { - removeGroup(group); - } - } - - /** - * Get the set of player names. - * - * @return the set of player names - */ - public Set getPlayers() { - return playerDomain.getPlayers(); - } - - /** - * Get the set of player UUIDs. - * - * @return the set of player UUIDs - */ - public Set getUniqueIds() { - return playerDomain.getUniqueIds(); - } - - /** - * Add the name of the group to the domain. - * - * @param name the name of the group. - */ - public void addGroup(String name) { - groupDomain.addGroup(name); - } - - /** - * Remove the given group from the domain. - * - * @param name the name of the group - */ - public void removeGroup(String name) { - groupDomain.removeGroup(name); - } - - /** - * Get the set of group names. - * - * @return the set of group names - */ - public Set getGroups() { - return groupDomain.getGroups(); - } - - @Override - public boolean contains(LocalPlayer player) { - return playerDomain.contains(player) || groupDomain.contains(player); - } - - @Override - public boolean contains(UUID uniqueId) { - return playerDomain.contains(uniqueId); - } - - @Override - public boolean contains(String playerName) { - return playerDomain.contains(playerName); - } - - @Override - public int size() { - return groupDomain.size() + playerDomain.size(); - } - - @Override - public void clear() { - playerDomain.clear(); - groupDomain.clear(); - } - - public void removeAll() { - clear(); - } - - public String toPlayersString() { - return toPlayersString(null); - } - - @SuppressWarnings("deprecation") - public String toPlayersString(@Nullable ProfileCache cache) { - StringBuilder str = new StringBuilder(); - List output = new ArrayList(); - - for (String name : playerDomain.getPlayers()) { - output.add("name:" + name); - } - - if (cache != null) { - ImmutableMap results = cache.getAllPresent(playerDomain.getUniqueIds()); - for (UUID uuid : playerDomain.getUniqueIds()) { - Profile profile = results.get(uuid); - if (profile != null) { - output.add(profile.getName() + "*"); - } else { - output.add("uuid:" + uuid); - } - } - } else { - for (UUID uuid : playerDomain.getUniqueIds()) { - output.add("uuid:" + uuid); - } - } - - Collections.sort(output, String.CASE_INSENSITIVE_ORDER); - for (Iterator it = output.iterator(); it.hasNext();) { - str.append(it.next()); - if (it.hasNext()) { - str.append(", "); - } - } - return str.toString(); - } - - public String toGroupsString() { - StringBuilder str = new StringBuilder(); - for (Iterator it = groupDomain.getGroups().iterator(); it.hasNext(); ) { - str.append("*"); - str.append(it.next()); - if (it.hasNext()) { - str.append(", "); - } - } - return str.toString(); - } - - public String toUserFriendlyString() { - StringBuilder str = new StringBuilder(); - - if (playerDomain.size() > 0) { - str.append(toPlayersString()); - } - - if (groupDomain.size() > 0) { - if (str.length() > 0) { - str.append("; "); - } - - str.append(toGroupsString()); - } - - return str.toString(); - } - - public String toUserFriendlyString(ProfileCache cache) { - StringBuilder str = new StringBuilder(); - - if (playerDomain.size() > 0) { - str.append(toPlayersString(cache)); - } - - if (groupDomain.size() > 0) { - if (str.length() > 0) { - str.append("; "); - } - - str.append(toGroupsString()); - } - - return str.toString(); - } - - @Override - public boolean isDirty() { - return playerDomain.isDirty() || groupDomain.isDirty(); - } - - @Override - public void setDirty(boolean dirty) { - playerDomain.setDirty(dirty); - groupDomain.setDirty(dirty); - } - - @Override - public String toString() { - return "{players=" + playerDomain + - ", groups=" + groupDomain + - '}'; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.domains; + +import com.google.common.collect.ImmutableMap; +import com.sk89q.squirrelid.Profile; +import com.sk89q.squirrelid.cache.ProfileCache; +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.util.ChangeTracked; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * A combination of a {@link PlayerDomain} and a {@link GroupDomain}. + */ +public class DefaultDomain implements Domain, ChangeTracked { + + private PlayerDomain playerDomain = new PlayerDomain(); + private GroupDomain groupDomain = new GroupDomain(); + + /** + * Create a new domain. + */ + public DefaultDomain() { + } + + /** + * Create a new domain from an existing one, making a copy of all values. + * + * @param existing the other domain to copy values from + */ + public DefaultDomain(DefaultDomain existing) { + setPlayerDomain(existing.getPlayerDomain()); + setGroupDomain(existing.getGroupDomain()); + } + + /** + * Get the domain that holds the players. + * + * @return a domain + */ + public PlayerDomain getPlayerDomain() { + return playerDomain; + } + + /** + * Set a new player domain. + * + * @param playerDomain a domain + */ + public void setPlayerDomain(PlayerDomain playerDomain) { + checkNotNull(playerDomain); + this.playerDomain = new PlayerDomain(playerDomain); + } + + /** + * Set the domain that holds the groups. + * + * @return a domain + */ + public GroupDomain getGroupDomain() { + return groupDomain; + } + + /** + * Set a new group domain. + * + * @param groupDomain a domain + */ + public void setGroupDomain(GroupDomain groupDomain) { + checkNotNull(groupDomain); + this.groupDomain = new GroupDomain(groupDomain); + } + + /** + * Add the given player to the domain, identified by the player's name. + * + * @param name the name of the player + */ + public void addPlayer(String name) { + playerDomain.addPlayer(name); + } + + /** + * Remove the given player from the domain, identified by the player's name. + * + * @param name the name of the player + */ + public void removePlayer(String name) { + playerDomain.removePlayer(name); + } + + /** + * Remove the given player from the domain, identified by the player's UUID. + * + * @param uuid the UUID of the player + */ + public void removePlayer(UUID uuid) { + playerDomain.removePlayer(uuid); + } + + /** + * Add the given player to the domain, identified by the player's UUID. + * + * @param uniqueId the UUID of the player + */ + public void addPlayer(UUID uniqueId) { + playerDomain.addPlayer(uniqueId); + } + + /** + * Remove the given player from the domain, identified by either the + * player's name, the player's unique ID, or both. + * + * @param player the player + */ + public void removePlayer(LocalPlayer player) { + playerDomain.removePlayer(player); + } + + /** + * Add the given player to the domain, identified by the player's UUID. + * + * @param player the player + */ + public void addPlayer(LocalPlayer player) { + playerDomain.addPlayer(player); + } + + /** + * Add all the entries from another domain. + * + * @param other the other domain + */ + public void addAll(DefaultDomain other) { + checkNotNull(other); + for (String player : other.getPlayers()) { + addPlayer(player); + } + for (UUID uuid : other.getUniqueIds()) { + addPlayer(uuid); + } + for (String group : other.getGroups()) { + addGroup(group); + } + } + + /** + * Remove all the entries from another domain. + * + * @param other the other domain + */ + public void removeAll(DefaultDomain other) { + checkNotNull(other); + for (String player : other.getPlayers()) { + removePlayer(player); + } + for (UUID uuid : other.getUniqueIds()) { + removePlayer(uuid); + } + for (String group : other.getGroups()) { + removeGroup(group); + } + } + + /** + * Get the set of player names. + * + * @return the set of player names + */ + public Set getPlayers() { + return playerDomain.getPlayers(); + } + + /** + * Get the set of player UUIDs. + * + * @return the set of player UUIDs + */ + public Set getUniqueIds() { + return playerDomain.getUniqueIds(); + } + + /** + * Add the name of the group to the domain. + * + * @param name the name of the group. + */ + public void addGroup(String name) { + groupDomain.addGroup(name); + } + + /** + * Remove the given group from the domain. + * + * @param name the name of the group + */ + public void removeGroup(String name) { + groupDomain.removeGroup(name); + } + + /** + * Get the set of group names. + * + * @return the set of group names + */ + public Set getGroups() { + return groupDomain.getGroups(); + } + + @Override + public boolean contains(LocalPlayer player) { + return playerDomain.contains(player) || groupDomain.contains(player); + } + + @Override + public boolean contains(UUID uniqueId) { + return playerDomain.contains(uniqueId); + } + + @Override + public boolean contains(String playerName) { + return playerDomain.contains(playerName); + } + + @Override + public int size() { + return groupDomain.size() + playerDomain.size(); + } + + @Override + public void clear() { + playerDomain.clear(); + groupDomain.clear(); + } + + public void removeAll() { + clear(); + } + + public String toPlayersString() { + return toPlayersString(null); + } + + @SuppressWarnings("deprecation") + public String toPlayersString(@Nullable ProfileCache cache) { + StringBuilder str = new StringBuilder(); + List output = new ArrayList(); + + for (String name : playerDomain.getPlayers()) { + output.add("name:" + name); + } + + if (cache != null) { + ImmutableMap results = cache.getAllPresent(playerDomain.getUniqueIds()); + for (UUID uuid : playerDomain.getUniqueIds()) { + Profile profile = results.get(uuid); + if (profile != null) { + output.add(profile.getName() + "*"); + } else { + output.add("uuid:" + uuid); + } + } + } else { + for (UUID uuid : playerDomain.getUniqueIds()) { + output.add("uuid:" + uuid); + } + } + + Collections.sort(output, String.CASE_INSENSITIVE_ORDER); + for (Iterator it = output.iterator(); it.hasNext();) { + str.append(it.next()); + if (it.hasNext()) { + str.append(", "); + } + } + return str.toString(); + } + + public String toGroupsString() { + StringBuilder str = new StringBuilder(); + for (Iterator it = groupDomain.getGroups().iterator(); it.hasNext(); ) { + str.append("*"); + str.append(it.next()); + if (it.hasNext()) { + str.append(", "); + } + } + return str.toString(); + } + + public String toUserFriendlyString() { + StringBuilder str = new StringBuilder(); + + if (playerDomain.size() > 0) { + str.append(toPlayersString()); + } + + if (groupDomain.size() > 0) { + if (str.length() > 0) { + str.append("; "); + } + + str.append(toGroupsString()); + } + + return str.toString(); + } + + public String toUserFriendlyString(ProfileCache cache) { + StringBuilder str = new StringBuilder(); + + if (playerDomain.size() > 0) { + str.append(toPlayersString(cache)); + } + + if (groupDomain.size() > 0) { + if (str.length() > 0) { + str.append("; "); + } + + str.append(toGroupsString()); + } + + return str.toString(); + } + + @Override + public boolean isDirty() { + return playerDomain.isDirty() || groupDomain.isDirty(); + } + + @Override + public void setDirty(boolean dirty) { + playerDomain.setDirty(dirty); + groupDomain.setDirty(dirty); + } + + @Override + public String toString() { + return "{players=" + playerDomain + + ", groups=" + groupDomain + + '}'; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/domains/Domain.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/Domain.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/domains/Domain.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/Domain.java index 0d9c3f5a..8c3235ab 100644 --- a/src/main/java/com/sk89q/worldguard/domains/Domain.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/Domain.java @@ -1,73 +1,73 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.domains; - -import com.sk89q.worldguard.LocalPlayer; - -import java.util.UUID; - -/** - * A domain contains a list of memberships. - */ -public interface Domain { - - /** - * Returns true if a domain contains a player. - * - * @param player the player to check - * @return whether this domain contains {@code player} - */ - boolean contains(LocalPlayer player); - - /** - * Returns true if a domain contains a player. - * - *

This method doesn't check for groups!

- * - * @param uniqueId the UUID of the user - * @return whether this domain contains a player by that name - */ - boolean contains(UUID uniqueId); - - /** - * Returns true if a domain contains a player. - * - *

This method doesn't check for groups!

- * - * @param playerName The name of the player to check - * @return whether this domain contains a player by that name - * @deprecated names are deprecated in MC 1.7+ in favor of UUIDs - */ - @Deprecated - boolean contains(String playerName); - - /** - * Get the number of entries. - * - * @return the number of entries - */ - int size(); - - /** - * Remove all entries. - */ - void clear(); - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.domains; + +import com.sk89q.worldguard.LocalPlayer; + +import java.util.UUID; + +/** + * A domain contains a list of memberships. + */ +public interface Domain { + + /** + * Returns true if a domain contains a player. + * + * @param player the player to check + * @return whether this domain contains {@code player} + */ + boolean contains(LocalPlayer player); + + /** + * Returns true if a domain contains a player. + * + *

This method doesn't check for groups!

+ * + * @param uniqueId the UUID of the user + * @return whether this domain contains a player by that name + */ + boolean contains(UUID uniqueId); + + /** + * Returns true if a domain contains a player. + * + *

This method doesn't check for groups!

+ * + * @param playerName The name of the player to check + * @return whether this domain contains a player by that name + * @deprecated names are deprecated in MC 1.7+ in favor of UUIDs + */ + @Deprecated + boolean contains(String playerName); + + /** + * Get the number of entries. + * + * @return the number of entries + */ + int size(); + + /** + * Remove all entries. + */ + void clear(); + +} diff --git a/src/main/java/com/sk89q/worldguard/domains/DomainCollection.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/DomainCollection.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/domains/DomainCollection.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/DomainCollection.java index f149e24a..5359a494 100644 --- a/src/main/java/com/sk89q/worldguard/domains/DomainCollection.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/DomainCollection.java @@ -1,91 +1,91 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.domains; - -import com.sk89q.worldguard.LocalPlayer; - -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.UUID; - -/** - * @deprecated not used by WorldGuard and not maintained - */ -@Deprecated -public class DomainCollection implements Domain { - - private Set domains; - - public DomainCollection() { - domains = new LinkedHashSet(); - } - - public void add(Domain domain) { - domains.add(domain); - } - - public void remove(Domain domain) { - domains.remove(domain); - } - - @Override - public int size() { - return domains.size(); - } - - @Override - public void clear() { - domains.clear(); - } - - @Override - public boolean contains(LocalPlayer player) { - for (Domain domain : domains) { - if (domain.contains(player)) { - return true; - } - } - - return false; - } - - @Override - public boolean contains(UUID uniqueId) { - for (Domain domain : domains) { - if (domain.contains(uniqueId)) { - return true; - } - } - - return false; - } - - @Override - public boolean contains(String playerName) { - for (Domain domain : domains) { - if (domain.contains(playerName)) { - return true; - } - } - - return false; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.domains; + +import com.sk89q.worldguard.LocalPlayer; + +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.UUID; + +/** + * @deprecated not used by WorldGuard and not maintained + */ +@Deprecated +public class DomainCollection implements Domain { + + private Set domains; + + public DomainCollection() { + domains = new LinkedHashSet(); + } + + public void add(Domain domain) { + domains.add(domain); + } + + public void remove(Domain domain) { + domains.remove(domain); + } + + @Override + public int size() { + return domains.size(); + } + + @Override + public void clear() { + domains.clear(); + } + + @Override + public boolean contains(LocalPlayer player) { + for (Domain domain : domains) { + if (domain.contains(player)) { + return true; + } + } + + return false; + } + + @Override + public boolean contains(UUID uniqueId) { + for (Domain domain : domains) { + if (domain.contains(uniqueId)) { + return true; + } + } + + return false; + } + + @Override + public boolean contains(String playerName) { + for (Domain domain : domains) { + if (domain.contains(playerName)) { + return true; + } + } + + return false; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/domains/GroupDomain.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/GroupDomain.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/domains/GroupDomain.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/GroupDomain.java index 344da282..d9a0386b 100644 --- a/src/main/java/com/sk89q/worldguard/domains/GroupDomain.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/GroupDomain.java @@ -1,151 +1,151 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.domains; - -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.util.ChangeTracked; - -import java.util.Collections; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.CopyOnWriteArraySet; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Contains groups in a domain. - */ -public class GroupDomain implements Domain, ChangeTracked { - - private final Set groups = new CopyOnWriteArraySet(); - private boolean dirty = true; - - /** - * Create a new instance. - */ - public GroupDomain() { - } - - /** - * Create a new instance with copies from another domain. - * - * @param domain the domain to copy values from - */ - public GroupDomain(GroupDomain domain) { - checkNotNull(domain, "domain"); - groups.addAll(domain.getGroups()); - } - - /** - * Create a new instance. - * - * @param groups an array of groups - */ - public GroupDomain(String[] groups) { - checkNotNull(groups); - for (String group : groups) { - addGroup(group); - } - } - - /** - * Add the name of the group to the domain. - * - * @param name the name of the group. - */ - public void addGroup(String name) { - checkNotNull(name); - if (!name.trim().isEmpty()) { - setDirty(true); - groups.add(name.trim().toLowerCase()); - } - } - - /** - * Remove the given group from the domain. - * - * @param name the name of the group - */ - public void removeGroup(String name) { - checkNotNull(name); - setDirty(true); - groups.remove(name.trim().toLowerCase()); - } - - @Override - public boolean contains(LocalPlayer player) { - checkNotNull(player); - for (String group : groups) { - if (player.hasGroup(group)) { - return true; - } - } - - return false; - } - - /** - * Get the set of group names. - * - * @return the set of group names - */ - public Set getGroups() { - return Collections.unmodifiableSet(groups); - } - - @Override - public boolean contains(UUID uniqueId) { - return false; // GroupDomains can't contain UUIDs - } - - @Override - public boolean contains(String playerName) { - return false; // GroupDomains can't contain player names. - } - - @Override - public int size() { - return groups.size(); - } - - @Override - public void clear() { - setDirty(true); - groups.clear(); - } - - @Override - public boolean isDirty() { - return dirty; - } - - @Override - public void setDirty(boolean dirty) { - this.dirty = dirty; - } - - @Override - public String toString() { - return "{" + - "names=" + groups + - '}'; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.domains; + +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.util.ChangeTracked; + +import java.util.Collections; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.CopyOnWriteArraySet; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * Contains groups in a domain. + */ +public class GroupDomain implements Domain, ChangeTracked { + + private final Set groups = new CopyOnWriteArraySet(); + private boolean dirty = true; + + /** + * Create a new instance. + */ + public GroupDomain() { + } + + /** + * Create a new instance with copies from another domain. + * + * @param domain the domain to copy values from + */ + public GroupDomain(GroupDomain domain) { + checkNotNull(domain, "domain"); + groups.addAll(domain.getGroups()); + } + + /** + * Create a new instance. + * + * @param groups an array of groups + */ + public GroupDomain(String[] groups) { + checkNotNull(groups); + for (String group : groups) { + addGroup(group); + } + } + + /** + * Add the name of the group to the domain. + * + * @param name the name of the group. + */ + public void addGroup(String name) { + checkNotNull(name); + if (!name.trim().isEmpty()) { + setDirty(true); + groups.add(name.trim().toLowerCase()); + } + } + + /** + * Remove the given group from the domain. + * + * @param name the name of the group + */ + public void removeGroup(String name) { + checkNotNull(name); + setDirty(true); + groups.remove(name.trim().toLowerCase()); + } + + @Override + public boolean contains(LocalPlayer player) { + checkNotNull(player); + for (String group : groups) { + if (player.hasGroup(group)) { + return true; + } + } + + return false; + } + + /** + * Get the set of group names. + * + * @return the set of group names + */ + public Set getGroups() { + return Collections.unmodifiableSet(groups); + } + + @Override + public boolean contains(UUID uniqueId) { + return false; // GroupDomains can't contain UUIDs + } + + @Override + public boolean contains(String playerName) { + return false; // GroupDomains can't contain player names. + } + + @Override + public int size() { + return groups.size(); + } + + @Override + public void clear() { + setDirty(true); + groups.clear(); + } + + @Override + public boolean isDirty() { + return dirty; + } + + @Override + public void setDirty(boolean dirty) { + this.dirty = dirty; + } + + @Override + public String toString() { + return "{" + + "names=" + groups + + '}'; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/domains/PlayerDomain.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/PlayerDomain.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/domains/PlayerDomain.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/PlayerDomain.java index 7958e517..58e589ea 100644 --- a/src/main/java/com/sk89q/worldguard/domains/PlayerDomain.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/domains/PlayerDomain.java @@ -1,210 +1,210 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.domains; - -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.util.ChangeTracked; - -import java.util.Collections; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.CopyOnWriteArraySet; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Stores players (only) in a domain. - */ -public class PlayerDomain implements Domain, ChangeTracked { - - private final Set uniqueIds = new CopyOnWriteArraySet(); - private final Set names = new CopyOnWriteArraySet(); - private boolean dirty = true; - - /** - * Create a new instance. - */ - public PlayerDomain() { - } - - /** - * Create a new instance. - * - * @param domain the domain to copy values from - */ - public PlayerDomain(PlayerDomain domain) { - checkNotNull(domain, "domain"); - uniqueIds.addAll(domain.getUniqueIds()); - names.addAll(domain.getPlayers()); - dirty = true; - } - - /** - * Create a new instance with the given names. - * - * @param names an array of names - * @deprecated names are deprecated in favor of UUIDs in MC 1.7+ - */ - @Deprecated - public PlayerDomain(String[] names) { - for (String name : names) { - addPlayer(name); - } - } - - /** - * Add the given player to the domain, identified by the player's name. - * - * @param name the name of the player - */ - public void addPlayer(String name) { - checkNotNull(name); - if (!name.trim().isEmpty()) { - setDirty(true); - names.add(name.trim().toLowerCase()); - // Trim because some names contain spaces (previously valid Minecraft - // names) and we cannot store these correctly in the SQL storage - // implementations - } - } - - /** - * Add the given player to the domain, identified by the player's UUID. - * - * @param uniqueId the UUID of the player - */ - public void addPlayer(UUID uniqueId) { - checkNotNull(uniqueId); - setDirty(true); - uniqueIds.add(uniqueId); - } - - /** - * Add the given player to the domain, identified by the player's UUID. - * - * @param player the player - */ - public void addPlayer(LocalPlayer player) { - checkNotNull(player); - setDirty(true); - addPlayer(player.getUniqueId()); - } - - /** - * Remove the given player from the domain, identified by the player's name. - * - * @param name the name of the player - */ - public void removePlayer(String name) { - checkNotNull(name); - setDirty(true); - names.remove(name.trim().toLowerCase()); - } - - /** - * Remove the given player from the domain, identified by the player's UUID. - * - * @param uuid the UUID of the player - */ - public void removePlayer(UUID uuid) { - checkNotNull(uuid); - setDirty(true); - uniqueIds.remove(uuid); - } - - /** - * Remove the given player from the domain, identified by either the - * player's name, the player's unique ID, or both. - * - * @param player the player - */ - public void removePlayer(LocalPlayer player) { - checkNotNull(player); - setDirty(true); - removePlayer(player.getName()); - removePlayer(player.getUniqueId()); - } - - @Override - public boolean contains(LocalPlayer player) { - checkNotNull(player); - return contains(player.getName().trim().toLowerCase()) || contains(player.getUniqueId()); - } - - /** - * Get the set of player names. - * - * @return the set of player names - */ - public Set getPlayers() { - return Collections.unmodifiableSet(names); - } - - /** - * Get the set of player UUIDs. - * - * @return the set of player UUIDs - */ - public Set getUniqueIds() { - return Collections.unmodifiableSet(uniqueIds); - } - - @Override - public boolean contains(UUID uniqueId) { - checkNotNull(uniqueId); - return uniqueIds.contains(uniqueId); - } - - @Override - public boolean contains(String playerName) { - checkNotNull(playerName); - return names.contains(playerName.trim().toLowerCase()); - } - - @Override - public int size() { - return names.size() + uniqueIds.size(); - } - - @Override - public void clear() { - setDirty(true); - uniqueIds.clear(); - names.clear(); - } - - @Override - public boolean isDirty() { - return dirty; - } - - @Override - public void setDirty(boolean dirty) { - this.dirty = dirty; - } - - @Override - public String toString() { - return "{" + - "uuids=" + uniqueIds + - ", names=" + names + - '}'; - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.domains; + +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.util.ChangeTracked; + +import java.util.Collections; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.CopyOnWriteArraySet; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * Stores players (only) in a domain. + */ +public class PlayerDomain implements Domain, ChangeTracked { + + private final Set uniqueIds = new CopyOnWriteArraySet(); + private final Set names = new CopyOnWriteArraySet(); + private boolean dirty = true; + + /** + * Create a new instance. + */ + public PlayerDomain() { + } + + /** + * Create a new instance. + * + * @param domain the domain to copy values from + */ + public PlayerDomain(PlayerDomain domain) { + checkNotNull(domain, "domain"); + uniqueIds.addAll(domain.getUniqueIds()); + names.addAll(domain.getPlayers()); + dirty = true; + } + + /** + * Create a new instance with the given names. + * + * @param names an array of names + * @deprecated names are deprecated in favor of UUIDs in MC 1.7+ + */ + @Deprecated + public PlayerDomain(String[] names) { + for (String name : names) { + addPlayer(name); + } + } + + /** + * Add the given player to the domain, identified by the player's name. + * + * @param name the name of the player + */ + public void addPlayer(String name) { + checkNotNull(name); + if (!name.trim().isEmpty()) { + setDirty(true); + names.add(name.trim().toLowerCase()); + // Trim because some names contain spaces (previously valid Minecraft + // names) and we cannot store these correctly in the SQL storage + // implementations + } + } + + /** + * Add the given player to the domain, identified by the player's UUID. + * + * @param uniqueId the UUID of the player + */ + public void addPlayer(UUID uniqueId) { + checkNotNull(uniqueId); + setDirty(true); + uniqueIds.add(uniqueId); + } + + /** + * Add the given player to the domain, identified by the player's UUID. + * + * @param player the player + */ + public void addPlayer(LocalPlayer player) { + checkNotNull(player); + setDirty(true); + addPlayer(player.getUniqueId()); + } + + /** + * Remove the given player from the domain, identified by the player's name. + * + * @param name the name of the player + */ + public void removePlayer(String name) { + checkNotNull(name); + setDirty(true); + names.remove(name.trim().toLowerCase()); + } + + /** + * Remove the given player from the domain, identified by the player's UUID. + * + * @param uuid the UUID of the player + */ + public void removePlayer(UUID uuid) { + checkNotNull(uuid); + setDirty(true); + uniqueIds.remove(uuid); + } + + /** + * Remove the given player from the domain, identified by either the + * player's name, the player's unique ID, or both. + * + * @param player the player + */ + public void removePlayer(LocalPlayer player) { + checkNotNull(player); + setDirty(true); + removePlayer(player.getName()); + removePlayer(player.getUniqueId()); + } + + @Override + public boolean contains(LocalPlayer player) { + checkNotNull(player); + return contains(player.getName().trim().toLowerCase()) || contains(player.getUniqueId()); + } + + /** + * Get the set of player names. + * + * @return the set of player names + */ + public Set getPlayers() { + return Collections.unmodifiableSet(names); + } + + /** + * Get the set of player UUIDs. + * + * @return the set of player UUIDs + */ + public Set getUniqueIds() { + return Collections.unmodifiableSet(uniqueIds); + } + + @Override + public boolean contains(UUID uniqueId) { + checkNotNull(uniqueId); + return uniqueIds.contains(uniqueId); + } + + @Override + public boolean contains(String playerName) { + checkNotNull(playerName); + return names.contains(playerName.trim().toLowerCase()); + } + + @Override + public int size() { + return names.size() + uniqueIds.size(); + } + + @Override + public void clear() { + setDirty(true); + uniqueIds.clear(); + names.clear(); + } + + @Override + public boolean isDirty() { + return dirty; + } + + @Override + public void setDirty(boolean dirty) { + this.dirty = dirty; + } + + @Override + public String toString() { + return "{" + + "uuids=" + uniqueIds + + ", names=" + names + + '}'; + } +} diff --git a/src/main/java/com/sk89q/worldguard/internal/PermissionModel.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/internal/PermissionModel.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/internal/PermissionModel.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/internal/PermissionModel.java diff --git a/src/main/java/com/sk89q/worldguard/internal/util/sql/StatementUtils.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/internal/util/sql/StatementUtils.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/internal/util/sql/StatementUtils.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/internal/util/sql/StatementUtils.java diff --git a/src/main/java/com/sk89q/worldguard/protection/AbstractRegionSet.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/AbstractRegionSet.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/AbstractRegionSet.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/AbstractRegionSet.java diff --git a/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java index 90ca07dd..ebbf207a 100644 --- a/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java @@ -1,244 +1,244 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection; - -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.bukkit.RegionQuery; -import com.sk89q.worldguard.protection.association.RegionAssociable; -import com.sk89q.worldguard.protection.flags.DefaultFlag; -import com.sk89q.worldguard.protection.flags.Flag; -import com.sk89q.worldguard.protection.flags.RegionGroup; -import com.sk89q.worldguard.protection.flags.StateFlag; -import com.sk89q.worldguard.protection.flags.StateFlag.State; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; - -import javax.annotation.Nullable; -import java.util.Collection; -import java.util.Set; - -/** - * Represents the effective set of flags, owners, and members for a given - * spatial query. - * - *

An instance of this can be created using the spatial query methods - * available on {@link RegionManager}.

- */ -public interface ApplicableRegionSet extends Iterable { - - /** - * Return whether this region set is a virtual set. A virtual set - * does not contain real results. - * - *

A virtual result may be returned if region data failed to load or - * there was some special exception (i.e. the region bypass permission). - *

- * - *

Be sure to check the value of this flag if an instance of this - * interface is being retrieved from {@link RegionQuery} as it may - * return an instance of {@link PermissiveRegionSet} or - * {@link FailedLoadRegionSet}, among other possibilities.

- * - * @return true if loaded - * @see FailedLoadRegionSet - */ - boolean isVirtual(); - - /** - * Tests whether the {@link DefaultFlag#BUILD} flag or membership - * requirements permit the given player. - * - * @param player the player to check - * @return true if permitted - * @deprecated use {@link #testState(RegionAssociable, StateFlag...)} - */ - @Deprecated - boolean canBuild(LocalPlayer player); - - /** - * Test whether the (effective) value for a list of state flags equals - * {@code ALLOW}. - * - *

{@code subject} can be non-null to satisfy region group requirements, - * otherwise it will be assumed that the caller that is not a member of any - * regions. (Flags on a region can be changed so that they only apply - * to certain users.) The subject argument is required if the - * {@link DefaultFlag#BUILD} flag is in the list of flags.

- * - * @param subject an optional subject, which would be used to determine the region groups that apply - * @param flags a list of flags to check - * @return true if the result was {@code ALLOW} - * @see #queryState(RegionAssociable, StateFlag...) - */ - boolean testState(@Nullable RegionAssociable subject, StateFlag... flags); - - /** - * Get the (effective) value for a list of state flags. The rules of - * states is observed here; that is, {@code DENY} overrides {@code ALLOW}, - * and {@code ALLOW} overrides {@code NONE}. One flag may override another. - * - *

{@code subject} can be non-null to satisfy region group requirements, - * otherwise it will be assumed that the caller that is not a member of any - * regions. (Flags on a region can be changed so that they only apply - * to certain users.) The subject argument is required if the - * {@link DefaultFlag#BUILD} flag is in the list of flags.

- * - * @param subject an optional subject, which would be used to determine the region groups that apply - * @param flags a list of flags to check - * @return a state - */ - @Nullable - State queryState(@Nullable RegionAssociable subject, StateFlag... flags); - - /** - * Get the effective value for a flag. If there are multiple values - * (for example, multiple overlapping regions with - * the same priority may have the same flag set), then the selected - * (or "winning") value will depend on the flag type. - * - *

Only some flag types actually have a strategy for picking the - * "best value." For most types, the actual value that is chosen to be - * returned is undefined (it could be any value). As of writing, the only - * type of flag that actually has a strategy for picking a value is the - * {@link StateFlag}.

- * - *

{@code subject} can be non-null to satisfy region group requirements, - * otherwise it will be assumed that the caller that is not a member of any - * regions. (Flags on a region can be changed so that they only apply - * to certain users.) The subject argument is required if the - * {@link DefaultFlag#BUILD} flag is the flag being queried.

- * - * @param subject an optional subject, which would be used to determine the region group to apply - * @param flag the flag - * @return a value, which could be {@code null} - */ - @Nullable - V queryValue(@Nullable RegionAssociable subject, Flag flag); - - /** - * Get the effective values for a flag, returning a collection of all - * values. It is up to the caller to determine which value, if any, - * from the collection will be used. - * - *

{@code subject} can be non-null to satisfy region group requirements, - * otherwise it will be assumed that the caller that is not a member of any - * regions. (Flags on a region can be changed so that they only apply - * to certain users.) The subject argument is required if the - * {@link DefaultFlag#BUILD} flag is the flag being queried.

- * - * @param subject an optional subject, which would be used to determine the region group to apply - * @param flag the flag - * @return a collection of values - */ - Collection queryAllValues(@Nullable RegionAssociable subject, Flag flag); - - /** - * Test whether the construct flag evaluates true for the given player. - * - * @param player the player - * @return true if true - * @deprecated The {@code CONSTRUCT} flag is being removed and is no longer - * needed because flags now support groups assigned to them. - */ - @Deprecated - boolean canConstruct(LocalPlayer player); - - /** - * Gets the state of a state flag. This cannot be used for the build flag. - * - * @param flag flag to check - * @return whether it is allowed - * @throws IllegalArgumentException if the build flag is given - * @deprecated use {@link #queryState(RegionAssociable, StateFlag...)} instead - */ - @Deprecated - boolean allows(StateFlag flag); - - /** - * Gets the state of a state flag. This cannot be used for the build flag. - * - * @param flag flag to check - * @param player player (used by some flags) - * @return whether the state is allows for it - * @throws IllegalArgumentException if the build flag is given - * @deprecated use {@link #queryState(RegionAssociable, StateFlag...)} instead - */ - @Deprecated - boolean allows(StateFlag flag, @Nullable LocalPlayer player); - - /** - * Test whether a player is an owner of all regions in this set. - * - * @param player the player - * @return whether the player is an owner of all regions - */ - boolean isOwnerOfAll(LocalPlayer player); - - /** - * Test whether a player is an owner or member of all regions in this set. - * - * @param player the player - * @return whether the player is a member of all regions - */ - boolean isMemberOfAll(LocalPlayer player); - - /** - * Gets the value of a flag. Do not use this for state flags - * (use {@link #allows(StateFlag, LocalPlayer)} for that). - * - * @param flag the flag to check - * @return value of the flag, which may be null - * @deprecated Use {@link #queryValue(RegionAssociable, Flag)} instead. There - * is no difference in functionality. - */ - @Deprecated - @Nullable - , V> V getFlag(T flag); - - /** - * Gets the value of a flag. Do not use this for state flags - * (use {@link #allows(StateFlag, LocalPlayer)} for that). - * - * @param flag flag to check - * @param groupPlayer player to check {@link RegionGroup}s against - * @return value of the flag, which may be null - * @throws IllegalArgumentException if a StateFlag is given - * @deprecated Use {@link #queryValue(RegionAssociable, Flag)} instead. There - * is no difference in functionality. - */ - @Deprecated - @Nullable - , V> V getFlag(T flag, @Nullable LocalPlayer groupPlayer); - - /** - * Get the number of regions that are included. - * - * @return the number of contained regions - */ - int size(); - - /** - * Get an immutable set of regions that are included in this set. - * - * @return a set of regions - */ - Set getRegions(); - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.bukkit.RegionQuery; +import com.sk89q.worldguard.protection.association.RegionAssociable; +import com.sk89q.worldguard.protection.flags.DefaultFlag; +import com.sk89q.worldguard.protection.flags.Flag; +import com.sk89q.worldguard.protection.flags.RegionGroup; +import com.sk89q.worldguard.protection.flags.StateFlag; +import com.sk89q.worldguard.protection.flags.StateFlag.State; +import com.sk89q.worldguard.protection.managers.RegionManager; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; + +import javax.annotation.Nullable; +import java.util.Collection; +import java.util.Set; + +/** + * Represents the effective set of flags, owners, and members for a given + * spatial query. + * + *

An instance of this can be created using the spatial query methods + * available on {@link RegionManager}.

+ */ +public interface ApplicableRegionSet extends Iterable { + + /** + * Return whether this region set is a virtual set. A virtual set + * does not contain real results. + * + *

A virtual result may be returned if region data failed to load or + * there was some special exception (i.e. the region bypass permission). + *

+ * + *

Be sure to check the value of this flag if an instance of this + * interface is being retrieved from {@link RegionQuery} as it may + * return an instance of {@link PermissiveRegionSet} or + * {@link FailedLoadRegionSet}, among other possibilities.

+ * + * @return true if loaded + * @see FailedLoadRegionSet + */ + boolean isVirtual(); + + /** + * Tests whether the {@link DefaultFlag#BUILD} flag or membership + * requirements permit the given player. + * + * @param player the player to check + * @return true if permitted + * @deprecated use {@link #testState(RegionAssociable, StateFlag...)} + */ + @Deprecated + boolean canBuild(LocalPlayer player); + + /** + * Test whether the (effective) value for a list of state flags equals + * {@code ALLOW}. + * + *

{@code subject} can be non-null to satisfy region group requirements, + * otherwise it will be assumed that the caller that is not a member of any + * regions. (Flags on a region can be changed so that they only apply + * to certain users.) The subject argument is required if the + * {@link DefaultFlag#BUILD} flag is in the list of flags.

+ * + * @param subject an optional subject, which would be used to determine the region groups that apply + * @param flags a list of flags to check + * @return true if the result was {@code ALLOW} + * @see #queryState(RegionAssociable, StateFlag...) + */ + boolean testState(@Nullable RegionAssociable subject, StateFlag... flags); + + /** + * Get the (effective) value for a list of state flags. The rules of + * states is observed here; that is, {@code DENY} overrides {@code ALLOW}, + * and {@code ALLOW} overrides {@code NONE}. One flag may override another. + * + *

{@code subject} can be non-null to satisfy region group requirements, + * otherwise it will be assumed that the caller that is not a member of any + * regions. (Flags on a region can be changed so that they only apply + * to certain users.) The subject argument is required if the + * {@link DefaultFlag#BUILD} flag is in the list of flags.

+ * + * @param subject an optional subject, which would be used to determine the region groups that apply + * @param flags a list of flags to check + * @return a state + */ + @Nullable + State queryState(@Nullable RegionAssociable subject, StateFlag... flags); + + /** + * Get the effective value for a flag. If there are multiple values + * (for example, multiple overlapping regions with + * the same priority may have the same flag set), then the selected + * (or "winning") value will depend on the flag type. + * + *

Only some flag types actually have a strategy for picking the + * "best value." For most types, the actual value that is chosen to be + * returned is undefined (it could be any value). As of writing, the only + * type of flag that actually has a strategy for picking a value is the + * {@link StateFlag}.

+ * + *

{@code subject} can be non-null to satisfy region group requirements, + * otherwise it will be assumed that the caller that is not a member of any + * regions. (Flags on a region can be changed so that they only apply + * to certain users.) The subject argument is required if the + * {@link DefaultFlag#BUILD} flag is the flag being queried.

+ * + * @param subject an optional subject, which would be used to determine the region group to apply + * @param flag the flag + * @return a value, which could be {@code null} + */ + @Nullable + V queryValue(@Nullable RegionAssociable subject, Flag flag); + + /** + * Get the effective values for a flag, returning a collection of all + * values. It is up to the caller to determine which value, if any, + * from the collection will be used. + * + *

{@code subject} can be non-null to satisfy region group requirements, + * otherwise it will be assumed that the caller that is not a member of any + * regions. (Flags on a region can be changed so that they only apply + * to certain users.) The subject argument is required if the + * {@link DefaultFlag#BUILD} flag is the flag being queried.

+ * + * @param subject an optional subject, which would be used to determine the region group to apply + * @param flag the flag + * @return a collection of values + */ + Collection queryAllValues(@Nullable RegionAssociable subject, Flag flag); + + /** + * Test whether the construct flag evaluates true for the given player. + * + * @param player the player + * @return true if true + * @deprecated The {@code CONSTRUCT} flag is being removed and is no longer + * needed because flags now support groups assigned to them. + */ + @Deprecated + boolean canConstruct(LocalPlayer player); + + /** + * Gets the state of a state flag. This cannot be used for the build flag. + * + * @param flag flag to check + * @return whether it is allowed + * @throws IllegalArgumentException if the build flag is given + * @deprecated use {@link #queryState(RegionAssociable, StateFlag...)} instead + */ + @Deprecated + boolean allows(StateFlag flag); + + /** + * Gets the state of a state flag. This cannot be used for the build flag. + * + * @param flag flag to check + * @param player player (used by some flags) + * @return whether the state is allows for it + * @throws IllegalArgumentException if the build flag is given + * @deprecated use {@link #queryState(RegionAssociable, StateFlag...)} instead + */ + @Deprecated + boolean allows(StateFlag flag, @Nullable LocalPlayer player); + + /** + * Test whether a player is an owner of all regions in this set. + * + * @param player the player + * @return whether the player is an owner of all regions + */ + boolean isOwnerOfAll(LocalPlayer player); + + /** + * Test whether a player is an owner or member of all regions in this set. + * + * @param player the player + * @return whether the player is a member of all regions + */ + boolean isMemberOfAll(LocalPlayer player); + + /** + * Gets the value of a flag. Do not use this for state flags + * (use {@link #allows(StateFlag, LocalPlayer)} for that). + * + * @param flag the flag to check + * @return value of the flag, which may be null + * @deprecated Use {@link #queryValue(RegionAssociable, Flag)} instead. There + * is no difference in functionality. + */ + @Deprecated + @Nullable + , V> V getFlag(T flag); + + /** + * Gets the value of a flag. Do not use this for state flags + * (use {@link #allows(StateFlag, LocalPlayer)} for that). + * + * @param flag flag to check + * @param groupPlayer player to check {@link RegionGroup}s against + * @return value of the flag, which may be null + * @throws IllegalArgumentException if a StateFlag is given + * @deprecated Use {@link #queryValue(RegionAssociable, Flag)} instead. There + * is no difference in functionality. + */ + @Deprecated + @Nullable + , V> V getFlag(T flag, @Nullable LocalPlayer groupPlayer); + + /** + * Get the number of regions that are included. + * + * @return the number of contained regions + */ + int size(); + + /** + * Get an immutable set of regions that are included in this set. + * + * @return a set of regions + */ + Set getRegions(); + +} diff --git a/src/main/java/com/sk89q/worldguard/protection/FailedLoadRegionSet.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/FailedLoadRegionSet.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/FailedLoadRegionSet.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/FailedLoadRegionSet.java diff --git a/src/main/java/com/sk89q/worldguard/protection/FlagValueCalculator.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/FlagValueCalculator.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/FlagValueCalculator.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/FlagValueCalculator.java diff --git a/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java diff --git a/src/main/java/com/sk89q/worldguard/protection/PermissiveRegionSet.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/PermissiveRegionSet.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/PermissiveRegionSet.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/PermissiveRegionSet.java diff --git a/src/main/java/com/sk89q/worldguard/protection/RegionResultSet.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/RegionResultSet.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/RegionResultSet.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/RegionResultSet.java diff --git a/src/main/java/com/sk89q/worldguard/protection/UnsupportedIntersectionException.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/UnsupportedIntersectionException.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/protection/UnsupportedIntersectionException.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/UnsupportedIntersectionException.java index 21a2ea28..ba2c1492 100644 --- a/src/main/java/com/sk89q/worldguard/protection/UnsupportedIntersectionException.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/UnsupportedIntersectionException.java @@ -1,30 +1,30 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection; - -/** - * Thrown when an intersection between two different types of regions is not - * supported. - * - * @deprecated no longer utilized - */ -@Deprecated -public class UnsupportedIntersectionException extends Exception { -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection; + +/** + * Thrown when an intersection between two different types of regions is not + * supported. + * + * @deprecated no longer utilized + */ +@Deprecated +public class UnsupportedIntersectionException extends Exception { +} diff --git a/src/main/java/com/sk89q/worldguard/protection/association/Associables.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/Associables.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/association/Associables.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/Associables.java diff --git a/src/main/java/com/sk89q/worldguard/protection/association/ConstantAssociation.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/ConstantAssociation.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/association/ConstantAssociation.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/ConstantAssociation.java diff --git a/src/main/java/com/sk89q/worldguard/protection/association/RegionAssociable.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/RegionAssociable.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/association/RegionAssociable.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/RegionAssociable.java diff --git a/src/main/java/com/sk89q/worldguard/protection/association/RegionOverlapAssociation.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/RegionOverlapAssociation.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/association/RegionOverlapAssociation.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/association/RegionOverlapAssociation.java diff --git a/src/main/java/com/sk89q/worldguard/protection/events/DisallowedPVPEvent.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/events/DisallowedPVPEvent.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/protection/events/DisallowedPVPEvent.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/events/DisallowedPVPEvent.java index 1726a997..739deabb 100644 --- a/src/main/java/com/sk89q/worldguard/protection/events/DisallowedPVPEvent.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/events/DisallowedPVPEvent.java @@ -1,81 +1,81 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.events; - -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -/** - * This event is fired when PVP is disallowed between players due to a "pvp deny" flag. - * Cancelling this event allows the PVP in spite of this. - * - * @author Score_Under - */ -public class DisallowedPVPEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - - private boolean cancelled = false; - private final Player attacker; - private final Player defender; - private final Event event; - - public DisallowedPVPEvent(final Player attacker, final Player defender, Event event) { - this.attacker = attacker; - this.defender = defender; - this.event = event; - } - - public boolean isCancelled() { - return cancelled; - } - - public void setCancelled(boolean cancelled) { - this.cancelled = cancelled; - } - - /** - * @return the attacking player. - */ - public Player getAttacker() { - return attacker; - } - - /** - * @return the defending player. - */ - public Player getDefender() { - return defender; - } - - public Event getCause() { - return event; - } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * This event is fired when PVP is disallowed between players due to a "pvp deny" flag. + * Cancelling this event allows the PVP in spite of this. + * + * @author Score_Under + */ +public class DisallowedPVPEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + + private boolean cancelled = false; + private final Player attacker; + private final Player defender; + private final Event event; + + public DisallowedPVPEvent(final Player attacker, final Player defender, Event event) { + this.attacker = attacker; + this.defender = defender; + this.event = event; + } + + public boolean isCancelled() { + return cancelled; + } + + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + /** + * @return the attacking player. + */ + public Player getAttacker() { + return attacker; + } + + /** + * @return the defending player. + */ + public Player getDefender() { + return defender; + } + + public Event getCause() { + return event; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/BooleanFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/BooleanFlag.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/protection/flags/BooleanFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/BooleanFlag.java index 3568f1d8..22b698e1 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/BooleanFlag.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/BooleanFlag.java @@ -1,70 +1,70 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.flags; - -import org.bukkit.command.CommandSender; - -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; - -/** - * A boolean flag. - */ -public class BooleanFlag extends Flag { - - public BooleanFlag(String name, RegionGroup defaultGroup) { - super(name, defaultGroup); - } - - public BooleanFlag(String name) { - super(name); - } - - @Override - public Boolean parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { - input = input.trim(); - - if (input.equalsIgnoreCase("true") || input.equalsIgnoreCase("yes") - || input.equalsIgnoreCase("on") - || input.equalsIgnoreCase("1")) { - return true; - } else if (input.equalsIgnoreCase("false") || input.equalsIgnoreCase("no") - || input.equalsIgnoreCase("off") - || input.equalsIgnoreCase("0")) { - return false; - } else { - throw new InvalidFlagFormat("Not a yes/no value: " + input); - } - } - - @Override - public Boolean unmarshal(Object o) { - if (o instanceof Boolean) { - return (Boolean) o; - } else { - return null; - } - } - - @Override - public Object marshal(Boolean o) { - return o; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.flags; + +import org.bukkit.command.CommandSender; + +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + +/** + * A boolean flag. + */ +public class BooleanFlag extends Flag { + + public BooleanFlag(String name, RegionGroup defaultGroup) { + super(name, defaultGroup); + } + + public BooleanFlag(String name) { + super(name); + } + + @Override + public Boolean parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { + input = input.trim(); + + if (input.equalsIgnoreCase("true") || input.equalsIgnoreCase("yes") + || input.equalsIgnoreCase("on") + || input.equalsIgnoreCase("1")) { + return true; + } else if (input.equalsIgnoreCase("false") || input.equalsIgnoreCase("no") + || input.equalsIgnoreCase("off") + || input.equalsIgnoreCase("0")) { + return false; + } else { + throw new InvalidFlagFormat("Not a yes/no value: " + input); + } + } + + @Override + public Boolean unmarshal(Object o) { + if (o instanceof Boolean) { + return (Boolean) o; + } else { + return null; + } + } + + @Override + public Object marshal(Boolean o) { + return o; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/BuildFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/BuildFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/BuildFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/BuildFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/CommandStringFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/CommandStringFlag.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/protection/flags/CommandStringFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/CommandStringFlag.java index 284567ca..a21b8bb2 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/CommandStringFlag.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/CommandStringFlag.java @@ -1,62 +1,62 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.flags; - -import org.bukkit.command.CommandSender; - -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; - -/** - * Stores a command/ - */ -public class CommandStringFlag extends Flag { - - public CommandStringFlag(String name, RegionGroup defaultGroup) { - super(name, defaultGroup); - } - - public CommandStringFlag(String name) { - super(name); - } - - @Override - public String parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { - input = input.trim(); - if (!input.startsWith("/")) { - input = "/" + input; - } - return input.toLowerCase(); - } - - @Override - public String unmarshal(Object o) { - if (o instanceof String) { - return (String) o; - } else { - return null; - } - } - - @Override - public Object marshal(String o) { - return o; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.flags; + +import org.bukkit.command.CommandSender; + +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + +/** + * Stores a command/ + */ +public class CommandStringFlag extends Flag { + + public CommandStringFlag(String name, RegionGroup defaultGroup) { + super(name, defaultGroup); + } + + public CommandStringFlag(String name) { + super(name); + } + + @Override + public String parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { + input = input.trim(); + if (!input.startsWith("/")) { + input = "/" + input; + } + return input.toLowerCase(); + } + + @Override + public String unmarshal(Object o) { + if (o instanceof String) { + return (String) o; + } else { + return null; + } + } + + @Override + public Object marshal(String o) { + return o; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/DefaultFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/DoubleFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/DoubleFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/DoubleFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/DoubleFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/EntityTypeFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/EntityTypeFlag.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/protection/flags/EntityTypeFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/EntityTypeFlag.java index daf36290..79f0d605 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/EntityTypeFlag.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/EntityTypeFlag.java @@ -1,53 +1,53 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.flags; - -import org.bukkit.entity.EntityType; - -/** - * Stores an entity type. - */ -public class EntityTypeFlag extends EnumFlag { - - public EntityTypeFlag(String name, RegionGroup defaultGroup) { - super(name, EntityType.class, defaultGroup); - } - - public EntityTypeFlag(String name) { - super(name, EntityType.class); - } - - @Override - public EntityType detectValue(String input) { - EntityType lowMatch = null; - - for (EntityType type : EntityType.values()) { - if (type.name().equalsIgnoreCase(input.trim())) { - return type; - } - - if (type.name().toLowerCase().startsWith(input.toLowerCase().trim())) { - lowMatch = type; - } - } - - return lowMatch; - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.flags; + +import org.bukkit.entity.EntityType; + +/** + * Stores an entity type. + */ +public class EntityTypeFlag extends EnumFlag { + + public EntityTypeFlag(String name, RegionGroup defaultGroup) { + super(name, EntityType.class, defaultGroup); + } + + public EntityTypeFlag(String name) { + super(name, EntityType.class); + } + + @Override + public EntityType detectValue(String input) { + EntityType lowMatch = null; + + for (EntityType type : EntityType.values()) { + if (type.name().equalsIgnoreCase(input.trim())) { + return type; + } + + if (type.name().toLowerCase().startsWith(input.toLowerCase().trim())) { + lowMatch = type; + } + } + + return lowMatch; + } +} diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/EnumFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/EnumFlag.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/protection/flags/EnumFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/EnumFlag.java index 4f7a4dd9..d8c12c2b 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/EnumFlag.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/EnumFlag.java @@ -1,104 +1,104 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.flags; - -import org.bukkit.command.CommandSender; - -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; - -/** - * Stores an enum value. - */ -public class EnumFlag> extends Flag { - - private Class enumClass; - - public EnumFlag(String name, Class enumClass, RegionGroup defaultGroup) { - super(name, defaultGroup); - this.enumClass = enumClass; - } - - public EnumFlag(String name, Class enumClass) { - super(name); - this.enumClass = enumClass; - } - - /** - * Get the enum class. - * - * @return the enum class - */ - public Class getEnumClass() { - return enumClass; - } - - private T findValue(String input) throws IllegalArgumentException { - if (input != null) { - input = input.toUpperCase(); - } - - try { - return Enum.valueOf(enumClass, input); - } catch (IllegalArgumentException e) { - T val = detectValue(input); - - if (val != null) { - return val; - } - - throw e; - } - } - - /** - * Fuzzy detect the value if the value is not found. - * - * @param input string input - * @return value or null - */ - public T detectValue(String input) { - return null; - } - - @Override - public T parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { - try { - return findValue(input); - } catch (IllegalArgumentException e) { - throw new InvalidFlagFormat("Unknown value '" + input + "' in " - + enumClass.getName()); - } - } - - @Override - public T unmarshal(Object o) { - try { - return Enum.valueOf(enumClass, String.valueOf(o)); - } catch (IllegalArgumentException e) { - return null; - } - } - - @Override - public Object marshal(T o) { - return o.name(); - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.flags; + +import org.bukkit.command.CommandSender; + +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + +/** + * Stores an enum value. + */ +public class EnumFlag> extends Flag { + + private Class enumClass; + + public EnumFlag(String name, Class enumClass, RegionGroup defaultGroup) { + super(name, defaultGroup); + this.enumClass = enumClass; + } + + public EnumFlag(String name, Class enumClass) { + super(name); + this.enumClass = enumClass; + } + + /** + * Get the enum class. + * + * @return the enum class + */ + public Class getEnumClass() { + return enumClass; + } + + private T findValue(String input) throws IllegalArgumentException { + if (input != null) { + input = input.toUpperCase(); + } + + try { + return Enum.valueOf(enumClass, input); + } catch (IllegalArgumentException e) { + T val = detectValue(input); + + if (val != null) { + return val; + } + + throw e; + } + } + + /** + * Fuzzy detect the value if the value is not found. + * + * @param input string input + * @return value or null + */ + public T detectValue(String input) { + return null; + } + + @Override + public T parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { + try { + return findValue(input); + } catch (IllegalArgumentException e) { + throw new InvalidFlagFormat("Unknown value '" + input + "' in " + + enumClass.getName()); + } + } + + @Override + public T unmarshal(Object o) { + try { + return Enum.valueOf(enumClass, String.valueOf(o)); + } catch (IllegalArgumentException e) { + return null; + } + } + + @Override + public Object marshal(T o) { + return o.name(); + } + +} diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/Flag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/Flag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/Flag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/Flag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/IntegerFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/IntegerFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/IntegerFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/IntegerFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/InvalidFlagFormat.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/InvalidFlagFormat.java similarity index 97% rename from src/main/java/com/sk89q/worldguard/protection/flags/InvalidFlagFormat.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/InvalidFlagFormat.java index d49778eb..d5d2d46a 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/InvalidFlagFormat.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/InvalidFlagFormat.java @@ -1,29 +1,29 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.flags; - -public class InvalidFlagFormat extends Exception { - - private static final long serialVersionUID = 8101615074524004172L; - - public InvalidFlagFormat(String msg) { - super(msg); - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.flags; + +public class InvalidFlagFormat extends Exception { + + private static final long serialVersionUID = 8101615074524004172L; + + public InvalidFlagFormat(String msg) { + super(msg); + } +} diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/LazyLocation.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LazyLocation.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/LazyLocation.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LazyLocation.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroup.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroup.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/RegionGroup.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroup.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/SetFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/SetFlag.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/protection/flags/SetFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/SetFlag.java index c5b41155..da0957f2 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/SetFlag.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/SetFlag.java @@ -1,102 +1,102 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.flags; - -import com.google.common.collect.Sets; -import com.sk89q.worldguard.bukkit.WorldGuardPlugin; -import org.bukkit.command.CommandSender; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Stores a set of types. - */ -public class SetFlag extends Flag> { - - private Flag subFlag; - - public SetFlag(String name, RegionGroup defaultGroup, Flag subFlag) { - super(name, defaultGroup); - this.subFlag = subFlag; - } - - public SetFlag(String name, Flag subFlag) { - super(name); - this.subFlag = subFlag; - } - - /** - * Get the flag that is stored in this flag. - * - * @return the stored flag type - */ - public Flag getType() { - return subFlag; - } - - @Override - public Set parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { - if (input.isEmpty()) { - return Sets.newHashSet(); - } else { - Set items = Sets.newHashSet(); - - for (String str : input.split(",")) { - items.add(subFlag.parseInput(plugin, sender, str.trim())); - } - - return items; - } - } - - @Override - public Set unmarshal(Object o) { - if (o instanceof Collection) { - Collection collection = (Collection) o; - Set items = new HashSet(); - - for (Object sub : collection) { - T item = subFlag.unmarshal(sub); - if (item != null) { - items.add(item); - } - } - - return items; - } else { - return null; - } - } - - @Override - public Object marshal(Set o) { - List list = new ArrayList(); - for (T item : o) { - list.add(subFlag.marshal(item)); - } - - return list; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.flags; + +import com.google.common.collect.Sets; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; +import org.bukkit.command.CommandSender; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Stores a set of types. + */ +public class SetFlag extends Flag> { + + private Flag subFlag; + + public SetFlag(String name, RegionGroup defaultGroup, Flag subFlag) { + super(name, defaultGroup); + this.subFlag = subFlag; + } + + public SetFlag(String name, Flag subFlag) { + super(name); + this.subFlag = subFlag; + } + + /** + * Get the flag that is stored in this flag. + * + * @return the stored flag type + */ + public Flag getType() { + return subFlag; + } + + @Override + public Set parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { + if (input.isEmpty()) { + return Sets.newHashSet(); + } else { + Set items = Sets.newHashSet(); + + for (String str : input.split(",")) { + items.add(subFlag.parseInput(plugin, sender, str.trim())); + } + + return items; + } + } + + @Override + public Set unmarshal(Object o) { + if (o instanceof Collection) { + Collection collection = (Collection) o; + Set items = new HashSet(); + + for (Object sub : collection) { + T item = subFlag.unmarshal(sub); + if (item != null) { + items.add(item); + } + } + + return items; + } else { + return null; + } + } + + @Override + public Object marshal(Set o) { + List list = new ArrayList(); + for (T item : o) { + list.add(subFlag.marshal(item)); + } + + return list; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/StateFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/StateFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/StateFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/StateFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/StringFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/StringFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/StringFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/StringFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/VectorFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/VectorFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/flags/VectorFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/VectorFlag.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/RegionContainerImpl.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RegionContainerImpl.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/RegionContainerImpl.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RegionContainerImpl.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/RegionDifference.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RegionDifference.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/RegionDifference.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RegionDifference.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/RegionManager.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RegionManager.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/RegionManager.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RegionManager.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/RemovalStrategy.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RemovalStrategy.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/RemovalStrategy.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/RemovalStrategy.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/index/AbstractRegionIndex.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/AbstractRegionIndex.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/index/AbstractRegionIndex.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/AbstractRegionIndex.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/index/ChunkHashTable.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/ChunkHashTable.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/index/ChunkHashTable.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/ChunkHashTable.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/index/ConcurrentRegionIndex.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/ConcurrentRegionIndex.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/index/ConcurrentRegionIndex.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/ConcurrentRegionIndex.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/index/HashMapIndex.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/HashMapIndex.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/index/HashMapIndex.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/HashMapIndex.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/index/PriorityRTreeIndex.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/PriorityRTreeIndex.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/index/PriorityRTreeIndex.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/PriorityRTreeIndex.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/index/RegionIndex.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/RegionIndex.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/index/RegionIndex.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/index/RegionIndex.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/migration/AbstractMigration.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/AbstractMigration.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/migration/AbstractMigration.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/AbstractMigration.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/migration/DriverMigration.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/DriverMigration.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/migration/DriverMigration.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/DriverMigration.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/migration/Migration.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/Migration.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/migration/Migration.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/Migration.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/migration/MigrationException.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/MigrationException.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/migration/MigrationException.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/MigrationException.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/migration/UUIDMigration.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/UUIDMigration.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/migration/UUIDMigration.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/migration/UUIDMigration.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/DifferenceSaveException.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/DifferenceSaveException.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/DifferenceSaveException.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/DifferenceSaveException.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/DriverType.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/DriverType.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/DriverType.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/DriverType.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/MemoryRegionDatabase.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/MemoryRegionDatabase.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/MemoryRegionDatabase.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/MemoryRegionDatabase.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabase.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabase.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabase.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabase.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabaseUtils.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabaseUtils.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabaseUtils.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDatabaseUtils.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDriver.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDriver.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDriver.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/RegionDriver.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/StorageException.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/StorageException.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/StorageException.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/StorageException.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/DirectoryYamlDriver.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/DirectoryYamlDriver.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/file/DirectoryYamlDriver.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/DirectoryYamlDriver.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataLoader.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataLoader.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataLoader.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataLoader.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataUpdater.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataUpdater.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataUpdater.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataUpdater.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DomainTableCache.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DomainTableCache.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DomainTableCache.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DomainTableCache.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionInserter.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionInserter.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionInserter.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionInserter.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionRemover.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionRemover.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionRemover.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionRemover.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionUpdater.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionUpdater.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionUpdater.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionUpdater.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLDriver.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLDriver.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLDriver.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLDriver.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLRegionDatabase.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLRegionDatabase.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLRegionDatabase.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/SQLRegionDatabase.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/StatementBatch.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/StatementBatch.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/StatementBatch.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/StatementBatch.java diff --git a/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/TableCache.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/TableCache.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/TableCache.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/TableCache.java diff --git a/src/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java similarity index 96% rename from src/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java index 06b10546..033bfc5a 100644 --- a/src/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java @@ -1,92 +1,92 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection.regions; - -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; - -import java.awt.geom.Area; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * A special region that is not quite "anywhere" (its volume is 0, it - * contains no positions, and it does not intersect with any other region). - * - *

Global regions, however, are used to specify a region with flags that - * are applied with the lowest priority.

- */ -public class GlobalProtectedRegion extends ProtectedRegion { - - /** - * Create a new instance. - * - * @param id the ID - */ - public GlobalProtectedRegion(String id) { - super(id); - min = new BlockVector(0, 0, 0); - max = new BlockVector(0, 0, 0); - } - - @Override - public boolean isPhysicalArea() { - return false; - } - - @Override - public List getPoints() { - // This doesn't make sense - List pts = new ArrayList(); - pts.add(new BlockVector2D(min.getBlockX(), min.getBlockZ())); - return pts; - } - - @Override - public int volume() { - return 0; - } - - @Override - public boolean contains(Vector pt) { - // Global regions are handled separately so it must not contain any positions - return false; - } - - @Override - public RegionType getType() { - return RegionType.GLOBAL; - } - - @Override - public List getIntersectingRegions(Collection regions) { - // Global regions are handled separately so it must not contain any positions - return Collections.emptyList(); - } - - @Override - Area toArea() { - return null; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection.regions; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; +import com.sk89q.worldedit.Vector; + +import java.awt.geom.Area; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + * A special region that is not quite "anywhere" (its volume is 0, it + * contains no positions, and it does not intersect with any other region). + * + *

Global regions, however, are used to specify a region with flags that + * are applied with the lowest priority.

+ */ +public class GlobalProtectedRegion extends ProtectedRegion { + + /** + * Create a new instance. + * + * @param id the ID + */ + public GlobalProtectedRegion(String id) { + super(id); + min = new BlockVector(0, 0, 0); + max = new BlockVector(0, 0, 0); + } + + @Override + public boolean isPhysicalArea() { + return false; + } + + @Override + public List getPoints() { + // This doesn't make sense + List pts = new ArrayList(); + pts.add(new BlockVector2D(min.getBlockX(), min.getBlockZ())); + return pts; + } + + @Override + public int volume() { + return 0; + } + + @Override + public boolean contains(Vector pt) { + // Global regions are handled separately so it must not contain any positions + return false; + } + + @Override + public RegionType getType() { + return RegionType.GLOBAL; + } + + @Override + public List getIntersectingRegions(Collection regions) { + // Global regions are handled separately so it must not contain any positions + return Collections.emptyList(); + } + + @Override + Area toArea() { + return null; + } + +} diff --git a/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedCuboidRegion.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedCuboidRegion.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/regions/ProtectedCuboidRegion.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedCuboidRegion.java diff --git a/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedPolygonalRegion.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedPolygonalRegion.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/regions/ProtectedPolygonalRegion.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedPolygonalRegion.java diff --git a/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java diff --git a/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegionMBRConverter.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegionMBRConverter.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegionMBRConverter.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegionMBRConverter.java diff --git a/src/main/java/com/sk89q/worldguard/protection/regions/RegionType.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/RegionType.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/regions/RegionType.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/regions/RegionType.java diff --git a/src/main/java/com/sk89q/worldguard/protection/util/DomainInputResolver.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/DomainInputResolver.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/util/DomainInputResolver.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/DomainInputResolver.java diff --git a/src/main/java/com/sk89q/worldguard/protection/util/NormativeOrders.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/NormativeOrders.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/util/NormativeOrders.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/NormativeOrders.java diff --git a/src/main/java/com/sk89q/worldguard/protection/util/RegionCollectionConsumer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/RegionCollectionConsumer.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/util/RegionCollectionConsumer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/RegionCollectionConsumer.java diff --git a/src/main/java/com/sk89q/worldguard/protection/util/UnresolvedNamesException.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/UnresolvedNamesException.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/protection/util/UnresolvedNamesException.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/util/UnresolvedNamesException.java diff --git a/src/main/java/com/sk89q/worldguard/session/MoveType.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/MoveType.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/MoveType.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/MoveType.java diff --git a/src/main/java/com/sk89q/worldguard/session/Session.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/Session.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/Session.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/Session.java diff --git a/src/main/java/com/sk89q/worldguard/session/SessionManager.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/SessionManager.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/SessionManager.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/SessionManager.java diff --git a/src/main/java/com/sk89q/worldguard/session/WorldPlayerTuple.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/WorldPlayerTuple.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/WorldPlayerTuple.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/WorldPlayerTuple.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/EntryFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/EntryFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/EntryFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/EntryFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/ExitFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/ExitFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/ExitFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/ExitFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/FarewellFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/FarewellFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/FarewellFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/FarewellFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/FeedFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/FeedFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/FeedFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/FeedFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/GameModeFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/GameModeFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/GameModeFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/GameModeFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/GodMode.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/GodMode.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/GodMode.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/GodMode.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/GreetingFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/GreetingFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/GreetingFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/GreetingFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/Handler.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/Handler.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/Handler.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/Handler.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/HealFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/HealFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/HealFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/HealFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/InvincibilityFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/InvincibilityFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/InvincibilityFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/InvincibilityFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/NotifyEntryFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/NotifyEntryFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/NotifyEntryFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/NotifyEntryFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/NotifyExitFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/NotifyExitFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/NotifyExitFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/NotifyExitFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/TimeLockFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/TimeLockFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/TimeLockFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/TimeLockFlag.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/WaterBreathing.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/WaterBreathing.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/WaterBreathing.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/WaterBreathing.java diff --git a/src/main/java/com/sk89q/worldguard/session/handler/WeatherLockFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/WeatherLockFlag.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/session/handler/WeatherLockFlag.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/session/handler/WeatherLockFlag.java diff --git a/src/main/java/com/sk89q/worldguard/util/ChangeTracked.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/ChangeTracked.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/ChangeTracked.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/ChangeTracked.java diff --git a/src/main/java/com/sk89q/worldguard/util/Enums.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/Enums.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/Enums.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/Enums.java diff --git a/src/main/java/com/sk89q/worldguard/util/MathUtils.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/MathUtils.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/MathUtils.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/MathUtils.java diff --git a/src/main/java/com/sk89q/worldguard/util/Normal.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/Normal.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/Normal.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/Normal.java diff --git a/src/main/java/com/sk89q/worldguard/util/collect/EntryBase.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/EntryBase.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/collect/EntryBase.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/EntryBase.java diff --git a/src/main/java/com/sk89q/worldguard/util/collect/LongBaseHashTable.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongBaseHashTable.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/collect/LongBaseHashTable.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongBaseHashTable.java diff --git a/src/main/java/com/sk89q/worldguard/util/collect/LongHash.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongHash.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/collect/LongHash.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongHash.java diff --git a/src/main/java/com/sk89q/worldguard/util/collect/LongHashSet.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongHashSet.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/collect/LongHashSet.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongHashSet.java diff --git a/src/main/java/com/sk89q/worldguard/util/collect/LongHashTable.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongHashTable.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/collect/LongHashTable.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/collect/LongHashTable.java diff --git a/src/main/java/com/sk89q/worldguard/util/command/CommandFilter.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/command/CommandFilter.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/command/CommandFilter.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/command/CommandFilter.java diff --git a/src/main/java/com/sk89q/worldguard/util/concurrent/EvenMoreExecutors.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/concurrent/EvenMoreExecutors.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/concurrent/EvenMoreExecutors.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/concurrent/EvenMoreExecutors.java diff --git a/src/main/java/com/sk89q/worldguard/util/io/Closer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/io/Closer.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/io/Closer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/io/Closer.java diff --git a/src/main/java/com/sk89q/worldguard/util/logging/ClassSourceValidator.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/logging/ClassSourceValidator.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/logging/ClassSourceValidator.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/logging/ClassSourceValidator.java diff --git a/src/main/java/com/sk89q/worldguard/util/logging/RecordMessagePrefixer.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/logging/RecordMessagePrefixer.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/logging/RecordMessagePrefixer.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/logging/RecordMessagePrefixer.java diff --git a/src/main/java/com/sk89q/worldguard/util/net/HttpRequest.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/net/HttpRequest.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/net/HttpRequest.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/net/HttpRequest.java diff --git a/src/main/java/com/sk89q/worldguard/util/paste/EngineHubPaste.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/EngineHubPaste.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/paste/EngineHubPaste.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/EngineHubPaste.java diff --git a/src/main/java/com/sk89q/worldguard/util/paste/Pastebin.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/Pastebin.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/paste/Pastebin.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/Pastebin.java diff --git a/src/main/java/com/sk89q/worldguard/util/paste/Paster.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/Paster.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/paste/Paster.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/Paster.java diff --git a/src/main/java/com/sk89q/worldguard/util/paste/Pasters.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/Pasters.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/paste/Pasters.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/paste/Pasters.java diff --git a/src/main/java/com/sk89q/worldguard/util/profiler/SamplerBuilder.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/SamplerBuilder.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/profiler/SamplerBuilder.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/SamplerBuilder.java diff --git a/src/main/java/com/sk89q/worldguard/util/profiler/StackNode.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/StackNode.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/profiler/StackNode.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/StackNode.java diff --git a/src/main/java/com/sk89q/worldguard/util/profiler/StackTraceNode.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/StackTraceNode.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/profiler/StackTraceNode.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/StackTraceNode.java diff --git a/src/main/java/com/sk89q/worldguard/util/profiler/ThreadIdFilter.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/ThreadIdFilter.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/profiler/ThreadIdFilter.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/ThreadIdFilter.java diff --git a/src/main/java/com/sk89q/worldguard/util/profiler/ThreadNameFilter.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/ThreadNameFilter.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/profiler/ThreadNameFilter.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/profiler/ThreadNameFilter.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/CancelReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/CancelReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/CancelReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/CancelReport.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/DataReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/DataReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/DataReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/DataReport.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/RegionReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/RegionReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/RegionReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/RegionReport.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/Report.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/Report.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/Report.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/Report.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/ReportList.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/ReportList.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/ReportList.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/ReportList.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/ShallowObjectReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/ShallowObjectReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/ShallowObjectReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/ShallowObjectReport.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/StackTraceReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/StackTraceReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/StackTraceReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/StackTraceReport.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/SystemInfoReport.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/SystemInfoReport.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/SystemInfoReport.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/SystemInfoReport.java diff --git a/src/main/java/com/sk89q/worldguard/util/report/Unreported.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/Unreported.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/report/Unreported.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/report/Unreported.java diff --git a/src/main/java/com/sk89q/worldguard/util/sql/DataSourceConfig.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/sql/DataSourceConfig.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/sql/DataSourceConfig.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/sql/DataSourceConfig.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/AbstractTask.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/AbstractTask.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/AbstractTask.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/AbstractTask.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/FutureForwardingTask.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/FutureForwardingTask.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/FutureForwardingTask.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/FutureForwardingTask.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/SimpleSupervisor.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/SimpleSupervisor.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/SimpleSupervisor.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/SimpleSupervisor.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/Supervisor.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/Supervisor.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/Supervisor.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/Supervisor.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/Task.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/Task.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/Task.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/Task.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/TaskStateComparator.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/TaskStateComparator.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/TaskStateComparator.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/TaskStateComparator.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/progress/Progress.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/progress/Progress.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/progress/Progress.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/progress/Progress.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/progress/ProgressIterator.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/progress/ProgressIterator.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/progress/ProgressIterator.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/progress/ProgressIterator.java diff --git a/src/main/java/com/sk89q/worldguard/util/task/progress/ProgressObservable.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/progress/ProgressObservable.java similarity index 100% rename from src/main/java/com/sk89q/worldguard/util/task/progress/ProgressObservable.java rename to worldguard-legacy/src/main/java/com/sk89q/worldguard/util/task/progress/ProgressObservable.java diff --git a/worldguard-legacy/src/main/resources/defaults/blacklist.txt b/worldguard-legacy/src/main/resources/defaults/blacklist.txt new file mode 100644 index 00000000..8ed6e0de --- /dev/null +++ b/worldguard-legacy/src/main/resources/defaults/blacklist.txt @@ -0,0 +1,65 @@ +# +# WorldGuard blacklist +# +# The blacklist lets you block actions, blocks, and items from being used. +# You choose a set of "items to affect" and a list of "actions to perform." +# +############################################################################### +# +# Example to block some ore mining and placement: +# [coalore,goldore,ironore] +# on-break=deny,log,kick +# on-place=deny,tell +# +# Events that you can detect: +# - on-break (when a block of this type is about to be broken) +# - on-destroy-with (the item/block held by the user while destroying) +# - on-place (a block is being placed) +# - on-use (an item like flint and steel or a bucket is being used) +# - on-interact (when a block in used (doors, chests, etc.)) +# - on-drop (an item is being dropped from the player's inventory) +# - on-acquire (an item enters a player's inventory via some method) +# - on-dispense (a dispenser is about to dispense an item) +# +# Actions (for events): +# - deny (deny completely, used blacklist mode) +# - allow (used in whitelist mode) +# - notify (notify admins with the 'worldguard.notify' permission) +# - log (log to console/file/database) +# - tell (tell a player that that's not allowed) +# - kick (kick player) +# - ban (ban player) +# +# Options: +# - ignore-groups (comma-separated list of groups to not affect) +# - ignore-perms (comma-separated list of permissions to not affect - make up +# your very own permissions!) +# - comment (message for yourself that is printed with 'log' and 'notify') +# - message (optional message to show the user instead; %s is the item name) +# +############################################################################### +# +# For more information, see: +# http://wiki.sk89q.com/wiki/WorldGuard/Blacklist +# +############################################################################### +# +# Some examples follow. +# REMEMBER: If a line has # in front, it will be ignored. +# + +# Deny lava buckets +#[lavabucket] +#ignore-perms=my.own.madeup.permission +#ignore-groups=admins,mods +#on-use=deny,tell + +# Deny some ore +#[coalore,goldore,ironore] +#ignore-groups=admins,mods +#on-break=notify,deny,log + +# Some funky data value tests +#[wood:0;>=2] +#ignore-groups=admins,mods +#on-break=notify,deny,log \ No newline at end of file diff --git a/worldguard-legacy/src/main/resources/defaults/config.yml b/worldguard-legacy/src/main/resources/defaults/config.yml new file mode 100644 index 00000000..4501e6fb --- /dev/null +++ b/worldguard-legacy/src/main/resources/defaults/config.yml @@ -0,0 +1,22 @@ +# +# WorldGuard's configuration file +# +# About editing this file: +# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If +# you use an editor like Notepad++ (recommended for Windows users), you +# must configure it to "replace tabs with spaces." In Notepad++, this can +# be changed in Settings > Preferences > Language Menu. +# - Don't get rid of the indents. They are indented so some entries are +# in categories (like "enforce-single-session" is in the "protection" +# category. +# - If you want to check the format of this file before putting it +# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/ +# and see if it gives "ERROR:". +# - Lines starting with # are commentsand so they are ignored. +# +# WARNING: +# Remember to check the compatibility spreadsheet for WorldGuard to see +# if any features are currently broken in your version of Bukkit. +# + +# -- This should be automatically replaced by the plugin in-game -- \ No newline at end of file diff --git a/worldguard-legacy/src/main/resources/defaults/config_world.yml b/worldguard-legacy/src/main/resources/defaults/config_world.yml new file mode 100644 index 00000000..db29fa3a --- /dev/null +++ b/worldguard-legacy/src/main/resources/defaults/config_world.yml @@ -0,0 +1,21 @@ +# +# WorldGuard's configuration file. +# +# This is the a per-world configuration file. It only affects one +# corresponding world. +# +# About editing this file: +# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If +# you use an editor like Notepad++ (recommended for Windows users), you +# must configure it to "replace tabs with spaces." In Notepad++, this can +# be changed in Settings > Preferences > Language Menu. +# - Don't get rid of the indents. They are indented so some entries are +# in categories (like "enforce-single-session" is in the "protection" +# category. +# - If you want to check the format of this file before putting it +# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/ +# and see if it gives "ERROR:". +# - Lines starting with # are comments and so they are ignored. +# + +# -- This should be automatically replaced by the plugin in-game -- \ No newline at end of file diff --git a/worldguard-legacy/src/main/resources/migrations/region/mysql/V1__Initial.sql b/worldguard-legacy/src/main/resources/migrations/region/mysql/V1__Initial.sql new file mode 100644 index 00000000..985b173f --- /dev/null +++ b/worldguard-legacy/src/main/resources/migrations/region/mysql/V1__Initial.sql @@ -0,0 +1,212 @@ +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; + +-- ----------------------------------------------------- +-- Table `group` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}group` ( + `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT , + `name` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + PRIMARY KEY (`id`) , + UNIQUE INDEX `name` (`name` ASC) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `world` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}world` ( + `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT , + `name` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + PRIMARY KEY (`id`) , + UNIQUE INDEX `name` (`name` ASC) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `region` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}region` ( + `id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `world_id` INT(10) UNSIGNED NOT NULL , + `type` ENUM('cuboid','poly2d','global') CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `priority` SMALLINT(6) NOT NULL DEFAULT '0' , + `parent` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL , + PRIMARY KEY (`id`, `world_id`) , + INDEX `fk_region_world` (`world_id` ASC) , + INDEX `parent` (`parent` ASC) , + CONSTRAINT `fk_${tablePrefix}region_world1` + FOREIGN KEY (`world_id` ) + REFERENCES `${tablePrefix}world` (`id` ) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `${tablePrefix}parent` + FOREIGN KEY (`parent` ) + REFERENCES `${tablePrefix}region` (`id` ) + ON DELETE SET NULL + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `region_cuboid` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}region_cuboid` ( + `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `world_id` INT(10) UNSIGNED NOT NULL , + `min_x` BIGINT(20) NOT NULL , + `min_y` BIGINT(20) NOT NULL , + `min_z` BIGINT(20) NOT NULL , + `max_x` BIGINT(20) NOT NULL , + `max_y` BIGINT(20) NOT NULL , + `max_z` BIGINT(20) NOT NULL , + PRIMARY KEY (`region_id`, `world_id`) , + INDEX `fk_region_cuboid_region` (`region_id` ASC) , + CONSTRAINT `fk_${tablePrefix}region_cuboid_region` + FOREIGN KEY (`region_id` , `world_id` ) + REFERENCES `${tablePrefix}region` (`id` , `world_id` ) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `region_flag` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}region_flag` ( + `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT , + `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `world_id` INT(10) UNSIGNED NOT NULL , + `flag` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `value` VARCHAR(256) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + PRIMARY KEY (`id`) , + INDEX `fk_flags_region` (`region_id` ASC, `world_id` ASC) , + CONSTRAINT `fk_${tablePrefix}flags_region` + FOREIGN KEY (`region_id` , `world_id` ) + REFERENCES `${tablePrefix}region` (`id` , `world_id` ) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `region_groups` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}region_groups` ( + `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `world_id` INT(10) UNSIGNED NOT NULL , + `group_id` INT(10) UNSIGNED NOT NULL , + `owner` TINYINT(1) NOT NULL , + PRIMARY KEY (`region_id`, `world_id`, `group_id`) , + INDEX `fk_region_groups_region` (`region_id` ASC) , + INDEX `fk_region_groups_group` (`group_id` ASC) , + CONSTRAINT `fk_${tablePrefix}region_groups_group` + FOREIGN KEY (`group_id` ) + REFERENCES `${tablePrefix}group` (`id` ) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_${tablePrefix}region_groups_region` + FOREIGN KEY (`region_id` , `world_id` ) + REFERENCES `${tablePrefix}region` (`id` , `world_id` ) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `user` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}user` ( + `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT , + `name` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + PRIMARY KEY (`id`) , + UNIQUE INDEX `name` (`name` ASC) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `region_players` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}region_players` ( + `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `world_id` INT(10) UNSIGNED NOT NULL , + `user_id` INT(10) UNSIGNED NOT NULL , + `owner` TINYINT(1) NOT NULL , + PRIMARY KEY (`region_id`, `world_id`, `user_id`) , + INDEX `fk_region_players_region` (`region_id` ASC) , + INDEX `fk_region_users_user` (`user_id` ASC) , + CONSTRAINT `fk_${tablePrefix}region_users_region` + FOREIGN KEY (`region_id` , `world_id` ) + REFERENCES `${tablePrefix}region` (`id` , `world_id` ) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_${tablePrefix}region_users_user` + FOREIGN KEY (`user_id` ) + REFERENCES `${tablePrefix}user` (`id` ) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `region_poly2d` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}region_poly2d` ( + `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `world_id` INT(10) UNSIGNED NOT NULL , + `min_y` INT(11) NOT NULL , + `max_y` INT(11) NOT NULL , + PRIMARY KEY (`region_id`, `world_id`) , + INDEX `fk_region_poly2d_region` (`region_id` ASC) , + CONSTRAINT `fk_${tablePrefix}region_poly2d_region` + FOREIGN KEY (`region_id` , `world_id` ) + REFERENCES `${tablePrefix}region` (`id` , `world_id` ) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + +-- ----------------------------------------------------- +-- Table `region_poly2d_point` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `${tablePrefix}region_poly2d_point` ( + `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT , + `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL , + `world_id` INT(10) UNSIGNED NOT NULL , + `x` BIGINT(20) NOT NULL , + `z` BIGINT(20) NOT NULL , + PRIMARY KEY (`id`) , + INDEX `fk_region_poly2d_point_region_poly2d` (`region_id` ASC, `world_id` ASC) , + CONSTRAINT `fk_${tablePrefix}region_poly2d_point_region_poly2d` + FOREIGN KEY (`region_id` , `world_id` ) + REFERENCES `${tablePrefix}region_poly2d` (`region_id` , `world_id` ) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8 +COLLATE = utf8_bin; + + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/worldguard-legacy/src/main/resources/migrations/region/mysql/V2__Bug_fix_and_UUID.sql b/worldguard-legacy/src/main/resources/migrations/region/mysql/V2__Bug_fix_and_UUID.sql new file mode 100644 index 00000000..b1df899f --- /dev/null +++ b/worldguard-legacy/src/main/resources/migrations/region/mysql/V2__Bug_fix_and_UUID.sql @@ -0,0 +1,27 @@ +-- Fix WORLDGUARD-3117 +-- Otherwise, you can't be both an owner and a member of a region + +ALTER TABLE `${tablePrefix}region_players` + DROP PRIMARY KEY, + ADD PRIMARY KEY (`region_id`, `world_id`, `user_id`, `owner`); + +ALTER TABLE `${tablePrefix}region_groups` + DROP PRIMARY KEY, + ADD PRIMARY KEY (`region_id`, `world_id`, `group_id`, `owner`); + +-- Fix WORLDGUARD-3030 +-- Adds UUID support + +ALTER TABLE `${tablePrefix}user` + ALTER `name` DROP DEFAULT; + +ALTER TABLE `${tablePrefix}user` + CHANGE COLUMN `name` `name` VARCHAR(64) NULL COLLATE 'utf8_bin' AFTER `id`, + ADD COLUMN `uuid` CHAR(36) NULL AFTER `name`, + ADD UNIQUE INDEX `uuid` (`uuid`); + +-- Strings with differing numbers of trailing spaces are equal in MySQL +-- The domains have been updated to trim strings + +UPDATE `${tablePrefix}user` SET `name` = TRIM(`name`); +UPDATE `${tablePrefix}group` SET `name` = TRIM(`name`); \ No newline at end of file diff --git a/worldguard-legacy/src/main/resources/migrations/region/sqlite/V1__Initial.sql b/worldguard-legacy/src/main/resources/migrations/region/sqlite/V1__Initial.sql new file mode 100644 index 00000000..2b5b99e3 --- /dev/null +++ b/worldguard-legacy/src/main/resources/migrations/region/sqlite/V1__Initial.sql @@ -0,0 +1,160 @@ + +CREATE TABLE "${tablePrefix}world" ( + id INTEGER PRIMARY KEY AUTOINCREMENT + NOT NULL, + name TEXT NOT NULL + UNIQUE +); + + +CREATE TABLE "${tablePrefix}region" ( + id TEXT NOT NULL, + world_id INTEGER NOT NULL + REFERENCES "${tablePrefix}world" ( id ) ON DELETE CASCADE + ON UPDATE CASCADE, + type TEXT NOT NULL, + priority INTEGER NOT NULL, + parent TEXT DEFAULT ( NULL ) + --REFERENCES "${tablePrefix}region" ( id ) ON DELETE SET NULL + -- ON UPDATE CASCADE -- Not supported + , + PRIMARY KEY ( id, world_id ) +); + + +CREATE TABLE "${tablePrefix}user" ( + id INTEGER PRIMARY KEY AUTOINCREMENT + NOT NULL, + name TEXT UNIQUE + DEFAULT ( NULL ), + uuid TEXT UNIQUE + DEFAULT ( NULL ) +); + + +CREATE TABLE "${tablePrefix}group" ( + id INTEGER PRIMARY KEY AUTOINCREMENT + NOT NULL, + name TEXT NOT NULL + UNIQUE +); + + +CREATE TABLE "${tablePrefix}region_cuboid" ( + region_id TEXT NOT NULL, + world_id INTEGER NOT NULL, + min_x INTEGER NOT NULL, + min_y INTEGER NOT NULL, + min_z INTEGER NOT NULL, + max_x INTEGER NOT NULL, + max_y INTEGER NOT NULL, + max_z INTEGER NOT NULL, + PRIMARY KEY ( region_id, world_id ), + FOREIGN KEY ( region_id, world_id ) REFERENCES "${tablePrefix}region" ( id, world_id ) ON DELETE CASCADE + ON UPDATE CASCADE +); + + +CREATE TABLE "${tablePrefix}region_poly2d" ( + region_id TEXT NOT NULL, + world_id INTEGER NOT NULL, + min_y INTEGER NOT NULL, + max_y INTEGER NOT NULL, + PRIMARY KEY ( region_id, world_id ), + FOREIGN KEY ( region_id, world_id ) REFERENCES "${tablePrefix}region" ( id, world_id ) ON DELETE CASCADE + ON UPDATE CASCADE +); + + +CREATE TABLE "${tablePrefix}region_poly2d_point" ( + id INTEGER PRIMARY KEY AUTOINCREMENT + NOT NULL, + region_id TEXT NOT NULL, + world_id INTEGER NOT NULL, + x INTEGER NOT NULL, + z INTEGER NOT NULL, + FOREIGN KEY ( region_id, world_id ) REFERENCES "${tablePrefix}region_poly2d" ( region_id, world_id ) ON DELETE CASCADE + ON UPDATE CASCADE +); + + +CREATE TABLE "${tablePrefix}region_groups" ( + region_id TEXT NOT NULL, + world_id INTEGER NOT NULL, + group_id INTEGER NOT NULL + REFERENCES "${tablePrefix}group" ( id ) ON DELETE CASCADE + ON UPDATE CASCADE, + owner BOOLEAN NOT NULL, + PRIMARY KEY ( region_id, world_id, group_id ), + FOREIGN KEY ( region_id, world_id ) REFERENCES "${tablePrefix}region" ( id, world_id ) ON DELETE CASCADE + ON UPDATE CASCADE +); + + +CREATE TABLE "${tablePrefix}region_flag" ( + id INTEGER PRIMARY KEY AUTOINCREMENT + NOT NULL, + region_id TEXT NOT NULL, + world_id INTEGER NOT NULL, + flag TEXT NOT NULL, + value TEXT NOT NULL, + FOREIGN KEY ( region_id, world_id ) REFERENCES "${tablePrefix}region" ( id, world_id ) ON DELETE CASCADE + ON UPDATE CASCADE +); + + +CREATE TABLE "${tablePrefix}region_players" ( + region_id TEXT NOT NULL, + world_id INTEGER NOT NULL, + user_id INTEGER NOT NULL + REFERENCES "${tablePrefix}user" ( id ) ON DELETE CASCADE + ON UPDATE CASCADE, + owner BOOLEAN NOT NULL, + PRIMARY KEY ( region_id, world_id, user_id, owner ), + FOREIGN KEY ( region_id, world_id ) REFERENCES "${tablePrefix}region" ( id, world_id ) ON DELETE CASCADE + ON UPDATE CASCADE +); + + +CREATE INDEX "idx_${tablePrefix}region_cuboid_region_id" ON "${tablePrefix}region_cuboid" ( + region_id +); + + +CREATE INDEX "idx_${tablePrefix}region_world_id" ON "${tablePrefix}region" ( + world_id +); + + +CREATE INDEX "idx_${tablePrefix}region_parent" ON "${tablePrefix}region" ( + parent +); + + +CREATE INDEX "idx_${tablePrefix}region_poly2d_region_id" ON "${tablePrefix}region_poly2d" ( + region_id +); + + +CREATE INDEX "idx_${tablePrefix}region_poly2d_point_region_world_id" ON "${tablePrefix}region_poly2d_point" ( + region_id, + world_id +); + + +CREATE INDEX "idx_${tablePrefix}region_groups_region_id" ON "${tablePrefix}region_groups" ( + region_id +); + + +CREATE INDEX "idx_${tablePrefix}region_groups_group_id" ON "${tablePrefix}region_groups" ( + group_id +); + + +CREATE INDEX "idx_${tablePrefix}region_flag_region_world_id" ON "${tablePrefix}region_flag" ( + region_id, + world_id, + flag +); + diff --git a/worldguard-legacy/src/main/resources/plugin.yml b/worldguard-legacy/src/main/resources/plugin.yml new file mode 100644 index 00000000..b0aacf55 --- /dev/null +++ b/worldguard-legacy/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: WorldGuard +main: com.sk89q.worldguard.bukkit.WorldGuardPlugin +version: "${project.version}" +softdepend: [WorldEdit, CommandBook] diff --git a/src/test/java/com/sk89q/worldguard/TestPlayer.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/TestPlayer.java similarity index 96% rename from src/test/java/com/sk89q/worldguard/TestPlayer.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/TestPlayer.java index 21ac0f6a..ff7d406e 100644 --- a/src/test/java/com/sk89q/worldguard/TestPlayer.java +++ b/worldguard-legacy/src/test/java/com/sk89q/worldguard/TestPlayer.java @@ -1,87 +1,87 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard; - -import com.sk89q.worldedit.Vector; - -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; - -@org.junit.Ignore -public class TestPlayer extends LocalPlayer { - - private final UUID uuid = UUID.randomUUID(); - private final String name; - private final Set groups = new HashSet(); - - public TestPlayer(String name) { - this.name = name; - } - - public void addGroup(String group) { - groups.add(group.toLowerCase()); - } - - @Override - public String getName() { - return name; - } - - @Override - public UUID getUniqueId() { - return uuid; - } - - @Override - public boolean hasGroup(String group) { - return groups.contains(group.toLowerCase()); - } - - @Override - public Vector getPosition() { - return new Vector(0, 0, 0); - } - - @Override - public void kick(String msg) { - System.out.println("TestPlayer{" + this.name + "} kicked!"); - } - - @Override - public void ban(String msg) { - System.out.println("TestPlayer{" + this.name + "} banned!"); - } - - @Override - public void printRaw(String msg) { - System.out.println("-> TestPlayer{" + this.name + "}: " + msg); - } - - @Override - public String[] getGroups() { - return groups.toArray(new String[groups.size()]); - } - - @Override - public boolean hasPermission(String perm) { - return true; - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard; + +import com.sk89q.worldedit.Vector; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +@org.junit.Ignore +public class TestPlayer extends LocalPlayer { + + private final UUID uuid = UUID.randomUUID(); + private final String name; + private final Set groups = new HashSet(); + + public TestPlayer(String name) { + this.name = name; + } + + public void addGroup(String group) { + groups.add(group.toLowerCase()); + } + + @Override + public String getName() { + return name; + } + + @Override + public UUID getUniqueId() { + return uuid; + } + + @Override + public boolean hasGroup(String group) { + return groups.contains(group.toLowerCase()); + } + + @Override + public Vector getPosition() { + return new Vector(0, 0, 0); + } + + @Override + public void kick(String msg) { + System.out.println("TestPlayer{" + this.name + "} kicked!"); + } + + @Override + public void ban(String msg) { + System.out.println("TestPlayer{" + this.name + "} banned!"); + } + + @Override + public void printRaw(String msg) { + System.out.println("-> TestPlayer{" + this.name + "}: " + msg); + } + + @Override + public String[] getGroups() { + return groups.toArray(new String[groups.size()]); + } + + @Override + public boolean hasPermission(String perm) { + return true; + } +} diff --git a/src/test/java/com/sk89q/worldguard/domains/DefaultDomainTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/domains/DefaultDomainTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/domains/DefaultDomainTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/domains/DefaultDomainTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/ApplicableRegionSetTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/ApplicableRegionSetTest.java similarity index 97% rename from src/test/java/com/sk89q/worldguard/protection/ApplicableRegionSetTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/ApplicableRegionSetTest.java index 43c144a6..0bd313a6 100644 --- a/src/test/java/com/sk89q/worldguard/protection/ApplicableRegionSetTest.java +++ b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/ApplicableRegionSetTest.java @@ -1,641 +1,641 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection; - -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.protection.flags.DefaultFlag; -import com.sk89q.worldguard.protection.flags.StateFlag; -import com.sk89q.worldguard.protection.flags.StringFlag; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.util.command.CommandFilter; -import org.junit.Test; - -import java.util.HashSet; -import java.util.Set; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.*; - -public class ApplicableRegionSetTest { - - @Test - public void testWildernessBuild() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - - LocalPlayer player = mock.createPlayer(); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); - } - - @Test - public void testWildernessBuildWithGlobalRegion() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - - LocalPlayer player = mock.createPlayer(); - - ProtectedRegion global = mock.global(); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); - } - - @Test - public void testWildernessBuildWithRegion() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - ProtectedRegion region = mock.add(0); - region.getMembers().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertThat(set.testState(member, DefaultFlag.BUILD), is(true)); - assertThat(set.testState(nonMember, DefaultFlag.BUILD), is(false)); - } - - @Test - public void testWildernessFlags() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - - LocalPlayer player = mock.createPlayer(); - - ApplicableRegionSet set = mock.getApplicableSet(); - - assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true)); - assertThat(set.testState(player, DefaultFlag.ENTRY), is(true)); - assertThat(set.testState(player, DefaultFlag.EXIT), is(true)); - assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true)); - assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true)); - assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true)); - assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false)); - - assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); - } - - @Test - public void testWildernessFlagsWithGlobalRegion() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - - LocalPlayer player = mock.createPlayer(); - - ProtectedRegion global = mock.global(); - - ApplicableRegionSet set = mock.getApplicableSet(); - - assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true)); - assertThat(set.testState(player, DefaultFlag.ENTRY), is(true)); - assertThat(set.testState(player, DefaultFlag.EXIT), is(true)); - assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true)); - assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true)); - assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true)); - assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false)); - - assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); - } - - @Test - public void testFlagsWithRegion() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - ProtectedRegion region = mock.add(0); - region.getMembers().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - - assertThat(set.testState(member, DefaultFlag.MOB_DAMAGE), is(true)); - assertThat(set.testState(member, DefaultFlag.ENTRY), is(true)); - assertThat(set.testState(member, DefaultFlag.EXIT), is(true)); - assertThat(set.testState(member, DefaultFlag.LEAF_DECAY), is(true)); - assertThat(set.testState(member, DefaultFlag.RECEIVE_CHAT), is(true)); - assertThat(set.testState(member, DefaultFlag.SEND_CHAT), is(true)); - assertThat(set.testState(member, DefaultFlag.INVINCIBILITY), is(false)); - - assertThat(set.testState(member, DefaultFlag.BUILD), is(true)); - - assertThat(set.testState(nonMember, DefaultFlag.MOB_DAMAGE), is(true)); - assertThat(set.testState(nonMember, DefaultFlag.ENTRY), is(true)); - assertThat(set.testState(nonMember, DefaultFlag.EXIT), is(true)); - assertThat(set.testState(nonMember, DefaultFlag.LEAF_DECAY), is(true)); - assertThat(set.testState(nonMember, DefaultFlag.RECEIVE_CHAT), is(true)); - assertThat(set.testState(nonMember, DefaultFlag.SEND_CHAT), is(true)); - assertThat(set.testState(nonMember, DefaultFlag.INVINCIBILITY), is(false)); - - assertThat(set.testState(nonMember, DefaultFlag.BUILD), is(false)); - } - - @Test - public void testStateFlagPriorityFallThrough() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - StateFlag state1 = new StateFlag(null, false); - StateFlag state2 = new StateFlag(null, false); - StateFlag state3 = new StateFlag(null, false); - - region = mock.add(0); - region.setFlag(state1, StateFlag.State.ALLOW); - region.setFlag(state2, StateFlag.State.DENY); - - region = mock.add(1); - region.setFlag(state1, StateFlag.State.DENY); - region.setFlag(state3, StateFlag.State.ALLOW); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.allows(state1)); - assertFalse(set.allows(state2)); - assertTrue(set.allows(state3)); - } - - @Test - public void testNonStateFlagPriorityFallThrough() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - StringFlag string1 = new StringFlag(null); - StringFlag string2 = new StringFlag(null); - StringFlag string3 = new StringFlag(null); - StringFlag string4 = new StringFlag(null); - - region = mock.add(0); - region.setFlag(string1, "Beans"); - region.setFlag(string2, "Apples"); - - region = mock.add(1); - region.setFlag(string1, "Cats"); - region.setFlag(string3, "Bananas"); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertEquals(set.getFlag(string1), "Cats"); - assertEquals(set.getFlag(string2), "Apples"); - assertEquals(set.getFlag(string3), "Bananas"); - assertEquals(set.getFlag(string4), null); - } - - @Test - public void testStateFlagMultiplePriorityFallThrough() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - StringFlag string1 = new StringFlag(null); - StringFlag string2 = new StringFlag(null); - StringFlag string3 = new StringFlag(null); - StringFlag string4 = new StringFlag(null); - - region = mock.add(0); - region.setFlag(string1, "Beans"); - region.setFlag(string2, "Apples"); - region.setFlag(string3, "Dogs"); - - region = mock.add(1); - region.setFlag(string1, "Cats"); - region.setFlag(string3, "Bananas"); - - region = mock.add(10); - region.setFlag(string3, "Strings"); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertEquals(set.getFlag(string1), "Cats"); - assertEquals(set.getFlag(string2), "Apples"); - assertEquals(set.getFlag(string3), "Strings"); - assertEquals(set.getFlag(string4), null); - } - - @Test - public void testStateGlobalDefault() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - StateFlag state1 = new StateFlag(null, false); - StateFlag state2 = new StateFlag(null, false); - StateFlag state3 = new StateFlag(null, false); - StateFlag state4 = new StateFlag(null, true); - StateFlag state5 = new StateFlag(null, true); - StateFlag state6 = new StateFlag(null, true); - - region = mock.global(); - region.setFlag(state1, StateFlag.State.ALLOW); - region.setFlag(state2, StateFlag.State.DENY); - region.setFlag(state4, StateFlag.State.ALLOW); - region.setFlag(state5, StateFlag.State.DENY); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.allows(state1)); - assertFalse(set.allows(state2)); - assertFalse(set.allows(state3)); - assertTrue(set.allows(state4)); - assertFalse(set.allows(state5)); - assertTrue(set.allows(state6)); - } - - @Test - public void testStateGlobalWithRegionsDefault() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - StateFlag state1 = new StateFlag(null, false); - StateFlag state2 = new StateFlag(null, false); - StateFlag state3 = new StateFlag(null, false); - StateFlag state4 = new StateFlag(null, true); - StateFlag state5 = new StateFlag(null, true); - StateFlag state6 = new StateFlag(null, true); - - region = mock.global(); - region.setFlag(state1, StateFlag.State.ALLOW); - region.setFlag(state2, StateFlag.State.DENY); - region.setFlag(state4, StateFlag.State.ALLOW); - region.setFlag(state5, StateFlag.State.DENY); - - region = mock.add(0); - region.setFlag(state1, StateFlag.State.DENY); - region.setFlag(state2, StateFlag.State.DENY); - region.setFlag(state4, StateFlag.State.DENY); - region.setFlag(state5, StateFlag.State.DENY); - - region = mock.add(1); - region.setFlag(state5, StateFlag.State.ALLOW); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.allows(state1)); - assertFalse(set.allows(state2)); - assertFalse(set.allows(state3)); - assertFalse(set.allows(state4)); - assertTrue(set.allows(state5)); - assertTrue(set.allows(state6)); - } - - @Test - public void testBuildAccess() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.getOwners().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testBuildRegionPriorities() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer upperMember = mock.createPlayer(); - LocalPlayer lowerMember = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.getOwners().addPlayer(lowerMember); - - region = mock.add(1); - region.getOwners().addPlayer(upperMember); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(upperMember)); - assertFalse(set.canBuild(lowerMember)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testBuildDenyFlag() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.getOwners().addPlayer(member); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testBuildAllowFlag() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.getOwners().addPlayer(member); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertTrue(set.canBuild(nonMember)); - } - - @Test - public void testHigherPriorityOverrideBuildDenyFlag() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.getOwners().addPlayer(member); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - region = mock.add(1); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertTrue(set.canBuild(nonMember)); - } - - @Test - public void testHigherPriorityUnsetBuildDenyFlag() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.getOwners().addPlayer(member); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - region = mock.add(1); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testPriorityDisjointBuildDenyFlagAndMembership() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - region = mock.add(1); - region.getOwners().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testPriorityDisjointBuildDenyFlagAndRegion() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - region = mock.add(1); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testPriorityDisjointMembershipAndBuildDenyFlag() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.add(0); - region.getOwners().addPlayer(member); - - region = mock.add(1); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testNoGlobalRegionDefaultBuild() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertTrue(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionDefaultBuild() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - @SuppressWarnings("unused") - ProtectedRegion region = mock.global(); - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertTrue(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionBuildFlagAllow() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - region = mock.global(); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertTrue(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionBuildFlagDeny() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - region = mock.global(); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionBuildFlagAllowWithRegion() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.global(); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); - - region = mock.add(0); - region.getOwners().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionBuildFlagDenyWithRegion() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.global(); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - - region = mock.add(0); - region.getOwners().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionHavingOwnershipBuildFlagUnset() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.global(); - region.getOwners().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionHavingOwnershipBuildFlagAllow() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.global(); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); - region.getOwners().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertTrue(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionHavingOwnershipBuildFlagDeny() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer member = mock.createPlayer(); - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.global(); - region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); - region.getOwners().addPlayer(member); - - ApplicableRegionSet set = mock.getApplicableSet(); - assertFalse(set.canBuild(member)); - assertFalse(set.canBuild(nonMember)); - } - - @Test - public void testGlobalRegionCommandBlacklistWithRegionWhitelist() { - MockApplicableRegionSet mock = new MockApplicableRegionSet(); - ProtectedRegion region; - - LocalPlayer nonMember = mock.createPlayer(); - - region = mock.global(); - Set blocked = new HashSet(); - blocked.add("/deny"); - blocked.add("/strange"); - region.setFlag(DefaultFlag.BLOCKED_CMDS, blocked); - - region = mock.add(0); - Set allowed = new HashSet(); - allowed.add("/permit"); - allowed.add("/strange"); - region.setFlag(DefaultFlag.ALLOWED_CMDS, allowed); - - ApplicableRegionSet set; - CommandFilter test; - - set = mock.getApplicableSet(); - test = new CommandFilter( - set.getFlag(DefaultFlag.ALLOWED_CMDS, nonMember), - set.getFlag(DefaultFlag.BLOCKED_CMDS, nonMember)); - assertThat(test.apply("/permit"), is(true)); - assertThat(test.apply("/strange"), is(true)); - assertThat(test.apply("/other"), is(false)); - assertThat(test.apply("/deny"), is(false)); - - set = mock.getApplicableSetInWilderness(); - test = new CommandFilter( - set.getFlag(DefaultFlag.ALLOWED_CMDS, nonMember), - set.getFlag(DefaultFlag.BLOCKED_CMDS, nonMember)); - assertThat(test.apply("/permit"), is(true)); - assertThat(test.apply("/strange"), is(false)); - assertThat(test.apply("/other"), is(true)); - assertThat(test.apply("/deny"), is(false)); - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.protection.flags.DefaultFlag; +import com.sk89q.worldguard.protection.flags.StateFlag; +import com.sk89q.worldguard.protection.flags.StringFlag; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import com.sk89q.worldguard.util.command.CommandFilter; +import org.junit.Test; + +import java.util.HashSet; +import java.util.Set; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.*; + +public class ApplicableRegionSetTest { + + @Test + public void testWildernessBuild() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + + LocalPlayer player = mock.createPlayer(); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); + } + + @Test + public void testWildernessBuildWithGlobalRegion() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + + LocalPlayer player = mock.createPlayer(); + + ProtectedRegion global = mock.global(); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); + } + + @Test + public void testWildernessBuildWithRegion() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + ProtectedRegion region = mock.add(0); + region.getMembers().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertThat(set.testState(member, DefaultFlag.BUILD), is(true)); + assertThat(set.testState(nonMember, DefaultFlag.BUILD), is(false)); + } + + @Test + public void testWildernessFlags() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + + LocalPlayer player = mock.createPlayer(); + + ApplicableRegionSet set = mock.getApplicableSet(); + + assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true)); + assertThat(set.testState(player, DefaultFlag.ENTRY), is(true)); + assertThat(set.testState(player, DefaultFlag.EXIT), is(true)); + assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true)); + assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true)); + assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true)); + assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false)); + + assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); + } + + @Test + public void testWildernessFlagsWithGlobalRegion() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + + LocalPlayer player = mock.createPlayer(); + + ProtectedRegion global = mock.global(); + + ApplicableRegionSet set = mock.getApplicableSet(); + + assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true)); + assertThat(set.testState(player, DefaultFlag.ENTRY), is(true)); + assertThat(set.testState(player, DefaultFlag.EXIT), is(true)); + assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true)); + assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true)); + assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true)); + assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false)); + + assertThat(set.testState(player, DefaultFlag.BUILD), is(true)); + } + + @Test + public void testFlagsWithRegion() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + ProtectedRegion region = mock.add(0); + region.getMembers().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + + assertThat(set.testState(member, DefaultFlag.MOB_DAMAGE), is(true)); + assertThat(set.testState(member, DefaultFlag.ENTRY), is(true)); + assertThat(set.testState(member, DefaultFlag.EXIT), is(true)); + assertThat(set.testState(member, DefaultFlag.LEAF_DECAY), is(true)); + assertThat(set.testState(member, DefaultFlag.RECEIVE_CHAT), is(true)); + assertThat(set.testState(member, DefaultFlag.SEND_CHAT), is(true)); + assertThat(set.testState(member, DefaultFlag.INVINCIBILITY), is(false)); + + assertThat(set.testState(member, DefaultFlag.BUILD), is(true)); + + assertThat(set.testState(nonMember, DefaultFlag.MOB_DAMAGE), is(true)); + assertThat(set.testState(nonMember, DefaultFlag.ENTRY), is(true)); + assertThat(set.testState(nonMember, DefaultFlag.EXIT), is(true)); + assertThat(set.testState(nonMember, DefaultFlag.LEAF_DECAY), is(true)); + assertThat(set.testState(nonMember, DefaultFlag.RECEIVE_CHAT), is(true)); + assertThat(set.testState(nonMember, DefaultFlag.SEND_CHAT), is(true)); + assertThat(set.testState(nonMember, DefaultFlag.INVINCIBILITY), is(false)); + + assertThat(set.testState(nonMember, DefaultFlag.BUILD), is(false)); + } + + @Test + public void testStateFlagPriorityFallThrough() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + StateFlag state1 = new StateFlag(null, false); + StateFlag state2 = new StateFlag(null, false); + StateFlag state3 = new StateFlag(null, false); + + region = mock.add(0); + region.setFlag(state1, StateFlag.State.ALLOW); + region.setFlag(state2, StateFlag.State.DENY); + + region = mock.add(1); + region.setFlag(state1, StateFlag.State.DENY); + region.setFlag(state3, StateFlag.State.ALLOW); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.allows(state1)); + assertFalse(set.allows(state2)); + assertTrue(set.allows(state3)); + } + + @Test + public void testNonStateFlagPriorityFallThrough() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + StringFlag string1 = new StringFlag(null); + StringFlag string2 = new StringFlag(null); + StringFlag string3 = new StringFlag(null); + StringFlag string4 = new StringFlag(null); + + region = mock.add(0); + region.setFlag(string1, "Beans"); + region.setFlag(string2, "Apples"); + + region = mock.add(1); + region.setFlag(string1, "Cats"); + region.setFlag(string3, "Bananas"); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertEquals(set.getFlag(string1), "Cats"); + assertEquals(set.getFlag(string2), "Apples"); + assertEquals(set.getFlag(string3), "Bananas"); + assertEquals(set.getFlag(string4), null); + } + + @Test + public void testStateFlagMultiplePriorityFallThrough() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + StringFlag string1 = new StringFlag(null); + StringFlag string2 = new StringFlag(null); + StringFlag string3 = new StringFlag(null); + StringFlag string4 = new StringFlag(null); + + region = mock.add(0); + region.setFlag(string1, "Beans"); + region.setFlag(string2, "Apples"); + region.setFlag(string3, "Dogs"); + + region = mock.add(1); + region.setFlag(string1, "Cats"); + region.setFlag(string3, "Bananas"); + + region = mock.add(10); + region.setFlag(string3, "Strings"); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertEquals(set.getFlag(string1), "Cats"); + assertEquals(set.getFlag(string2), "Apples"); + assertEquals(set.getFlag(string3), "Strings"); + assertEquals(set.getFlag(string4), null); + } + + @Test + public void testStateGlobalDefault() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + StateFlag state1 = new StateFlag(null, false); + StateFlag state2 = new StateFlag(null, false); + StateFlag state3 = new StateFlag(null, false); + StateFlag state4 = new StateFlag(null, true); + StateFlag state5 = new StateFlag(null, true); + StateFlag state6 = new StateFlag(null, true); + + region = mock.global(); + region.setFlag(state1, StateFlag.State.ALLOW); + region.setFlag(state2, StateFlag.State.DENY); + region.setFlag(state4, StateFlag.State.ALLOW); + region.setFlag(state5, StateFlag.State.DENY); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.allows(state1)); + assertFalse(set.allows(state2)); + assertFalse(set.allows(state3)); + assertTrue(set.allows(state4)); + assertFalse(set.allows(state5)); + assertTrue(set.allows(state6)); + } + + @Test + public void testStateGlobalWithRegionsDefault() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + StateFlag state1 = new StateFlag(null, false); + StateFlag state2 = new StateFlag(null, false); + StateFlag state3 = new StateFlag(null, false); + StateFlag state4 = new StateFlag(null, true); + StateFlag state5 = new StateFlag(null, true); + StateFlag state6 = new StateFlag(null, true); + + region = mock.global(); + region.setFlag(state1, StateFlag.State.ALLOW); + region.setFlag(state2, StateFlag.State.DENY); + region.setFlag(state4, StateFlag.State.ALLOW); + region.setFlag(state5, StateFlag.State.DENY); + + region = mock.add(0); + region.setFlag(state1, StateFlag.State.DENY); + region.setFlag(state2, StateFlag.State.DENY); + region.setFlag(state4, StateFlag.State.DENY); + region.setFlag(state5, StateFlag.State.DENY); + + region = mock.add(1); + region.setFlag(state5, StateFlag.State.ALLOW); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.allows(state1)); + assertFalse(set.allows(state2)); + assertFalse(set.allows(state3)); + assertFalse(set.allows(state4)); + assertTrue(set.allows(state5)); + assertTrue(set.allows(state6)); + } + + @Test + public void testBuildAccess() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.getOwners().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testBuildRegionPriorities() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer upperMember = mock.createPlayer(); + LocalPlayer lowerMember = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.getOwners().addPlayer(lowerMember); + + region = mock.add(1); + region.getOwners().addPlayer(upperMember); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(upperMember)); + assertFalse(set.canBuild(lowerMember)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testBuildDenyFlag() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.getOwners().addPlayer(member); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testBuildAllowFlag() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.getOwners().addPlayer(member); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertTrue(set.canBuild(nonMember)); + } + + @Test + public void testHigherPriorityOverrideBuildDenyFlag() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.getOwners().addPlayer(member); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + region = mock.add(1); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertTrue(set.canBuild(nonMember)); + } + + @Test + public void testHigherPriorityUnsetBuildDenyFlag() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.getOwners().addPlayer(member); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + region = mock.add(1); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testPriorityDisjointBuildDenyFlagAndMembership() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + region = mock.add(1); + region.getOwners().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testPriorityDisjointBuildDenyFlagAndRegion() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + region = mock.add(1); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testPriorityDisjointMembershipAndBuildDenyFlag() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.add(0); + region.getOwners().addPlayer(member); + + region = mock.add(1); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testNoGlobalRegionDefaultBuild() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertTrue(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionDefaultBuild() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + @SuppressWarnings("unused") + ProtectedRegion region = mock.global(); + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertTrue(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionBuildFlagAllow() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + region = mock.global(); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertTrue(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionBuildFlagDeny() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + region = mock.global(); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionBuildFlagAllowWithRegion() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.global(); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); + + region = mock.add(0); + region.getOwners().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionBuildFlagDenyWithRegion() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.global(); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + + region = mock.add(0); + region.getOwners().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionHavingOwnershipBuildFlagUnset() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.global(); + region.getOwners().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionHavingOwnershipBuildFlagAllow() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.global(); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW); + region.getOwners().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertTrue(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionHavingOwnershipBuildFlagDeny() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer member = mock.createPlayer(); + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.global(); + region.setFlag(DefaultFlag.BUILD, StateFlag.State.DENY); + region.getOwners().addPlayer(member); + + ApplicableRegionSet set = mock.getApplicableSet(); + assertFalse(set.canBuild(member)); + assertFalse(set.canBuild(nonMember)); + } + + @Test + public void testGlobalRegionCommandBlacklistWithRegionWhitelist() { + MockApplicableRegionSet mock = new MockApplicableRegionSet(); + ProtectedRegion region; + + LocalPlayer nonMember = mock.createPlayer(); + + region = mock.global(); + Set blocked = new HashSet(); + blocked.add("/deny"); + blocked.add("/strange"); + region.setFlag(DefaultFlag.BLOCKED_CMDS, blocked); + + region = mock.add(0); + Set allowed = new HashSet(); + allowed.add("/permit"); + allowed.add("/strange"); + region.setFlag(DefaultFlag.ALLOWED_CMDS, allowed); + + ApplicableRegionSet set; + CommandFilter test; + + set = mock.getApplicableSet(); + test = new CommandFilter( + set.getFlag(DefaultFlag.ALLOWED_CMDS, nonMember), + set.getFlag(DefaultFlag.BLOCKED_CMDS, nonMember)); + assertThat(test.apply("/permit"), is(true)); + assertThat(test.apply("/strange"), is(true)); + assertThat(test.apply("/other"), is(false)); + assertThat(test.apply("/deny"), is(false)); + + set = mock.getApplicableSetInWilderness(); + test = new CommandFilter( + set.getFlag(DefaultFlag.ALLOWED_CMDS, nonMember), + set.getFlag(DefaultFlag.BLOCKED_CMDS, nonMember)); + assertThat(test.apply("/permit"), is(true)); + assertThat(test.apply("/strange"), is(false)); + assertThat(test.apply("/other"), is(true)); + assertThat(test.apply("/deny"), is(false)); + } + +} diff --git a/src/test/java/com/sk89q/worldguard/protection/FlagValueCalculatorTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/FlagValueCalculatorTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/FlagValueCalculatorTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/FlagValueCalculatorTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/HashMapIndexPriorityTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/HashMapIndexPriorityTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/HashMapIndexPriorityTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/HashMapIndexPriorityTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/HashMapIndexRegionOverlapTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/HashMapIndexRegionOverlapTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/HashMapIndexRegionOverlapTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/HashMapIndexRegionOverlapTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/HashMapIndexTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/HashMapIndexTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/HashMapIndexTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/HashMapIndexTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java similarity index 97% rename from src/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java index b0400f60..e9ad3b70 100644 --- a/src/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java +++ b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java @@ -1,99 +1,99 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection; - -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldguard.LocalPlayer; -import com.sk89q.worldguard.TestPlayer; -import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.util.NormativeOrders; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class MockApplicableRegionSet { - - private List regions = new ArrayList(); - private ProtectedRegion global; - private int id = 0; - private int playerIndex = 0; - - public void add(ProtectedRegion region) { - regions.add(region); - } - - public LocalPlayer createPlayer() { - playerIndex++; - LocalPlayer player = new TestPlayer("#PLAYER_" + playerIndex); - return player; - } - - public ProtectedRegion global() { - global = new GlobalProtectedRegion("__global__"); - return global; - } - - public ProtectedRegion createOutside(int priority) { - ProtectedRegion region = new ProtectedCuboidRegion(getNextId(), - new BlockVector(0, 0, 0), new BlockVector(1, 1, 1)); - region.setPriority(priority); - return region; - } - - public ProtectedRegion add(int priority) { - ProtectedRegion region = new ProtectedCuboidRegion(getNextId(), - new BlockVector(0, 0, 0), new BlockVector(1, 1, 1)); - region.setPriority(priority); - add(region); - return region; - } - - public ProtectedRegion add(int priority, ProtectedRegion parent) - throws ProtectedRegion.CircularInheritanceException { - ProtectedRegion region = new ProtectedCuboidRegion(getNextId(), - new BlockVector(0, 0, 0), new BlockVector(1, 1, 1)); - region.setPriority(priority); - region.setParent(parent); - add(region); - return region; - } - - public ApplicableRegionSet getApplicableSetInWilderness() { - return new RegionResultSet(Collections.emptyList(), global); - } - - public ApplicableRegionSet getApplicableSet() { - return new RegionResultSet(regions, global); - } - - public FlagValueCalculator getFlagCalculator() { - NormativeOrders.sort(regions); - return new FlagValueCalculator(regions, global); - } - - private String getNextId() { - id++; - return "REGION_" + id; - } - -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldguard.LocalPlayer; +import com.sk89q.worldguard.TestPlayer; +import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; +import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import com.sk89q.worldguard.protection.util.NormativeOrders; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class MockApplicableRegionSet { + + private List regions = new ArrayList(); + private ProtectedRegion global; + private int id = 0; + private int playerIndex = 0; + + public void add(ProtectedRegion region) { + regions.add(region); + } + + public LocalPlayer createPlayer() { + playerIndex++; + LocalPlayer player = new TestPlayer("#PLAYER_" + playerIndex); + return player; + } + + public ProtectedRegion global() { + global = new GlobalProtectedRegion("__global__"); + return global; + } + + public ProtectedRegion createOutside(int priority) { + ProtectedRegion region = new ProtectedCuboidRegion(getNextId(), + new BlockVector(0, 0, 0), new BlockVector(1, 1, 1)); + region.setPriority(priority); + return region; + } + + public ProtectedRegion add(int priority) { + ProtectedRegion region = new ProtectedCuboidRegion(getNextId(), + new BlockVector(0, 0, 0), new BlockVector(1, 1, 1)); + region.setPriority(priority); + add(region); + return region; + } + + public ProtectedRegion add(int priority, ProtectedRegion parent) + throws ProtectedRegion.CircularInheritanceException { + ProtectedRegion region = new ProtectedCuboidRegion(getNextId(), + new BlockVector(0, 0, 0), new BlockVector(1, 1, 1)); + region.setPriority(priority); + region.setParent(parent); + add(region); + return region; + } + + public ApplicableRegionSet getApplicableSetInWilderness() { + return new RegionResultSet(Collections.emptyList(), global); + } + + public ApplicableRegionSet getApplicableSet() { + return new RegionResultSet(regions, global); + } + + public FlagValueCalculator getFlagCalculator() { + NormativeOrders.sort(regions); + return new FlagValueCalculator(regions, global); + } + + private String getNextId() { + id++; + return "REGION_" + id; + } + +} diff --git a/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeIndexTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeIndexTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/PriorityRTreeIndexTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeIndexTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionEntryExitTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionEntryExitTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionEntryExitTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionEntryExitTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionOverlapTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionOverlapTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionOverlapTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionOverlapTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionPriorityTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionPriorityTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionPriorityTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/PriorityRTreeRegionPriorityTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/RegionEntryExitTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionEntryExitTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/RegionEntryExitTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionEntryExitTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java similarity index 97% rename from src/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java index 362e4fe7..513434f7 100644 --- a/src/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java +++ b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java @@ -1,181 +1,181 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.junit.Before; -import org.junit.Test; - -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldguard.TestPlayer; -import com.sk89q.worldguard.domains.DefaultDomain; -import com.sk89q.worldguard.protection.flags.DefaultFlag; -import com.sk89q.worldguard.protection.flags.StateFlag; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; - -public abstract class RegionOverlapTest { - static String COURTYARD_ID = "courtyard"; - static String FOUNTAIN_ID = "fountain"; - static String NO_FIRE_ID = "nofire"; - static String MEMBER_GROUP = "member"; - static String COURTYARD_GROUP = "courtyard"; - - Vector inFountain = new Vector(2, 2, 2); - Vector inCourtyard = new Vector(7, 7, 7); - Vector outside = new Vector(15, 15, 15); - Vector inNoFire = new Vector(150, 150, 150); - RegionManager manager; - ProtectedRegion globalRegion; - ProtectedRegion courtyard; - ProtectedRegion fountain; - TestPlayer player1; - TestPlayer player2; - - protected abstract RegionManager createRegionManager() throws Exception; - - @Before - public void setUp() throws Exception { - setUpGlobalRegion(); - - manager = createRegionManager(); - - setUpPlayers(); - setUpCourtyardRegion(); - setUpFountainRegion(); - setUpNoFireRegion(); - } - - void setUpPlayers() { - player1 = new TestPlayer("tetsu"); - player1.addGroup(MEMBER_GROUP); - player1.addGroup(COURTYARD_GROUP); - - player2 = new TestPlayer("alex"); - player2.addGroup(MEMBER_GROUP); - } - - void setUpGlobalRegion() { - globalRegion = new GlobalProtectedRegion("__global__"); - } - - void setUpCourtyardRegion() { - DefaultDomain domain = new DefaultDomain(); - domain.addGroup(COURTYARD_GROUP); - - ArrayList points = new ArrayList(); - points.add(new BlockVector2D(0, 0)); - points.add(new BlockVector2D(10, 0)); - points.add(new BlockVector2D(10, 10)); - points.add(new BlockVector2D(0, 10)); - - //ProtectedRegion region = new ProtectedCuboidRegion(COURTYARD_ID, new BlockVector(0, 0, 0), new BlockVector(10, 10, 10)); - ProtectedRegion region = new ProtectedPolygonalRegion(COURTYARD_ID, points, 0, 10); - - region.setOwners(domain); - manager.addRegion(region); - - courtyard = region; - } - - void setUpFountainRegion() throws Exception { - DefaultDomain domain = new DefaultDomain(); - domain.addGroup(MEMBER_GROUP); - - ProtectedRegion region = new ProtectedCuboidRegion(FOUNTAIN_ID, - new BlockVector(0, 0, 0), new BlockVector(5, 5, 5)); - region.setMembers(domain); - manager.addRegion(region); - - fountain = region; - fountain.setParent(courtyard); - fountain.setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.DENY); - } - - void setUpNoFireRegion() throws Exception { - ProtectedRegion region = new ProtectedCuboidRegion(NO_FIRE_ID, - new BlockVector(100, 100, 100), new BlockVector(200, 200, 200)); - manager.addRegion(region); - region.setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.DENY); - } - - @Test - public void testNonBuildFlag() { - ApplicableRegionSet appl; - - // Outside - appl = manager.getApplicableRegions(outside); - assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); - // Inside courtyard - appl = manager.getApplicableRegions(inCourtyard); - assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); - // Inside fountain - appl = manager.getApplicableRegions(inFountain); - assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); - - // Inside no fire zone - appl = manager.getApplicableRegions(inNoFire); - assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); - } - - @Test - public void testPlayer1BuildAccess() { - ApplicableRegionSet appl; - - // Outside - appl = manager.getApplicableRegions(outside); - assertTrue(appl.canBuild(player1)); - // Inside courtyard - appl = manager.getApplicableRegions(inCourtyard); - assertTrue(appl.canBuild(player1)); - // Inside fountain - appl = manager.getApplicableRegions(inFountain); - assertTrue(appl.canBuild(player1)); - } - - @Test - public void testPlayer2BuildAccess() { - ApplicableRegionSet appl; - - HashSet test = new HashSet(); - test.add(courtyard); - test.add(fountain); - - // Outside - appl = manager.getApplicableRegions(outside); - assertTrue(appl.canBuild(player2)); - // Inside courtyard - appl = manager.getApplicableRegions(inCourtyard); - assertFalse(appl.canBuild(player2)); - // Inside fountain - appl = manager.getApplicableRegions(inFountain); - assertTrue(appl.canBuild(player2)); - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.HashSet; + +import org.junit.Before; +import org.junit.Test; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldguard.TestPlayer; +import com.sk89q.worldguard.domains.DefaultDomain; +import com.sk89q.worldguard.protection.flags.DefaultFlag; +import com.sk89q.worldguard.protection.flags.StateFlag; +import com.sk89q.worldguard.protection.managers.RegionManager; +import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; +import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; +import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; + +public abstract class RegionOverlapTest { + static String COURTYARD_ID = "courtyard"; + static String FOUNTAIN_ID = "fountain"; + static String NO_FIRE_ID = "nofire"; + static String MEMBER_GROUP = "member"; + static String COURTYARD_GROUP = "courtyard"; + + Vector inFountain = new Vector(2, 2, 2); + Vector inCourtyard = new Vector(7, 7, 7); + Vector outside = new Vector(15, 15, 15); + Vector inNoFire = new Vector(150, 150, 150); + RegionManager manager; + ProtectedRegion globalRegion; + ProtectedRegion courtyard; + ProtectedRegion fountain; + TestPlayer player1; + TestPlayer player2; + + protected abstract RegionManager createRegionManager() throws Exception; + + @Before + public void setUp() throws Exception { + setUpGlobalRegion(); + + manager = createRegionManager(); + + setUpPlayers(); + setUpCourtyardRegion(); + setUpFountainRegion(); + setUpNoFireRegion(); + } + + void setUpPlayers() { + player1 = new TestPlayer("tetsu"); + player1.addGroup(MEMBER_GROUP); + player1.addGroup(COURTYARD_GROUP); + + player2 = new TestPlayer("alex"); + player2.addGroup(MEMBER_GROUP); + } + + void setUpGlobalRegion() { + globalRegion = new GlobalProtectedRegion("__global__"); + } + + void setUpCourtyardRegion() { + DefaultDomain domain = new DefaultDomain(); + domain.addGroup(COURTYARD_GROUP); + + ArrayList points = new ArrayList(); + points.add(new BlockVector2D(0, 0)); + points.add(new BlockVector2D(10, 0)); + points.add(new BlockVector2D(10, 10)); + points.add(new BlockVector2D(0, 10)); + + //ProtectedRegion region = new ProtectedCuboidRegion(COURTYARD_ID, new BlockVector(0, 0, 0), new BlockVector(10, 10, 10)); + ProtectedRegion region = new ProtectedPolygonalRegion(COURTYARD_ID, points, 0, 10); + + region.setOwners(domain); + manager.addRegion(region); + + courtyard = region; + } + + void setUpFountainRegion() throws Exception { + DefaultDomain domain = new DefaultDomain(); + domain.addGroup(MEMBER_GROUP); + + ProtectedRegion region = new ProtectedCuboidRegion(FOUNTAIN_ID, + new BlockVector(0, 0, 0), new BlockVector(5, 5, 5)); + region.setMembers(domain); + manager.addRegion(region); + + fountain = region; + fountain.setParent(courtyard); + fountain.setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.DENY); + } + + void setUpNoFireRegion() throws Exception { + ProtectedRegion region = new ProtectedCuboidRegion(NO_FIRE_ID, + new BlockVector(100, 100, 100), new BlockVector(200, 200, 200)); + manager.addRegion(region); + region.setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.DENY); + } + + @Test + public void testNonBuildFlag() { + ApplicableRegionSet appl; + + // Outside + appl = manager.getApplicableRegions(outside); + assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); + // Inside courtyard + appl = manager.getApplicableRegions(inCourtyard); + assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); + // Inside fountain + appl = manager.getApplicableRegions(inFountain); + assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); + + // Inside no fire zone + appl = manager.getApplicableRegions(inNoFire); + assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); + } + + @Test + public void testPlayer1BuildAccess() { + ApplicableRegionSet appl; + + // Outside + appl = manager.getApplicableRegions(outside); + assertTrue(appl.canBuild(player1)); + // Inside courtyard + appl = manager.getApplicableRegions(inCourtyard); + assertTrue(appl.canBuild(player1)); + // Inside fountain + appl = manager.getApplicableRegions(inFountain); + assertTrue(appl.canBuild(player1)); + } + + @Test + public void testPlayer2BuildAccess() { + ApplicableRegionSet appl; + + HashSet test = new HashSet(); + test.add(courtyard); + test.add(fountain); + + // Outside + appl = manager.getApplicableRegions(outside); + assertTrue(appl.canBuild(player2)); + // Inside courtyard + appl = manager.getApplicableRegions(inCourtyard); + assertFalse(appl.canBuild(player2)); + // Inside fountain + appl = manager.getApplicableRegions(inFountain); + assertTrue(appl.canBuild(player2)); + } +} diff --git a/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java similarity index 97% rename from src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java index e7a90b94..5539d758 100644 --- a/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java +++ b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java @@ -1,160 +1,160 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.protection; - -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldguard.TestPlayer; -import com.sk89q.worldguard.domains.DefaultDomain; -import com.sk89q.worldguard.protection.flags.DefaultFlag; -import com.sk89q.worldguard.protection.flags.StateFlag; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public abstract class RegionPriorityTest { - static String COURTYARD_ID = "courtyard"; - static String FOUNTAIN_ID = "fountain"; - static String NO_FIRE_ID = "nofire"; - static String MEMBER_GROUP = "member"; - static String COURTYARD_GROUP = "courtyard"; - - Vector inFountain = new Vector(2, 2, 2); - Vector inCourtyard = new Vector(7, 7, 7); - Vector outside = new Vector(15, 15, 15); - RegionManager manager; - ProtectedRegion globalRegion; - ProtectedRegion courtyard; - ProtectedRegion fountain; - TestPlayer player1; - TestPlayer player2; - - protected abstract RegionManager createRegionManager() throws Exception; - - @Before - public void setUp() throws Exception { - setUpGlobalRegion(); - - manager = createRegionManager(); - - setUpPlayers(); - setUpCourtyardRegion(); - setUpFountainRegion(); - } - - void setUpPlayers() { - player1 = new TestPlayer("tetsu"); - player1.addGroup(MEMBER_GROUP); - player1.addGroup(COURTYARD_GROUP); - - player2 = new TestPlayer("alex"); - player2.addGroup(MEMBER_GROUP); - } - - void setUpGlobalRegion() { - globalRegion = new GlobalProtectedRegion("__global__"); - } - - void setUpCourtyardRegion() { - DefaultDomain domain = new DefaultDomain(); - domain.addGroup(COURTYARD_GROUP); - - ArrayList points = new ArrayList(); - points.add(new BlockVector2D(0, 0)); - points.add(new BlockVector2D(10, 0)); - points.add(new BlockVector2D(10, 10)); - points.add(new BlockVector2D(0, 10)); - - //ProtectedRegion region = new ProtectedCuboidRegion(COURTYARD_ID, new BlockVector(0, 0, 0), new BlockVector(10, 10, 10)); - ProtectedRegion region = new ProtectedPolygonalRegion(COURTYARD_ID, points, 0, 10); - - region.setOwners(domain); - manager.addRegion(region); - - courtyard = region; - courtyard.setFlag(DefaultFlag.MOB_SPAWNING, StateFlag.State.DENY); - } - - void setUpFountainRegion() throws Exception { - DefaultDomain domain = new DefaultDomain(); - domain.addGroup(MEMBER_GROUP); - - ProtectedRegion region = new ProtectedCuboidRegion(FOUNTAIN_ID, - new BlockVector(0, 0, 0), new BlockVector(5, 5, 5)); - region.setMembers(domain); - manager.addRegion(region); - - fountain = region; - fountain.setParent(courtyard); - fountain.setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.DENY); - fountain.setFlag(DefaultFlag.MOB_SPAWNING, StateFlag.State.ALLOW); - } - - @Test - public void testNoPriorities() throws Exception { - ApplicableRegionSet appl; - - courtyard.setPriority(0); - fountain.setPriority(0); - - appl = manager.getApplicableRegions(inCourtyard); - assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); - assertFalse(appl.allows(DefaultFlag.MOB_SPAWNING)); - appl = manager.getApplicableRegions(inFountain); - assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); - assertTrue(appl.allows(DefaultFlag.MOB_SPAWNING)); - } - - @Test - public void testPriorities() throws Exception { - ApplicableRegionSet appl; - - courtyard.setPriority(5); - fountain.setPriority(0); - - appl = manager.getApplicableRegions(inCourtyard); - assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); - appl = manager.getApplicableRegions(inFountain); - assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); - } - - @Test - public void testPriorities2() throws Exception { - ApplicableRegionSet appl; - - courtyard.setPriority(0); - fountain.setPriority(5); - - appl = manager.getApplicableRegions(inCourtyard); - assertFalse(appl.allows(DefaultFlag.MOB_SPAWNING)); - appl = manager.getApplicableRegions(inFountain); - assertTrue(appl.allows(DefaultFlag.MOB_SPAWNING)); - } -} +/* + * WorldGuard, a suite of tools for Minecraft + * Copyright (C) sk89q + * Copyright (C) WorldGuard team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldguard.TestPlayer; +import com.sk89q.worldguard.domains.DefaultDomain; +import com.sk89q.worldguard.protection.flags.DefaultFlag; +import com.sk89q.worldguard.protection.flags.StateFlag; +import com.sk89q.worldguard.protection.managers.RegionManager; +import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; +import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; +import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public abstract class RegionPriorityTest { + static String COURTYARD_ID = "courtyard"; + static String FOUNTAIN_ID = "fountain"; + static String NO_FIRE_ID = "nofire"; + static String MEMBER_GROUP = "member"; + static String COURTYARD_GROUP = "courtyard"; + + Vector inFountain = new Vector(2, 2, 2); + Vector inCourtyard = new Vector(7, 7, 7); + Vector outside = new Vector(15, 15, 15); + RegionManager manager; + ProtectedRegion globalRegion; + ProtectedRegion courtyard; + ProtectedRegion fountain; + TestPlayer player1; + TestPlayer player2; + + protected abstract RegionManager createRegionManager() throws Exception; + + @Before + public void setUp() throws Exception { + setUpGlobalRegion(); + + manager = createRegionManager(); + + setUpPlayers(); + setUpCourtyardRegion(); + setUpFountainRegion(); + } + + void setUpPlayers() { + player1 = new TestPlayer("tetsu"); + player1.addGroup(MEMBER_GROUP); + player1.addGroup(COURTYARD_GROUP); + + player2 = new TestPlayer("alex"); + player2.addGroup(MEMBER_GROUP); + } + + void setUpGlobalRegion() { + globalRegion = new GlobalProtectedRegion("__global__"); + } + + void setUpCourtyardRegion() { + DefaultDomain domain = new DefaultDomain(); + domain.addGroup(COURTYARD_GROUP); + + ArrayList points = new ArrayList(); + points.add(new BlockVector2D(0, 0)); + points.add(new BlockVector2D(10, 0)); + points.add(new BlockVector2D(10, 10)); + points.add(new BlockVector2D(0, 10)); + + //ProtectedRegion region = new ProtectedCuboidRegion(COURTYARD_ID, new BlockVector(0, 0, 0), new BlockVector(10, 10, 10)); + ProtectedRegion region = new ProtectedPolygonalRegion(COURTYARD_ID, points, 0, 10); + + region.setOwners(domain); + manager.addRegion(region); + + courtyard = region; + courtyard.setFlag(DefaultFlag.MOB_SPAWNING, StateFlag.State.DENY); + } + + void setUpFountainRegion() throws Exception { + DefaultDomain domain = new DefaultDomain(); + domain.addGroup(MEMBER_GROUP); + + ProtectedRegion region = new ProtectedCuboidRegion(FOUNTAIN_ID, + new BlockVector(0, 0, 0), new BlockVector(5, 5, 5)); + region.setMembers(domain); + manager.addRegion(region); + + fountain = region; + fountain.setParent(courtyard); + fountain.setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.DENY); + fountain.setFlag(DefaultFlag.MOB_SPAWNING, StateFlag.State.ALLOW); + } + + @Test + public void testNoPriorities() throws Exception { + ApplicableRegionSet appl; + + courtyard.setPriority(0); + fountain.setPriority(0); + + appl = manager.getApplicableRegions(inCourtyard); + assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); + assertFalse(appl.allows(DefaultFlag.MOB_SPAWNING)); + appl = manager.getApplicableRegions(inFountain); + assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); + assertTrue(appl.allows(DefaultFlag.MOB_SPAWNING)); + } + + @Test + public void testPriorities() throws Exception { + ApplicableRegionSet appl; + + courtyard.setPriority(5); + fountain.setPriority(0); + + appl = manager.getApplicableRegions(inCourtyard); + assertTrue(appl.allows(DefaultFlag.FIRE_SPREAD)); + appl = manager.getApplicableRegions(inFountain); + assertFalse(appl.allows(DefaultFlag.FIRE_SPREAD)); + } + + @Test + public void testPriorities2() throws Exception { + ApplicableRegionSet appl; + + courtyard.setPriority(0); + fountain.setPriority(5); + + appl = manager.getApplicableRegions(inCourtyard); + assertFalse(appl.allows(DefaultFlag.MOB_SPAWNING)); + appl = manager.getApplicableRegions(inFountain); + assertTrue(appl.allows(DefaultFlag.MOB_SPAWNING)); + } +} diff --git a/src/test/java/com/sk89q/worldguard/protection/regions/RegionIntersectTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/regions/RegionIntersectTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/protection/regions/RegionIntersectTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/regions/RegionIntersectTest.java diff --git a/src/test/java/com/sk89q/worldguard/util/CommandFilterTest.java b/worldguard-legacy/src/test/java/com/sk89q/worldguard/util/CommandFilterTest.java similarity index 100% rename from src/test/java/com/sk89q/worldguard/util/CommandFilterTest.java rename to worldguard-legacy/src/test/java/com/sk89q/worldguard/util/CommandFilterTest.java diff --git a/worldguard-legacy/worldguard-legacy.iml b/worldguard-legacy/worldguard-legacy.iml new file mode 100644 index 00000000..40d4d92f --- /dev/null +++ b/worldguard-legacy/worldguard-legacy.iml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldguard-sponge/build.gradle b/worldguard-sponge/build.gradle new file mode 100644 index 00000000..db5786f3 --- /dev/null +++ b/worldguard-sponge/build.gradle @@ -0,0 +1,16 @@ +apply plugin: 'eclipse' +apply plugin: 'idea' + +dependencies { + compile project(':worldguard-core') + compile 'org.spongepowered:spongeapi:2.1-SNAPSHOT' +} + +shadowJar { + dependencies { + include(dependency(':worldguard-core')) + } + +} + +build.dependsOn(shadowJar) diff --git a/worldguard-sponge/worldguard-sponge.iml b/worldguard-sponge/worldguard-sponge.iml new file mode 100644 index 00000000..2fceeb4e --- /dev/null +++ b/worldguard-sponge/worldguard-sponge.iml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file