From 5c63b42306e53ff9009f331d05a5f91a73eefa39 Mon Sep 17 00:00:00 2001 From: DerFrZocker Date: Fri, 31 Dec 2021 23:10:38 +0100 Subject: [PATCH] First push of v2 1.18.1 Took 14 hours 52 minutes --- .../api/Feature.java} | 14 +- .../feature/api/FeatureGenerator.java | 44 + .../api/FeatureGeneratorConfiguration.java} | 6 +- .../feature/api/FeaturePlacementModifier.java | 30 +- .../api/PlacementModifierConfiguration.java | 32 + .../derfrzocker/feature/api/Registries.java | 53 + .../de/derfrzocker/feature/api/Registry.java | 81 ++ .../de/derfrzocker/feature/api/Value.java | 40 + .../de/derfrzocker/feature/api/ValueType.java | 36 + .../de/derfrzocker/ore/control/api/Biome.java | 142 +-- .../ore/control/api/BiomeOreSettings.java | 82 -- .../derfrzocker/ore/control/api/Config.java | 49 + ...NMSUtil.java => FeatureGeneratorHook.java} | 30 +- .../ore/control/api/GenerationHandler.java | 60 -- .../ore/control/api/NMSService.java | 79 -- .../de/derfrzocker/ore/control/api/Ore.java | 145 --- .../ore/control/api/OreControlRegistries.java | 38 + .../ore/control/api/OreControlService.java | 286 ------ .../ore/control/api/OreSettings.java | 98 -- .../control/api/PlacementModifierHook.java | 37 + .../derfrzocker/ore/control/api/Setting.java | 99 -- .../ore/control/api/WorldOreConfig.java | 171 ---- .../ore/control/api/dao/ConfigDao.java | 164 +++ {impl/yaml => common}/pom.xml | 8 +- .../common/value/number/FixedFloatType.java | 33 +- .../common/value/number/FixedFloatValue.java | 33 +- .../common/value/number/FixedIntegerType.java | 33 +- .../value/number/FixedIntegerValue.java | 33 +- .../common/value/number/FloatType.java | 7 +- .../common/value/number/FloatValue.java | 30 + .../common/value/number/IntegerType.java | 29 + .../common/value/number/IntegerValue.java | 29 + .../common/value/number/NumberType.java | 31 + .../common/value/number/NumberValue.java | 31 + impl/pom.xml | 11 +- impl/service/pom.xml | 24 - .../ore/control/impl/NMSServiceImpl.java | 129 --- .../control/impl/OreControlServiceImpl.java | 476 --------- .../EmeraldGenerationHandler.java | 88 -- .../LapisGenerationHandler.java | 83 -- .../MagmaGenerationHandler.java | 91 -- .../NetherAncientDebrisGenerationHandler.java | 75 -- .../NetherNormalOreGenerationHandler.java | 78 -- .../NormalOreGenerationHandler.java | 86 -- .../ore/control/utils/GenerationUtil.java | 124 --- impl/v1_13_R1/lib/spigot-1.13-simple.jar | Bin 23242 -> 0 bytes impl/v1_13_R1/pom.xml | 31 - .../impl/v1_13_R1/NMSReplacer_v1_13_R1.java | 288 ------ .../impl/v1_13_R1/NMSUtil_v1_13_R1.java | 146 --- ...GenDecoratorEmeraldOverrider_v1_13_R1.java | 63 -- ...oratorHeightAverageOverrider_v1_13_R1.java | 63 -- ...rHeightBadlandsGoldOverrider_v1_13_R1.java | 64 -- ...rNetherHeightNormalOverrider_v1_13_R1.java | 65 -- ...ecoratorNetherMagmaOverrider_v1_13_R1.java | 63 -- impl/v1_13_R2/pom.xml | 31 - .../impl/v1_13_R2/NMSReplacer1_13_R2.java | 288 ------ .../impl/v1_13_R2/NMSUtil_v1_13_R2.java | 146 --- ...GenDecoratorEmeraldOverrider_v1_13_R2.java | 64 -- ...oratorHeightAverageOverrider_v1_13_R2.java | 64 -- ...rHeightBadlandsGoldOverrider_v1_13_R2.java | 64 -- ...rNetherHeightNormalOverrider_v1_13_R2.java | 66 -- ...ecoratorNetherMagmaOverrider_v1_13_R2.java | 63 -- impl/v1_14_R1/pom.xml | 31 - .../impl/v1_14_R1/NMSReplacer_v1_14_R1.java | 325 ------ .../impl/v1_14_R1/NMSUtil_v1_14_R1.java | 148 --- ...GenDecoratorEmeraldOverrider_v1_14_R1.java | 68 -- ...oratorHeightAverageOverrider_v1_14_R1.java | 68 -- ...rHeightBadlandsGoldOverrider_v1_14_R1.java | 68 -- ...rNetherHeightNormalOverrider_v1_14_R1.java | 70 -- ...ecoratorNetherMagmaOverrider_v1_14_R1.java | 67 -- impl/v1_15_R1/pom.xml | 31 - .../impl/v1_15_R1/NMSReplacer_v1_15_R1.java | 324 ------ .../impl/v1_15_R1/NMSUtil_v1_15_R1.java | 148 --- ...GenDecoratorEmeraldOverrider_v1_15_R1.java | 68 -- ...oratorHeightAverageOverrider_v1_15_R1.java | 68 -- ...rHeightBadlandsGoldOverrider_v1_15_R1.java | 68 -- ...rNetherHeightNormalOverrider_v1_15_R1.java | 70 -- ...ecoratorNetherMagmaOverrider_v1_15_R1.java | 67 -- impl/v1_16_R1/pom.xml | 31 - .../impl/v1_16_R1/NMSReplacer_v1_16_R1.java | 339 ------- .../impl/v1_16_R1/NMSUtil_v1_16_R1.java | 191 ---- ...GenDecoratorEmeraldOverrider_v1_16_R1.java | 67 -- ...oratorHeightAverageOverrider_v1_16_R1.java | 72 -- ...rHeightBadlandsGoldOverrider_v1_16_R1.java | 67 -- ...rNetherHeightNormalOverrider_v1_16_R1.java | 69 -- ...ecoratorNetherMagmaOverrider_v1_16_R1.java | 66 -- impl/v1_16_R2/pom.xml | 32 - .../DepthAveragedWorldGeneratorOverrider.java | 104 -- .../EmeraldWorldGeneratorOverrider.java | 95 -- .../MagmaWorldGeneratorOverrider.java | 95 -- .../impl/v1_16_R2/NMSReplacer_v1_16_R2.java | 254 ----- .../impl/v1_16_R2/NMSUtil_v1_16_R2.java | 230 ----- .../RangeWorldGeneratorOverrider.java | 105 -- impl/v1_16_R3/pom.xml | 32 - .../DepthAveragedWorldGeneratorOverrider.java | 104 -- .../EmeraldWorldGeneratorOverrider.java | 95 -- .../MagmaWorldGeneratorOverrider.java | 95 -- .../impl/v1_16_R3/NMSReplacer_v1_16_R3.java | 225 ----- .../impl/v1_16_R3/NMSUtil_v1_16_R3.java | 200 ---- .../RangeWorldGeneratorOverrider.java | 105 -- .../DepthAveragedWorldGeneratorOverrider.java | 120 --- .../EmeraldWorldGeneratorOverrider.java | 116 --- .../MagmaWorldGeneratorOverrider.java | 116 --- .../impl/v1_17_R1/NMSReplacer_v1_17_R1.java | 240 ----- .../impl/v1_17_R1/NMSUtil_v1_17_R1.java | 220 ---- .../RangeWorldGeneratorOverrider.java | 117 --- impl/{v1_17_R1 => v1_18_R1}/pom.xml | 20 +- .../generator/MinecraftFeatureGenerator.java | 87 ++ .../generator/OreFeatureGenerator.java | 98 ++ .../OreFeatureConfiguration.java | 66 ++ .../v1_18_R1/placement/CountModifier.java | 76 ++ .../placement/HeightRangeModifier.java | 77 ++ .../placement/MinecraftPlacementModifier.java | 86 ++ .../v1_18_R1/placement/RarityModifier.java | 72 ++ .../SurfaceRelativeThresholdModifier.java | 89 ++ .../placement/SurfaceWaterDepthModifier.java | 71 ++ .../CountModifierConfiguration.java | 50 + .../HeightRangeModifierConfiguration.java | 50 + .../RarityModifierConfiguration.java | 50 + ...elativeThresholdModifierConfiguration.java | 64 ++ ...urfaceWaterDepthModifierConfiguration.java | 50 + .../value/heightmap/FixedHeightmapType.java | 56 ++ .../value/heightmap/FixedHeightmapValue.java | 57 ++ .../value/heightmap/HeightmapType.java | 32 + .../value/heightmap/HeightmapValue.java | 32 + .../FixedHeightProviderType.java | 56 ++ .../FixedHeightProviderValue.java | 57 ++ .../heightprovider/HeightProviderType.java | 32 + .../heightprovider/HeightProviderValue.java | 32 + .../intprovider/FixedIntProviderType.java | 56 ++ .../intprovider/FixedIntProviderValue.java | 57 ++ .../value/intprovider/IntProviderType.java | 32 + .../value/intprovider/IntProviderValue.java | 32 + .../value/target/FixedTargetType.java} | 37 +- .../value/target/FixedTargetValue.java | 57 ++ .../v1_18_R1/value/target/TargetType.java} | 27 +- .../v1_18_R1/value/target/TargetValue.java | 32 + .../impl/v1_18_R1/NMSReplacer_v1_18_R1.java | 367 +++++++ .../MinecraftFeatureGeneratorHook.java | 121 +++ .../generator/OreFeatureGeneratorHook.java | 80 ++ .../v1_18_R1/placement/CountModifierHook.java | 73 ++ .../placement/HeightRangeModifierHook.java | 73 ++ .../MinecraftPlacementModifierHook.java | 139 +++ .../placement/RarityModifierHook.java | 73 ++ .../SurfaceRelativeThresholdModifierHook.java | 97 ++ .../SurfaceWaterDepthModifierHook.java | 73 ++ .../impl/BiomeOreSettingsYamlImpl.java | 163 --- .../ore/control/impl/OreSettingsYamlImpl.java | 207 ---- .../control/impl/WorldOreConfigYamlImpl.java | 318 ------ .../impl/dao/LazyWorldOreConfigCache.java | 152 --- .../impl/dao/WorldOreConfigYamlDao.java | 212 ---- .../control/impl/OreSettingsYamlImplTest.java | 133 --- metrics/pom.xml | 31 - .../ore/control/OreControlMetrics.java | 134 --- ore-control-lite/pom.xml | 106 -- .../ore/control/OreControlLite.java | 269 ----- .../control/OreControlServiceSupplier.java | 100 -- .../de/derfrzocker/ore/control/Settings.java | 215 ---- .../src/main/resources/data/settings.yml | 195 ---- .../src/main/resources/plugin.yml | 10 - ore-control/pom.xml | 61 +- .../derfrzocker/ore/control/ConfigValues.java | 186 ---- .../derfrzocker/ore/control/OreControl.java | 418 +------- .../ore/control/OreControlMessages.java | 514 ---------- .../control/OreControlServiceSupplier.java | 100 -- .../derfrzocker/ore/control/Permissions.java | 147 --- .../ore/control/PlayerJoinListener.java | 58 -- .../de/derfrzocker/ore/control/Settings.java | 215 ---- .../ore/control/WelcomeMessage.java | 180 ---- .../ore/control/command/CreateCommand.java | 93 -- .../ore/control/command/GuiCommand.java | 75 -- .../ore/control/command/InfoCommand.java | 89 -- .../command/NoCommandsAvailableCommand.java | 55 - .../control/command/OreControlCommand.java | 64 -- .../ore/control/command/ReloadCommand.java | 71 -- .../ore/control/command/WelcomeCommand.java | 120 --- .../control/command/set/SetBiomeCommand.java | 286 ------ .../ore/control/command/set/SetCommand.java | 51 - .../control/command/set/SetValueCommand.java | 250 ----- .../ore/control/gui/BiomeGroupGui.java | 169 ---- .../derfrzocker/ore/control/gui/BiomeGui.java | 203 ---- .../derfrzocker/ore/control/gui/OreGui.java | 322 ------ .../ore/control/gui/OreSettingsGui.java | 309 ------ .../ore/control/gui/SettingsGui.java | 323 ------ .../ore/control/gui/WorldConfigGui.java | 208 ---- .../derfrzocker/ore/control/gui/WorldGui.java | 298 ------ .../ore/control/gui/config/ConfigGui.java | 181 ---- .../ore/control/gui/config/LanguageGui.java | 89 -- .../ore/control/gui/copy/CopyAction.java | 71 -- .../control/gui/copy/CopyBiomesAction.java | 168 ---- .../ore/control/gui/copy/CopyOreAction.java | 281 ------ .../ore/control/gui/copy/CopyOresAction.java | 259 ----- .../control/gui/copy/CopySettingAction.java | 275 ----- .../gui/copy/CopyWorldOreConfigAction.java | 157 --- .../gui/settings/BiomeGuiSettings.java | 119 --- .../gui/settings/BooleanGuiSetting.java | 88 -- .../gui/settings/ConfigGuiSettings.java | 111 --- .../ore/control/gui/settings/GuiSettings.java | 308 ------ .../gui/settings/LanguageGuiSettings.java | 83 -- .../control/gui/settings/OreGuiSettings.java | 102 -- .../gui/settings/OreSettingsGuiSettings.java | 125 --- .../gui/settings/SettingsGuiSettings.java | 145 --- .../gui/settings/WorldConfigGuiSettings.java | 121 --- .../gui/settings/WorldGuiSettings.java | 90 -- .../ore/control/utils/BaseComponentUtil.java | 98 -- .../ore/control/utils/CopyUtil.java | 405 -------- .../ore/control/utils/OreControlUtil.java | 262 ----- .../ore/control/utils/OreControlValues.java | 105 -- .../ore/control/utils/ResetUtil.java | 167 ---- ore-control/src/main/resources/config.yml | 56 -- .../main/resources/data/gui/biome-groups.yml | 100 -- .../src/main/resources/data/gui/biome-gui.yml | 939 ------------------ .../resources/data/gui/biome-gui_v1.13.yml | 939 ------------------ .../resources/data/gui/biome-gui_v1.14.yml | 25 - .../resources/data/gui/biome-gui_v1.16.yml | 58 -- .../main/resources/data/gui/boolean-gui.yml | 88 -- .../main/resources/data/gui/config-gui.yml | 153 --- .../main/resources/data/gui/language-gui.yml | 119 --- .../src/main/resources/data/gui/ore-gui.yml | 163 --- .../main/resources/data/gui/ore-gui_v1.13.yml | 163 --- .../resources/data/gui/ore-settings-gui.yml | 320 ------ .../data/gui/ore-settings-gui_v1.13.yml | 320 ------ .../main/resources/data/gui/settings-gui.yml | 202 ---- .../main/resources/data/gui/verify-gui.yml | 61 -- .../resources/data/gui/world-config-gui.yml | 141 --- .../src/main/resources/data/gui/world-gui.yml | 144 --- .../resources/data/gui/world-gui_v1.13.yml | 144 --- .../src/main/resources/data/settings.yml | 203 ---- ore-control/src/main/resources/lang/de.yml | 402 -------- ore-control/src/main/resources/lang/en.yml | 391 -------- ore-control/src/main/resources/lang/zh.yml | 396 -------- ore-control/src/main/resources/messages.yml | 391 -------- ore-control/src/main/resources/plugin.yml | 110 +- pom.xml | 20 +- 234 files changed, 3611 insertions(+), 26381 deletions(-) rename api/src/main/java/de/derfrzocker/{ore/control/api/dao/WorldOreConfigDao.java => feature/api/Feature.java} (78%) create mode 100644 api/src/main/java/de/derfrzocker/feature/api/FeatureGenerator.java rename api/src/main/java/de/derfrzocker/{ore/control/api/ConfigType.java => feature/api/FeatureGeneratorConfiguration.java} (89%) rename impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedCombinedConfiguration.java => api/src/main/java/de/derfrzocker/feature/api/FeaturePlacementModifier.java (62%) create mode 100644 api/src/main/java/de/derfrzocker/feature/api/PlacementModifierConfiguration.java create mode 100644 api/src/main/java/de/derfrzocker/feature/api/Registries.java create mode 100644 api/src/main/java/de/derfrzocker/feature/api/Registry.java create mode 100644 api/src/main/java/de/derfrzocker/feature/api/Value.java create mode 100644 api/src/main/java/de/derfrzocker/feature/api/ValueType.java delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/BiomeOreSettings.java create mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/Config.java rename api/src/main/java/de/derfrzocker/ore/control/api/{NMSUtil.java => FeatureGeneratorHook.java} (61%) delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/GenerationHandler.java delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/NMSService.java delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/Ore.java create mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/OreControlRegistries.java delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/OreControlService.java delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/OreSettings.java create mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/PlacementModifierHook.java delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/Setting.java delete mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/WorldOreConfig.java create mode 100644 api/src/main/java/de/derfrzocker/ore/control/api/dao/ConfigDao.java rename {impl/yaml => common}/pom.xml (72%) rename impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeCombinedConfiguration.java => common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatType.java (61%) rename impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedCombinedConfiguration.java => common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatValue.java (63%) rename impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeCombinedConfiguration.java => common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerType.java (60%) rename impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedCombinedConfiguration.java => common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerValue.java (63%) rename api/src/main/java/de/derfrzocker/ore/control/api/Dimension.java => common/src/main/java/de/derfrzocker/feature/common/value/number/FloatType.java (89%) create mode 100644 common/src/main/java/de/derfrzocker/feature/common/value/number/FloatValue.java create mode 100644 common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerType.java create mode 100644 common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerValue.java create mode 100644 common/src/main/java/de/derfrzocker/feature/common/value/number/NumberType.java create mode 100644 common/src/main/java/de/derfrzocker/feature/common/value/number/NumberValue.java delete mode 100644 impl/service/pom.xml delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/NMSServiceImpl.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/OreControlServiceImpl.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/EmeraldGenerationHandler.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/LapisGenerationHandler.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/MagmaGenerationHandler.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherAncientDebrisGenerationHandler.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherNormalOreGenerationHandler.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NormalOreGenerationHandler.java delete mode 100644 impl/service/src/main/java/de/derfrzocker/ore/control/utils/GenerationUtil.java delete mode 100644 impl/v1_13_R1/lib/spigot-1.13-simple.jar delete mode 100644 impl/v1_13_R1/pom.xml delete mode 100644 impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSReplacer_v1_13_R1.java delete mode 100644 impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSUtil_v1_13_R1.java delete mode 100644 impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorEmeraldOverrider_v1_13_R1.java delete mode 100644 impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorHeightAverageOverrider_v1_13_R1.java delete mode 100644 impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R1.java delete mode 100644 impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1.java delete mode 100644 impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherMagmaOverrider_v1_13_R1.java delete mode 100644 impl/v1_13_R2/pom.xml delete mode 100644 impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSReplacer1_13_R2.java delete mode 100644 impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSUtil_v1_13_R2.java delete mode 100644 impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorEmeraldOverrider_v1_13_R2.java delete mode 100644 impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorHeightAverageOverrider_v1_13_R2.java delete mode 100644 impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R2.java delete mode 100644 impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2.java delete mode 100644 impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherMagmaOverrider_v1_13_R2.java delete mode 100644 impl/v1_14_R1/pom.xml delete mode 100644 impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSReplacer_v1_14_R1.java delete mode 100644 impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSUtil_v1_14_R1.java delete mode 100644 impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorEmeraldOverrider_v1_14_R1.java delete mode 100644 impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorHeightAverageOverrider_v1_14_R1.java delete mode 100644 impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_14_R1.java delete mode 100644 impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1.java delete mode 100644 impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherMagmaOverrider_v1_14_R1.java delete mode 100644 impl/v1_15_R1/pom.xml delete mode 100644 impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSReplacer_v1_15_R1.java delete mode 100644 impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSUtil_v1_15_R1.java delete mode 100644 impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorEmeraldOverrider_v1_15_R1.java delete mode 100644 impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorHeightAverageOverrider_v1_15_R1.java delete mode 100644 impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_15_R1.java delete mode 100644 impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1.java delete mode 100644 impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherMagmaOverrider_v1_15_R1.java delete mode 100644 impl/v1_16_R1/pom.xml delete mode 100644 impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSReplacer_v1_16_R1.java delete mode 100644 impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSUtil_v1_16_R1.java delete mode 100644 impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorEmeraldOverrider_v1_16_R1.java delete mode 100644 impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorHeightAverageOverrider_v1_16_R1.java delete mode 100644 impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_16_R1.java delete mode 100644 impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1.java delete mode 100644 impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherMagmaOverrider_v1_16_R1.java delete mode 100644 impl/v1_16_R2/pom.xml delete mode 100644 impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedWorldGeneratorOverrider.java delete mode 100644 impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/EmeraldWorldGeneratorOverrider.java delete mode 100644 impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/MagmaWorldGeneratorOverrider.java delete mode 100644 impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSReplacer_v1_16_R2.java delete mode 100644 impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSUtil_v1_16_R2.java delete mode 100644 impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeWorldGeneratorOverrider.java delete mode 100644 impl/v1_16_R3/pom.xml delete mode 100644 impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedWorldGeneratorOverrider.java delete mode 100644 impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/EmeraldWorldGeneratorOverrider.java delete mode 100644 impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/MagmaWorldGeneratorOverrider.java delete mode 100644 impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSReplacer_v1_16_R3.java delete mode 100644 impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSUtil_v1_16_R3.java delete mode 100644 impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeWorldGeneratorOverrider.java delete mode 100644 impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedWorldGeneratorOverrider.java delete mode 100644 impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/EmeraldWorldGeneratorOverrider.java delete mode 100644 impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/MagmaWorldGeneratorOverrider.java delete mode 100644 impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSReplacer_v1_17_R1.java delete mode 100644 impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSUtil_v1_17_R1.java delete mode 100644 impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeWorldGeneratorOverrider.java rename impl/{v1_17_R1 => v1_18_R1}/pom.xml (83%) create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/MinecraftFeatureGenerator.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/OreFeatureGenerator.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/configuration/OreFeatureConfiguration.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/CountModifier.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/HeightRangeModifier.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/MinecraftPlacementModifier.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/RarityModifier.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifier.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceWaterDepthModifier.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/CountModifierConfiguration.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/HeightRangeModifierConfiguration.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/RarityModifierConfiguration.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceRelativeThresholdModifierConfiguration.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceWaterDepthModifierConfiguration.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapType.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapValue.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapType.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapValue.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderType.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderValue.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderType.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderValue.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderType.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderValue.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderType.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderValue.java rename impl/{yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao_Old.java => v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetType.java} (56%) create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetValue.java rename impl/{v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeCombinedConfiguration.java => v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetType.java} (64%) create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetValue.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/NMSReplacer_v1_18_R1.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/MinecraftFeatureGeneratorHook.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/OreFeatureGeneratorHook.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/CountModifierHook.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/HeightRangeModifierHook.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/MinecraftPlacementModifierHook.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/RarityModifierHook.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifierHook.java create mode 100644 impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceWaterDepthModifierHook.java delete mode 100644 impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/BiomeOreSettingsYamlImpl.java delete mode 100644 impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImpl.java delete mode 100644 impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/WorldOreConfigYamlImpl.java delete mode 100644 impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/LazyWorldOreConfigCache.java delete mode 100644 impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao.java delete mode 100644 impl/yaml/src/test/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImplTest.java delete mode 100644 metrics/pom.xml delete mode 100644 metrics/src/main/java/de/derfrzocker/ore/control/OreControlMetrics.java delete mode 100644 ore-control-lite/pom.xml delete mode 100644 ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlLite.java delete mode 100644 ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java delete mode 100644 ore-control-lite/src/main/java/de/derfrzocker/ore/control/Settings.java delete mode 100644 ore-control-lite/src/main/resources/data/settings.yml delete mode 100644 ore-control-lite/src/main/resources/plugin.yml delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/ConfigValues.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/OreControlMessages.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/Permissions.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/PlayerJoinListener.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/Settings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/WelcomeMessage.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/CreateCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/GuiCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/InfoCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/NoCommandsAvailableCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/OreControlCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/ReloadCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/WelcomeCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetBiomeCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetValueCommand.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGroupGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreSettingsGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/SettingsGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldConfigGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/ConfigGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/LanguageGui.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyAction.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyBiomesAction.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOreAction.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOresAction.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopySettingAction.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyWorldOreConfigAction.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BiomeGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BooleanGuiSetting.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/ConfigGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/GuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/LanguageGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreSettingsGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/SettingsGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldConfigGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldGuiSettings.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/utils/BaseComponentUtil.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/utils/CopyUtil.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlUtil.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlValues.java delete mode 100644 ore-control/src/main/java/de/derfrzocker/ore/control/utils/ResetUtil.java delete mode 100644 ore-control/src/main/resources/config.yml delete mode 100644 ore-control/src/main/resources/data/gui/biome-groups.yml delete mode 100644 ore-control/src/main/resources/data/gui/biome-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/biome-gui_v1.13.yml delete mode 100644 ore-control/src/main/resources/data/gui/biome-gui_v1.14.yml delete mode 100644 ore-control/src/main/resources/data/gui/biome-gui_v1.16.yml delete mode 100644 ore-control/src/main/resources/data/gui/boolean-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/config-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/language-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/ore-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/ore-gui_v1.13.yml delete mode 100644 ore-control/src/main/resources/data/gui/ore-settings-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/ore-settings-gui_v1.13.yml delete mode 100644 ore-control/src/main/resources/data/gui/settings-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/verify-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/world-config-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/world-gui.yml delete mode 100644 ore-control/src/main/resources/data/gui/world-gui_v1.13.yml delete mode 100644 ore-control/src/main/resources/data/settings.yml delete mode 100644 ore-control/src/main/resources/lang/de.yml delete mode 100644 ore-control/src/main/resources/lang/en.yml delete mode 100644 ore-control/src/main/resources/lang/zh.yml delete mode 100644 ore-control/src/main/resources/messages.yml diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/dao/WorldOreConfigDao.java b/api/src/main/java/de/derfrzocker/feature/api/Feature.java similarity index 78% rename from api/src/main/java/de/derfrzocker/ore/control/api/dao/WorldOreConfigDao.java rename to api/src/main/java/de/derfrzocker/feature/api/Feature.java index 0b87b6e9..c7a37351 100644 --- a/api/src/main/java/de/derfrzocker/ore/control/api/dao/WorldOreConfigDao.java +++ b/api/src/main/java/de/derfrzocker/feature/api/Feature.java @@ -23,15 +23,15 @@ * */ -package de.derfrzocker.ore.control.api.dao; +package de.derfrzocker.feature.api; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.spigot.utils.dao.BasicDao; -import org.jetbrains.annotations.NotNull; +import org.bukkit.Keyed; -public interface WorldOreConfigDao extends BasicDao { +import java.util.List; - @NotNull - WorldOreConfig getGlobalWorldOreConfig(); +public interface Feature extends Keyed { + List getPlacementPositions(); + + FeatureGenerator getGenerator(); } diff --git a/api/src/main/java/de/derfrzocker/feature/api/FeatureGenerator.java b/api/src/main/java/de/derfrzocker/feature/api/FeatureGenerator.java new file mode 100644 index 00000000..034e0393 --- /dev/null +++ b/api/src/main/java/de/derfrzocker/feature/api/FeatureGenerator.java @@ -0,0 +1,44 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.api; + +import com.mojang.serialization.Codec; +import org.bukkit.Keyed; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Random; + +public interface FeatureGenerator extends Keyed { + + Codec getCodec(); + + C merge(FeatureGeneratorConfiguration first, FeatureGeneratorConfiguration second); + + void place(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration); +} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/ConfigType.java b/api/src/main/java/de/derfrzocker/feature/api/FeatureGeneratorConfiguration.java similarity index 89% rename from api/src/main/java/de/derfrzocker/ore/control/api/ConfigType.java rename to api/src/main/java/de/derfrzocker/feature/api/FeatureGeneratorConfiguration.java index ebaca1f8..83fe9dff 100644 --- a/api/src/main/java/de/derfrzocker/ore/control/api/ConfigType.java +++ b/api/src/main/java/de/derfrzocker/feature/api/FeatureGeneratorConfiguration.java @@ -23,10 +23,10 @@ * */ -package de.derfrzocker.ore.control.api; +package de.derfrzocker.feature.api; -public enum ConfigType { +public interface FeatureGeneratorConfiguration { - OVERWORLD, NETHER, TEMPLATE, GLOBAL, UNKNOWN + FeatureGenerator getFeatureGenerator(); } diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedCombinedConfiguration.java b/api/src/main/java/de/derfrzocker/feature/api/FeaturePlacementModifier.java similarity index 62% rename from impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedCombinedConfiguration.java rename to api/src/main/java/de/derfrzocker/feature/api/FeaturePlacementModifier.java index 79b90d80..7caa76a7 100644 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedCombinedConfiguration.java +++ b/api/src/main/java/de/derfrzocker/feature/api/FeaturePlacementModifier.java @@ -23,29 +23,23 @@ * */ -package de.derfrzocker.ore.control.impl.v1_16_R2; +package de.derfrzocker.feature.api; -import net.minecraft.server.v1_16_R2.WorldGenDecoratorHeightAverageConfiguration; +import com.mojang.serialization.Codec; +import org.bukkit.Keyed; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; import org.jetbrains.annotations.NotNull; -public class DepthAveragedCombinedConfiguration { +import java.util.Random; +import java.util.stream.Stream; - private final int veinCount; - @NotNull - private final WorldGenDecoratorHeightAverageConfiguration configuration; +public interface FeaturePlacementModifier extends Keyed { - public DepthAveragedCombinedConfiguration(final int veinCount, @NotNull final WorldGenDecoratorHeightAverageConfiguration configuration) { - this.veinCount = veinCount; - this.configuration = configuration; - } + Codec getCodec(); - public int getVeinCount() { - return this.veinCount; - } - - @NotNull - public WorldGenDecoratorHeightAverageConfiguration getConfiguration() { - return configuration; - } + C merge(PlacementModifierConfiguration first, PlacementModifierConfiguration second); + Stream getPositions(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration); } diff --git a/api/src/main/java/de/derfrzocker/feature/api/PlacementModifierConfiguration.java b/api/src/main/java/de/derfrzocker/feature/api/PlacementModifierConfiguration.java new file mode 100644 index 00000000..fa5844ad --- /dev/null +++ b/api/src/main/java/de/derfrzocker/feature/api/PlacementModifierConfiguration.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.api; + +public interface PlacementModifierConfiguration { + + FeaturePlacementModifier getPlacementModifier(); + +} diff --git a/api/src/main/java/de/derfrzocker/feature/api/Registries.java b/api/src/main/java/de/derfrzocker/feature/api/Registries.java new file mode 100644 index 00000000..ad5e93e2 --- /dev/null +++ b/api/src/main/java/de/derfrzocker/feature/api/Registries.java @@ -0,0 +1,53 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.api; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class Registries { + + private final Registry> featureRegistry = new Registry<>(); + private final Registry> featureGeneratorRegistry = new Registry<>(); + private final Registry> placementModifierRegistry = new Registry<>(); + private final Map, Registry> valueTypeRegistry = new LinkedHashMap<>(); + + public Registry> getFeatureRegistry() { + return featureRegistry; + } + + public Registry> getFeatureGeneratorRegistry() { + return featureGeneratorRegistry; + } + + public Registry> getPlacementModifierRegistry() { + return placementModifierRegistry; + } + + public > Registry getValueTypeRegistry(Class clazz) { + return (Registry) valueTypeRegistry.computeIfAbsent(clazz, aClass -> new Registry<>()); + } +} diff --git a/api/src/main/java/de/derfrzocker/feature/api/Registry.java b/api/src/main/java/de/derfrzocker/feature/api/Registry.java new file mode 100644 index 00000000..c1b5550a --- /dev/null +++ b/api/src/main/java/de/derfrzocker/feature/api/Registry.java @@ -0,0 +1,81 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.api; + +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.DynamicOps; +import com.mojang.serialization.Lifecycle; +import org.bukkit.Keyed; +import org.bukkit.NamespacedKey; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; + +public class Registry implements Codec { + + public static final Codec KEY_GODEC = Codec.STRING.comapFlatMap(value -> { + if (value == null || value.isEmpty()) { + return DataResult.error("Value is null or empty"); + } + NamespacedKey namespacedKey = NamespacedKey.fromString(value); + if (namespacedKey == null) { + return DataResult.error("Value " + value + " could not be parsed to a NamespaceKey"); + } + + return DataResult.success(namespacedKey); + }, NamespacedKey::toString); + + private final Map values = new LinkedHashMap<>(); + + public Optional get(NamespacedKey key) { + return Optional.ofNullable(values.get(key)); + } + + public void register(V value) { + values.put(value.getKey(), value); + } + + public Map getValues() { + return values; + } + + @Override + public DataResult> decode(DynamicOps ops, T input) { + return KEY_GODEC. + decode(ops, input). + flatMap(result -> get(result.getFirst()). + map(v -> DataResult.success(Pair.of(v, result.getSecond()), Lifecycle.experimental())). + orElseGet(() -> DataResult.error("No value for key " + result.getFirst() + " registerd"))); + } + + @Override + public DataResult encode(V input, DynamicOps ops, T prefix) { + return ops.mergeToPrimitive(prefix, ops.createString(input.getKey().toString())).setLifecycle(Lifecycle.experimental()); + } +} diff --git a/api/src/main/java/de/derfrzocker/feature/api/Value.java b/api/src/main/java/de/derfrzocker/feature/api/Value.java new file mode 100644 index 00000000..7af499d7 --- /dev/null +++ b/api/src/main/java/de/derfrzocker/feature/api/Value.java @@ -0,0 +1,40 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.api; + +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Random; + +public interface Value, T extends ValueType, O> { + + T getValueType(); + + O getValue(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion); +} diff --git a/api/src/main/java/de/derfrzocker/feature/api/ValueType.java b/api/src/main/java/de/derfrzocker/feature/api/ValueType.java new file mode 100644 index 00000000..ec165951 --- /dev/null +++ b/api/src/main/java/de/derfrzocker/feature/api/ValueType.java @@ -0,0 +1,36 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.api; + +import com.mojang.serialization.Codec; +import org.bukkit.Keyed; + +public interface ValueType, T extends ValueType, O> extends Keyed { + + Codec getCodec(); + + Class getTypeClass(); +} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/Biome.java b/api/src/main/java/de/derfrzocker/ore/control/api/Biome.java index e33e796a..7964e6bc 100644 --- a/api/src/main/java/de/derfrzocker/ore/control/api/Biome.java +++ b/api/src/main/java/de/derfrzocker/ore/control/api/Biome.java @@ -25,145 +25,21 @@ package de.derfrzocker.ore.control.api; -import de.derfrzocker.spigot.utils.Version; +import org.bukkit.Keyed; +import org.bukkit.NamespacedKey; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -public enum Biome { +public class Biome implements Keyed { - OCEAN, - PLAINS, - DESERT, - MOUNTAINS(Ore.EMERALD, Ore.INFESTED_STONE), - FOREST, - TAIGA, - SWAMP, - RIVER, - FROZEN_OCEAN, - FROZEN_RIVER, - SNOWY_TUNDRA, - SNOWY_MOUNTAINS, - MUSHROOM_FIELDS, - MUSHROOM_FIELD_SHORE, - BEACH, - DESERT_HILLS, - WOODED_HILLS, - TAIGA_HILLS, - MOUNTAIN_EDGE(Ore.EMERALD, Ore.INFESTED_STONE), - JUNGLE, - JUNGLE_HILLS, - JUNGLE_EDGE, - DEEP_OCEAN, - STONE_SHORE, - SNOWY_BEACH, - BIRCH_FOREST, - BIRCH_FOREST_HILLS, - DARK_FOREST, - SNOWY_TAIGA, - SNOWY_TAIGA_HILLS, - GIANT_TREE_TAIGA, - GIANT_TREE_TAIGA_HILLS, - WOODED_MOUNTAINS(Ore.EMERALD, Ore.INFESTED_STONE), - SAVANNA, - SAVANNA_PLATEAU, - BADLANDS(Ore.GOLD_BADLANDS), - WOODED_BADLANDS_PLATEAU(Ore.GOLD_BADLANDS), - BADLANDS_PLATEAU(Ore.GOLD_BADLANDS), - WARM_OCEAN, - LUKEWARM_OCEAN, - COLD_OCEAN, - DEEP_WARM_OCEAN, - DEEP_LUKEWARM_OCEAN, - DEEP_COLD_OCEAN, - DEEP_FROZEN_OCEAN, - SUNFLOWER_PLAINS, - DESERT_LAKES, - GRAVELLY_MOUNTAINS(Ore.EMERALD, Ore.INFESTED_STONE), - FLOWER_FOREST, - TAIGA_MOUNTAINS, - SWAMP_HILLS, - ICE_SPIKES, - MODIFIED_JUNGLE, - MODIFIED_JUNGLE_EDGE, - TALL_BIRCH_FOREST, - TALL_BIRCH_HILLS, - DARK_FOREST_HILLS, - SNOWY_TAIGA_MOUNTAINS, - GIANT_SPRUCE_TAIGA, - GIANT_SPRUCE_TAIGA_HILLS, - MODIFIED_GRAVELLY_MOUNTAINS(Ore.EMERALD, Ore.INFESTED_STONE), - SHATTERED_SAVANNA, - SHATTERED_SAVANNA_PLATEAU, - ERODED_BADLANDS(Ore.GOLD_BADLANDS), - MODIFIED_WOODED_BADLANDS_PLATEAU(Ore.GOLD_BADLANDS), - MODIFIED_BADLANDS_PLATEAU(Ore.GOLD_BADLANDS), - BAMBOO_JUNGLE(Version.v1_14_R1), - BAMBOO_JUNGLE_HILLS(Version.v1_14_R1), - NETHER(Version.v1_13_R1, Version.v1_15_R1, Ore.DEFAULT_NETHER_ORES, Dimension.NETHER), - NETHER_WASTES(Version.v1_16_R1, null, Ore.DEFAULT_NETHER_ORES, Dimension.NETHER), - SOUL_SAND_VALLEY(Version.v1_16_R1, null, Ore.DEFAULT_NETHER_ORES, Dimension.NETHER), - CRIMSON_FOREST(Version.v1_16_R1, null, Ore.DEFAULT_NETHER_ORES, Dimension.NETHER), - WARPED_FOREST(Version.v1_16_R1, null, Ore.DEFAULT_NETHER_ORES, Dimension.NETHER), - BASALT_DELTAS(Version.v1_16_R1, null, Ore.DEFAULT_NETHER_ORES, Dimension.NETHER); + private final NamespacedKey key; - @NotNull - private final Version since; - @Nullable - private final Version until; - @NotNull - private final Ore[] ores; - @NotNull - private final Dimension dimension; - - Biome() { - this(Version.v1_13_R1, null, Ore.DEFAULT_OVERWORLD_ORES, Dimension.OVERWORLD); - } - - - Biome(@NotNull final Ore... ores) { - this(Version.v1_13_R1, null, combineOres(Ore.DEFAULT_OVERWORLD_ORES, ores), Dimension.OVERWORLD); - } - - Biome(@NotNull final Version since) { - this(since, null, Ore.DEFAULT_OVERWORLD_ORES, Dimension.OVERWORLD); - } - - Biome(@NotNull final Version since, @Nullable final Version until, @NotNull final Ore[] ores, @NotNull final Dimension dimension) { - this.since = since; - this.until = until; - this.ores = ores; - this.dimension = dimension; - } - - private static Ore[] combineOres(@NotNull final Ore[] ores, @NotNull final Ore... ores1) { - final int firstLength = ores.length; - final int secondLength = ores1.length; - final Ore[] result = new Ore[firstLength + secondLength]; - - System.arraycopy(ores, 0, result, 0, firstLength); - System.arraycopy(ores1, 0, result, firstLength, secondLength); - - return result; - } - - @NotNull - public Version getSince() { - return this.since; - } - - @Nullable - public Version getUntil() { - return this.until; - } - - @NotNull - public Ore[] getOres() { - return this.ores.clone(); + public Biome(NamespacedKey key) { + this.key = key; } @NotNull - public Dimension getDimension() { - return this.dimension; + @Override + public NamespacedKey getKey() { + return key; } - } diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/BiomeOreSettings.java b/api/src/main/java/de/derfrzocker/ore/control/api/BiomeOreSettings.java deleted file mode 100644 index 467288d9..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/BiomeOreSettings.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -import org.jetbrains.annotations.NotNull; - -import java.util.Map; -import java.util.Optional; - -/** - * The BiomeOreSettings class holds the different OreSettings for a specific biome, - * that are needed for the Ore Generation. - */ -public interface BiomeOreSettings extends Cloneable { - - /** - * @return the biome - */ - @NotNull - Biome getBiome(); - - /** - * If this BiomeOreSettings contains the OreSettings of the given Ore, - * it returns an Optional that contains the OreSettings, - * otherwise it return an empty Optional - * - * @param ore which must be non-null - * @return an Optional that hold the OreSettings of the given Ore, - * or an empty Optional if the BiomeOreSettings not contain the given Ore. - * @throws IllegalArgumentException if ore is null - */ - @NotNull - Optional getOreSettings(@NotNull Ore ore); - - /** - * @return the Map with all OreSettings this BiomeOreSetting have. - */ - @NotNull - Map getOreSettings(); - - /** - * Adds the given OreSetting to this BiomeOreSettings - * If a OreSettings for the ore already exits in this BiomeOreSetting, - * the given one will override the old one - * - * @param oreSettings to add - * @throws IllegalArgumentException if oreSettings is null - */ - void setOreSettings(@NotNull OreSettings oreSettings); - - /** - * Clones all OreSettings of this BiomeOreSettings to a new one. - * - * @return a new BiomeOreSettings - */ - @NotNull - BiomeOreSettings clone(); - -} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/Config.java b/api/src/main/java/de/derfrzocker/ore/control/api/Config.java new file mode 100644 index 00000000..64f569fb --- /dev/null +++ b/api/src/main/java/de/derfrzocker/ore/control/api/Config.java @@ -0,0 +1,49 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.api; + +import de.derfrzocker.feature.api.FeatureGeneratorConfiguration; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; + +import java.util.List; + +public class Config { + private final List placements; + private final FeatureGeneratorConfiguration feature; + + public Config(List placements, FeatureGeneratorConfiguration feature) { + this.placements = placements; + this.feature = feature; + } + + public List getPlacements() { + return placements; + } + + public FeatureGeneratorConfiguration getFeature() { + return feature; + } +} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/NMSUtil.java b/api/src/main/java/de/derfrzocker/ore/control/api/FeatureGeneratorHook.java similarity index 61% rename from api/src/main/java/de/derfrzocker/ore/control/api/NMSUtil.java rename to api/src/main/java/de/derfrzocker/ore/control/api/FeatureGeneratorHook.java index ae9f3614..a6a6586a 100644 --- a/api/src/main/java/de/derfrzocker/ore/control/api/NMSUtil.java +++ b/api/src/main/java/de/derfrzocker/ore/control/api/FeatureGeneratorHook.java @@ -25,29 +25,13 @@ package de.derfrzocker.ore.control.api; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; +import de.derfrzocker.feature.api.FeatureGenerator; +import de.derfrzocker.feature.api.FeatureGeneratorConfiguration; +import org.bukkit.Keyed; -public interface NMSUtil { +public interface FeatureGeneratorHook extends Keyed { - void replaceNMS(); + FeatureGenerator getFeatureGenerator(); - Biome getBiome(World world, ChunkCoordIntPair chunkCoordIntPair); - - Object createFeatureConfiguration(Object defaultFeatureConfiguration, int veinsSize); - - Object createCountConfiguration(int veinsPerChunk, int minimumHeight, int heightSubtractValue, int heightRange); - - Object createHeightAverageConfiguration(int veinsPerChunk, int heightCenter, int heightRange); - - Ore getOre(Object object); - - /** - * @param world to check - * @return the dimension of the given world - */ - @NotNull - Dimension getDimension(@NotNull World world); - -} \ No newline at end of file + Biome getBiome(); +} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/GenerationHandler.java b/api/src/main/java/de/derfrzocker/ore/control/api/GenerationHandler.java deleted file mode 100644 index fb2e5751..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/GenerationHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public interface GenerationHandler { - - /** - * Handles generation for the feature - * - * @param world to use - * @param worldOreConfig to use - * @param oreControlService to use - * @param biome to use - * @param ore to use - * @param chunkCoordIntPair to use - * @param defaultConfiguration to use - * @param defaultFeatureConfiguration to use - * @param generateFunction to use - * @param passFunction to use - * @param random to use - * @return true if generation is success other wise false - */ - boolean generate(@NotNull World world, @NotNull WorldOreConfig worldOreConfig, @NotNull OreControlService oreControlService, @NotNull Biome biome, @NotNull Ore ore, @NotNull ChunkCoordIntPair chunkCoordIntPair, - @NotNull Object defaultConfiguration, @NotNull Object defaultFeatureConfiguration, - @Nullable BiFunction generateFunction, @NotNull BiFunction passFunction, @NotNull Random random); - - -} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/NMSService.java b/api/src/main/java/de/derfrzocker/ore/control/api/NMSService.java deleted file mode 100644 index 58b52b2b..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/NMSService.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public interface NMSService { - - /** - * Hooks into Minecraft generation system - */ - void replaceNMS(); - - /** - * @return the NMSUtil to use - */ - @NotNull - NMSUtil getNMSUtil(); - - /** - * Register the given generationHandler to this NMSService - * If a generationHandler for the given Ore is already registered, - * it will override the old one with the new one - * - * @param ore to register - * @param generationHandler to register - * @throws IllegalArgumentException if ore or generationHandler is null - */ - void registerGenerationHandler(@NotNull Ore ore, @NotNull GenerationHandler generationHandler); - - /** - * Handles generation for the feature - * - * @param world to use - * @param biome to use - * @param ore to use - * @param chunkCoordIntPair to use - * @param defaultConfiguration to use - * @param defaultFeatureConfiguration to use - * @param generateFunction to use - * @param passFunction to use - * @param random to use - * @return true if generation is success other wise false - */ - boolean generate(@NotNull World world, @NotNull Biome biome, @NotNull Ore ore, @NotNull ChunkCoordIntPair chunkCoordIntPair, - @NotNull Object defaultConfiguration, @NotNull Object defaultFeatureConfiguration, - @Nullable BiFunction generateFunction, @NotNull BiFunction passFunction, @NotNull Random random); - -} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/Ore.java b/api/src/main/java/de/derfrzocker/ore/control/api/Ore.java deleted file mode 100644 index 6c73d6f3..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/Ore.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -import de.derfrzocker.spigot.utils.Version; -import org.bukkit.Material; -import org.jetbrains.annotations.NotNull; - -public enum Ore { - - DIAMOND(Material.DIAMOND_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - COAL(Material.COAL_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - GOLD(Material.GOLD_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - GOLD_BADLANDS(Material.GOLD_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - LAPIS(Material.LAPIS_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_DEPTH_AVERAGE_SETTINGS)), - IRON(Material.IRON_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - REDSTONE(Material.REDSTONE_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - EMERALD(Material.EMERALD_ORE, Setting.DEFAULT_EMERALD_ORE_SETTINGS), - DIRT(Material.DIRT, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - GRAVEL(Material.GRAVEL, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - GRANITE(Material.GRANITE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - DIORITE(Material.DIORITE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - ANDESITE(Material.ANDESITE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - NETHER_QUARTZ(Version.v1_13_R1, Material.NETHER_QUARTZ_ORE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.NETHER_COUNT_RANGE_SETTINGS), Dimension.NETHER), - INFESTED_STONE(Material.INFESTED_STONE, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_RANGE_SETTINGS)), - MAGMA(Version.v1_13_R1, Material.MAGMA_BLOCK, combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_MAGMA_SETTINGS), Dimension.NETHER), - NETHER_GOLD(Version.v1_16_R1, "NETHER_GOLD_ORE", combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.NETHER_COUNT_RANGE_SETTINGS), Dimension.NETHER), - ANCIENT_DEBRIS(Version.v1_16_R1, "ANCIENT_DEBRIS", combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.NETHER_COUNT_RANGE_SETTINGS), Dimension.NETHER), - ANCIENT_DEBRIS_2(Version.v1_16_R1, "ANCIENT_DEBRIS", combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.NETHER_COUNT_DEPTH_AVERAGE_SETTINGS), Dimension.NETHER), - COPPER(Version.v1_17_R1, "COPPER_ORE", combineSettings(Setting.DEFAULT_ORE_SETTINGS, Setting.DEFAULT_COUNT_DEPTH_AVERAGE_SETTINGS), Dimension.OVERWORLD); - - final static Ore[] DEFAULT_OVERWORLD_ORES = new Ore[]{ - ANDESITE, - COAL, - DIAMOND, - DIORITE, - DIRT, - GOLD, - GRANITE, - GRAVEL, - IRON, - LAPIS, - REDSTONE, - COPPER - }; - - final static Ore[] DEFAULT_NETHER_ORES = new Ore[]{ - NETHER_QUARTZ, - MAGMA, - NETHER_GOLD, - ANCIENT_DEBRIS, - ANCIENT_DEBRIS_2 - }; - - @NotNull - private final Version since; - @NotNull - private final Material material; - @NotNull - private final Setting[] settings; - @NotNull - private final Dimension dimension; - - Ore(@NotNull final Material material, @NotNull final Setting[] settings) { - this(Version.v1_13_R1, material, settings, Dimension.OVERWORLD); - } - - Ore(@NotNull final Version since, @NotNull final Material material, @NotNull final Setting[] settings, @NotNull final Dimension dimension) { - this.since = since; - this.material = material; - this.settings = settings; - this.dimension = dimension; - } - - Ore(@NotNull final Version since, @NotNull final String material, @NotNull final Setting[] settings, @NotNull final Dimension dimension) { - this.since = since; - - Material tempMaterial; - - try { - tempMaterial = Material.valueOf(material); - } catch (IllegalArgumentException e) { - tempMaterial = Material.COAL; - } - - this.material = tempMaterial; - this.settings = settings; - this.dimension = dimension; - } - - private static Setting[] combineSettings(@NotNull final Setting[] settings, @NotNull final Setting... settings1) { - final int firstLength = settings.length; - final int secondLength = settings1.length; - final Setting[] result = new Setting[firstLength + secondLength]; - - System.arraycopy(settings, 0, result, 0, firstLength); - System.arraycopy(settings1, 0, result, firstLength, secondLength); - - return result; - } - - @NotNull - public Version getSince() { - return since; - } - - @NotNull - public Setting[] getSettings() { - return this.settings.clone(); - } - - @NotNull - public Material getMaterial() { - return this.material; - } - - @NotNull - public Dimension getDimension() { - return this.dimension; - } - -} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/OreControlRegistries.java b/api/src/main/java/de/derfrzocker/ore/control/api/OreControlRegistries.java new file mode 100644 index 00000000..86a09716 --- /dev/null +++ b/api/src/main/java/de/derfrzocker/ore/control/api/OreControlRegistries.java @@ -0,0 +1,38 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.api; + +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.api.Registry; + +public class OreControlRegistries extends Registries { + + private final Registry biomeRegistry = new Registry<>(); + + public Registry getBiomeRegistry() { + return biomeRegistry; + } +} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/OreControlService.java b/api/src/main/java/de/derfrzocker/ore/control/api/OreControlService.java deleted file mode 100644 index f4d2d878..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/OreControlService.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Optional; -import java.util.Set; - -public interface OreControlService { - - /** - * @return the NMSService - */ - @NotNull - NMSService getNMSService(); - - /** - * If a WorldOreConfig for the given world exist - * it returns an Optional which contains the WorldOreConfig, - * Otherwise it return an empty Optional - * - * @param world of the WorldOreConfig - * @return an Optional that hold the value for the given world, - * or an empty Optional if the WorldOreConfig doesn't exist - * @throws IllegalArgumentException if world is null - */ - @NotNull - Optional getWorldOreConfig(@NotNull World world); - - /** - * If a WorldOreConfig with the given name exist - * it returns an Optional which contains the WorldOreConfig, - * Otherwise it return an empty Optional - * - * @param name the name of the WorldOreConfig - * @return an Optional that hold the value of the given name, - * or an empty Optional if the WorldOreConfig doesn't exist - * @throws IllegalArgumentException if name is null - */ - @NotNull - Optional getWorldOreConfig(@NotNull String name); - - /** - * The values in this WorldOreConfig are used when no other value is specific in a - * World specific WorldOreConfig - *

- * The name of the WorldOreConfig is "Default" - * - * @return the default WorldOreConfig - */ - @NotNull - WorldOreConfig getGlobalWorldOreConfig(); - - /** - * Creates a new WorldOreConfig for the given world. - * The create WorldOreConfig gets automatically saved to disk, - * this is done in the called Thread, it is not recommend to call this method from Minecraft's main Thread. - *

- * If a WorldOreConfig for the world already exists, it will override the old one with the new one. - * - * @param world to create for - * @return a new WorldOreConfig - * @throws IllegalArgumentException if world is null - */ - @NotNull - WorldOreConfig createWorldOreConfig(@NotNull World world); - - /** - * Creates a new WorldOreConfig with the given name. - * The create WorldOreConfig gets automatically saved to disk, - * this is done in the called Thread, it is not recommend to call this method from Minecraft's main Thread. - *

- * If a WorldOreConfig with the same name already exists, it will override the old one with the new one. - * - * @param name of the template - * @return a new WorldOreConfig - * @throws IllegalArgumentException if name is null, empty or only contains spaces - */ - @NotNull - WorldOreConfig createWorldOreConfigTemplate(@NotNull String name); - - /** - * Saves the given WorldOreConfig to disk, - * this is done in the called Thread, it is not recommend to call this method from Minecraft's main Thread - * - * @param worldOreConfig to save - * @throws IllegalArgumentException if worldOreConfig is null - */ - void saveWorldOreConfig(@NotNull WorldOreConfig worldOreConfig); - - /** - * Removes the given WorldOreConfig - * - * @param worldOreConfig to remove - * @throws IllegalArgumentException if worldOreConfig is null - */ - void removeWorldOreConfig(@NotNull WorldOreConfig worldOreConfig); - - /** - * @return a new set which contains all known WorldOreConfigs - */ - @NotNull - Set getAllWorldOreConfigs(); - - - /** - * Returns the default value for the given Ore and Setting. - *

- * The default value is not the value from the default WorldOreConfig, but the value which Minecraft use - * - * @param ore which must be non-null - * @param setting which must be non-null - * @return the default value - * @throws IllegalArgumentException if ore or setting is null - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - double getDefaultValue(@NotNull Ore ore, @NotNull Setting setting); - - /** - * Returns the default value for the given Biome, Ore and Setting. - *

- * If no default value for the given values is present, it will return - * the default value for only the Ore and Setting. - *

- * The default value is not the value of the Default WorldOreConfig, but the value which Minecraft use - * - * @param biome which must be non-null - * @param ore which must be non-null - * @param setting which must be non-null - * @return the default value - * @throws IllegalArgumentException if ore or setting is null - * @throws IllegalArgumentException if the Biome dont have the given Ore - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - double getDefaultValue(@NotNull Biome biome, @NotNull Ore ore, @NotNull Setting setting); - - /** - * Returns the value for the given Setting from the given WorldOreConfig, Biome and Ore. - * If the WorldOreConfig dont have the BiomeOreSettings of the given Biomes or the BiomeOreSettings dont have the - * OreSettings for the Ore, it checks if the WorldOreConfig have the OreSettings - * of the given Ore. If the WorldOreConfig have the OreSettings it checks if it also have the given Setting. If true it returns the value. - * otherwise it while check in the default WorldOreConfig, if the default WorldOreConfig dont have a value too, than it will return the default value. - *

- * This means the Priority is: "Biome specific settings" -> "Ore specific settings" - * -> "Default WorldOreConfig Biome specific settings" -> "Default WorldOreConfig Ore specific settings" ->"default settings" - *

- * To see which Biome have which Ore see: {@link Biome#getOres()} - * To see which Ore have which Setting see: {@link Ore#getSettings()} - * - * @param worldOreConfig which must be non-null - * @param biome which must be non-null - * @param ore which must be non-null - * @param setting which must be non-null - * @return the value if present or the default value. - * @throws IllegalArgumentException if worldOreConfig, biome, ore or setting is null - * @throws IllegalArgumentException if the Biome dont have the given Ore - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - double getValue(@NotNull WorldOreConfig worldOreConfig, @NotNull Biome biome, @NotNull Ore ore, @NotNull Setting setting); - - /** - * Returns the value for the given Setting from the given WorldOreConfig and Ore. - * If the WorldOreConfig dont have the OreSettings of the given Ore it returns the default value. - * If the OreSettings dont have the Setting, but the Ore have it, than it while check the default WorldOreConfig, if it dont have a value too, than it will return the default value - *

- * To see which Ore have which Setting see: {@link Ore#getSettings()} - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @param setting which must be non-null - * @return the value if present or the default value. - * @throws IllegalArgumentException if worldOreConfig, ore or setting is null - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - double getValue(@NotNull WorldOreConfig worldOreConfig, @NotNull Ore ore, @NotNull Setting setting); - - /** - * This set the value to the given Ore, Setting and Biome in the given WorldOreConfig - * If the WorldOreConfig dont have the BiomeOreSettings for the given value it creates a new one. - * If the BiomeOreSettings dont have the OreSettings for the given Ore it create a new one - *

- * To see which Biome have which Ore see: {@link Biome#getOres()} - * To see which Ore have which Setting see: {@link Ore#getSettings()} - * - * @param worldOreConfig which must be non-null - * @param biome which must be non-null - * @param ore which must be non-null - * @param setting which must be non-null - * @param value to set - * @throws IllegalArgumentException if worldOreConfig, biome, ore or setting is null - * @throws IllegalArgumentException if the Biome dont have the given Ore - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - void setValue(@NotNull WorldOreConfig worldOreConfig, @NotNull Biome biome, @NotNull Ore ore, @NotNull Setting setting, double value); - - /** - * This set the value to the given Ore and Setting in the given WorldOreConfig - * If the WorldOreConfig dont have the OreSetting for the given value it creates a new one. - *

- * To see which Ore have which Setting see: {@link Ore#getSettings()} - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @param setting which must be non-null - * @param value to set - * @throws IllegalArgumentException if worldOreConfig, ore or setting is null - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - void setValue(@NotNull WorldOreConfig worldOreConfig, @NotNull Ore ore, @NotNull Setting setting, double value); - - /** - * Checks if the given Ore is in the given Biome activated or not. - * If the WorldOreConfig dont have the BiomeOreSettings or the BiomeOreSettings dont have the OreSettings, - * than it checks the normal OreSettings, if this Settings also not exists, it while check the default WorldOreConfig for the OreSetting, - * if the default WorldOreConfig have no OreSetting too, than it returns true. - * - * @param worldOreConfig which must be non-null - * @param biome which must be non-null - * @param ore which must be non-null - * @return true if activated false if not - * @throws IllegalArgumentException if worldOreConfig, biome or ore is null - * @throws IllegalArgumentException if the Biome dont have the given Ore - */ - boolean isActivated(@NotNull WorldOreConfig worldOreConfig, @NotNull Biome biome, @NotNull Ore ore); - - /** - * Checks if the given Ore is activated or not. - * If the WorldOreConfig dont have the OreSettings and the default WorldOreConfig to, than it returns true. - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @return true if activated false if not - * @throws IllegalArgumentException if worldOreConfig or ore is null - */ - boolean isActivated(@NotNull WorldOreConfig worldOreConfig, @NotNull Ore ore); - - /** - * Set the given status to the OreSettings in the BiomeOreSettings in. - * If the WorldOreConfig dont have the BiomeOreSettings or the BiomeOreSettings dont have the OreSettings, than it create new ones. - * - * @param worldOreConfig which must be non-null - * @param biome which must be non-null - * @param ore which must be non-null - * @param status true for activated false for not activated - * @throws IllegalArgumentException if worldOreConfig, biome or ore is null - * @throws IllegalArgumentException if the Biome dont have the given Ore - */ - void setActivated(@NotNull WorldOreConfig worldOreConfig, @NotNull Biome biome, @NotNull Ore ore, boolean status); - - /** - * Set the given status to the OreSettings. If the WorldOreConfig dont have the OreSettings it created a new one and - * set the value to the new OreSettings. - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @param status true for activated false for not activated - * @throws IllegalArgumentException if Ore or WorldOreConfig is null - */ - void setActivated(@NotNull WorldOreConfig worldOreConfig, @NotNull Ore ore, boolean status); - -} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/OreSettings.java b/api/src/main/java/de/derfrzocker/ore/control/api/OreSettings.java deleted file mode 100644 index 3eca2029..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/OreSettings.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -import org.jetbrains.annotations.NotNull; - -import java.util.Map; -import java.util.Optional; - -/** - * The OreSettings class holds the different Settings for the Ores, - * that are needed for the Ore Generation. - */ -public interface OreSettings extends Cloneable { - - /** - * @return the Ore - */ - @NotNull - Ore getOre(); - - /** - * If this OreSettings contains the value of the given Setting, - * it returns an Optional that contains the value, - * otherwise it return an empty Optional. - * - * @param setting which must be non-null - * @return an Optional that hold the value of the given Setting, - * or an empty Optional if the OreSetting not contain the given Setting. - * @throws IllegalArgumentException if setting is null - */ - @NotNull - Optional getValue(@NotNull Setting setting); - - /** - * This adds the given Setting with the given value to this OreSettings. - * If this Object already have a value for the given Setting, - * than it replaced the old value with given value. - * - * @param setting which must be non-null - * @param value for the given Setting - * @throws IllegalArgumentException if setting is null - */ - void setValue(@NotNull Setting setting, double value); - - /** - * @return the Map with all Settings and values that this OreSettings have. - */ - @NotNull - Map getSettings(); - - /** - * Return if this Ore should be generated or not. - * - * @return true if the Ore should generated, - * false if not. - */ - boolean isActivated(); - - /** - * Set if the Ore of this OreSetting should be generated or not. - * - * @param status true for generate, false for not-generate. - */ - void setActivated(boolean status); - - /** - * Clones all Settings and values of the OreSetting to a new one. - * - * @return a new OreSettings - */ - @NotNull - OreSettings clone(); - -} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/PlacementModifierHook.java b/api/src/main/java/de/derfrzocker/ore/control/api/PlacementModifierHook.java new file mode 100644 index 00000000..3b6e1423 --- /dev/null +++ b/api/src/main/java/de/derfrzocker/ore/control/api/PlacementModifierHook.java @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.api; + +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import org.bukkit.Keyed; + +public interface PlacementModifierHook extends Keyed { + + FeaturePlacementModifier getPlacementModifier(); + + Biome getBiome(); +} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/Setting.java b/api/src/main/java/de/derfrzocker/ore/control/api/Setting.java deleted file mode 100644 index 2e40a8c9..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/Setting.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -public enum Setting { - - VEIN_SIZE(0), - VEINS_PER_CHUNK(0), - HEIGHT_RANGE(0), - HEIGHT_CENTER(0), - MINIMUM_ORES_PER_CHUNK(-1), - ORES_PER_CHUNK_RANGE(0), - MINIMUM_HEIGHT(0), - HEIGHT_SUBTRACT_VALUE(0), - VEINS_PER_BIOME(0), - SEA_LEVEL_DIVIDER(0), - SEA_LEVEL_ADDER(Integer.MIN_VALUE); - - final static Setting[] DEFAULT_ORE_SETTINGS = new Setting[]{ - VEIN_SIZE - }; - - final static Setting[] DEFAULT_COUNT_RANGE_SETTINGS = new Setting[]{ - VEINS_PER_CHUNK, - HEIGHT_RANGE, - MINIMUM_HEIGHT, - HEIGHT_SUBTRACT_VALUE, - VEINS_PER_BIOME - }; - - final static Setting[] DEFAULT_COUNT_DEPTH_AVERAGE_SETTINGS = new Setting[]{ - VEINS_PER_CHUNK, - HEIGHT_RANGE, - HEIGHT_CENTER, - VEINS_PER_BIOME - }; - - final static Setting[] DEFAULT_EMERALD_ORE_SETTINGS = new Setting[]{ - MINIMUM_ORES_PER_CHUNK, - ORES_PER_CHUNK_RANGE, - HEIGHT_RANGE, - MINIMUM_HEIGHT, - VEINS_PER_BIOME - }; - - final static Setting[] DEFAULT_MAGMA_SETTINGS = new Setting[]{ - VEINS_PER_CHUNK, - HEIGHT_RANGE, - SEA_LEVEL_DIVIDER, - SEA_LEVEL_ADDER - }; - - final static Setting[] NETHER_COUNT_RANGE_SETTINGS = new Setting[]{ - VEINS_PER_CHUNK, - HEIGHT_RANGE, - MINIMUM_HEIGHT, - HEIGHT_SUBTRACT_VALUE - }; - - final static Setting[] NETHER_COUNT_DEPTH_AVERAGE_SETTINGS = new Setting[]{ - VEINS_PER_CHUNK, - HEIGHT_RANGE, - HEIGHT_CENTER - }; - - private final int minimumValue; - - Setting(final int minimumValue) { - this.minimumValue = minimumValue; - } - - public int getMinimumValue() { - return minimumValue; - } - -} diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/WorldOreConfig.java b/api/src/main/java/de/derfrzocker/ore/control/api/WorldOreConfig.java deleted file mode 100644 index 6c16ee90..00000000 --- a/api/src/main/java/de/derfrzocker/ore/control/api/WorldOreConfig.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.api; - -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; -import java.util.Optional; - -/** - * The WorldOreConfig class represent a ore config for a Minecraft World - * or for a Template. - *

- * A Template is a WorldOreConfig that are not directly reference to a Minecraft World, - * Templates are for pre enter values. A Template becomes a normal WorldOreConfig, - * if a Minecraft World with the same name exists on the Server. - *

- * For each World or Template only one WorldOreConfig Object should exists, - * per Java Runtime. - *

- * All changes that are made to a WorldOreConfig Object or Objects that are given from the WorldOreConfig - * are directly apply to the WorldOreConfig and can be access from other Object / Methods. - *

- * But the changes are not saved to disk, this means after a restart all changes that are made to - * the WorldOreConfig are gone. - *

- * To permanently apply the changes to the WorldOreConfig and saved it to disk. - * See {@link OreControlService#saveWorldOreConfig(WorldOreConfig)} - */ -public interface WorldOreConfig { - - /** - * Return the name of this config, - * the name is equal to the world or template - * name that this WorldOreConfig represent. - * - * @return the name of the config - */ - @NotNull - String getName(); - - /** - * If this config contains the OreSetting of the given Ore, - * it returns an Optional that contains the OreSettings, - * otherwise it return an empty Optional. - * - * @param ore which must be non-null - * @return an Optional describing the OreSetting of the given Ore, - * or an empty Optional if the config not contain the given Ore. - * @throws IllegalArgumentException if ore is null - */ - @NotNull - Optional getOreSettings(@NotNull Ore ore); - - /** - * @return the Map with all OreSettings that this WorldOreConfig have. - */ - @NotNull - Map getOreSettings(); - - /** - * This adds the given OreSetting to this WorldOreConfig. - * If this Object already have an OreSetting from the Ore, - * than it replaced the old OreSetting with given OreSetting. - * - * @param oreSettings which must be non-null - * @throws IllegalArgumentException if ore is null - */ - void setOreSettings(@NotNull OreSettings oreSettings); - - /** - * If this config contains the BiomeOreSettings of the given Biome, - * it returns an Optional that contains the BiomeOreSettings, - * otherwise it return an empty Optional. - * - * @param biome which must be non- null - * @return an Optional describing the BiomeOreSettings of the given Biome, - * or an empty Optional if the config not contain the given Biome. - * @throws IllegalArgumentException if biome is null - */ - @NotNull - Optional getBiomeOreSettings(@NotNull Biome biome); - - /** - * @return the Map with all BiomeOreSettings that this WorldOreConfig have. - */ - @NotNull - Map getBiomeOreSettings(); - - /** - * This adds the given BiomeOreSettings to this WorldOreConfig. - * If this Object already have an BiomeOreSettings from the Biome, - * than it replaced the old BiomeOreSettings with given BiomeOreSettings. - * - * @param biomeOreSettings which must be non- null - * @throws IllegalArgumentException if biomeOreSettings is null - */ - void setBiomeOreSettings(@NotNull BiomeOreSettings biomeOreSettings); - - /** - * @return true if this WorldOreConfig is a Template - * otherwise it return false - * @deprecated use {@link #getConfigType()} - */ - boolean isTemplate(); - - /** - * Set if this WorldOreConfig is a template or not. - *

- * Note: If a world exist with the same name, as this WorldOreConfig the World ignore the Template status - * and uses the config anyway. - * - * @param status true for Template false for no-Template - * @deprecated use {@link #setConfigType(ConfigType)} - */ - @Deprecated - void setTemplate(boolean status); - - /** - * @return the type of this config - */ - @NotNull - ConfigType getConfigType(); - - /** - * Sets this config to the given config type - * - * @param configType to set - * @throws IllegalArgumentException if config Type is null - */ - void setConfigType(@NotNull ConfigType configType); - - /** - * This copy the current WorldOreConfig Settings with a new name to a new one. - *

- * Note: The new WorldOreConfig is not saved to disk or accessible from - * {@link OreControlService#getWorldOreConfig(World) or {@link OreControlService#getWorldOreConfig(String)} - * to save the copy, see {@link OreControlService#saveWorldOreConfig(WorldOreConfig)}. - * - * @param name the Name of the new WorldOreConfig - * @return a new WorldOreConfig with the given name. - * @throws IllegalArgumentException if name is null - */ - @NotNull - WorldOreConfig clone(@NotNull String name); - -} \ No newline at end of file diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/dao/ConfigDao.java b/api/src/main/java/de/derfrzocker/ore/control/api/dao/ConfigDao.java new file mode 100644 index 00000000..3425c932 --- /dev/null +++ b/api/src/main/java/de/derfrzocker/ore/control/api/dao/ConfigDao.java @@ -0,0 +1,164 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.api.dao; + +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.mojang.serialization.Codec; +import com.mojang.serialization.JsonOps; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import de.derfrzocker.feature.api.FeatureGenerator; +import de.derfrzocker.feature.api.FeatureGeneratorConfiguration; +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.Config; +import de.derfrzocker.ore.control.api.OreControlRegistries; +import org.bukkit.NamespacedKey; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; + +public class ConfigDao { + + private final Map>> cache = new ConcurrentHashMap<>(); + private final OreControlRegistries registries; + private final File directory; + private final Codec configCodec; + + public ConfigDao(OreControlRegistries registries, File directory) { + this.registries = registries; + this.directory = directory; + this.configCodec = RecordCodecBuilder.create((builder) -> builder.group( + Codec.list(registries.getPlacementModifierRegistry(). + dispatch("placement_modifier_type", PlacementModifierConfiguration::getPlacementModifier, FeaturePlacementModifier::getCodec)). + optionalFieldOf("placement_modifier_configurations"). + forGetter(config -> Optional.ofNullable(config.getPlacements())), + registries.getFeatureGeneratorRegistry().dispatch("feature_generator_type", FeatureGeneratorConfiguration::getFeatureGenerator, FeatureGenerator::getCodec). + optionalFieldOf("feature_generator_configuration"). + forGetter(config -> Optional.ofNullable(config.getFeature())) + ).apply(builder, (placementModifierConfigurations, featureGeneratorConfiguration) -> new Config(placementModifierConfigurations.orElse(null), featureGeneratorConfiguration.orElse(null)))); + } + + public Codec getConfigCodec() { + return this.configCodec; + } + + public Optional getConfig(String worldName, Biome biome, NamespacedKey key) { + return Optional.ofNullable(cache.computeIfAbsent(worldName, name -> new ConcurrentHashMap<>()).computeIfAbsent(biome, bio -> new ConcurrentHashMap<>()).computeIfAbsent(key, namespacedKey -> load(worldName, biome, key))); + } + + private Config load(String worldName, Biome biome, NamespacedKey key) { + File worldFolder = new File(directory, worldName); + if (!worldFolder.exists()) { + return null; + } + + File biomeValues = new File(worldFolder, "biome/" + biome.getKey().getNamespace() + "/" + biome.getKey().getKey() + "/" + key.getNamespace() + "/" + key.getKey() + ".json"); + File worldValues = new File(worldFolder, "world/" + key.getNamespace() + "/" + key.getKey() + ".json"); + + if (!biomeValues.exists() && !worldValues.exists()) { + return null; + } + + Config biomeConfig = null; + if (biomeValues.exists()) { + try { + JsonElement json = JsonParser.parseString(Files.readString(biomeValues.toPath())); + biomeConfig = configCodec.decode(JsonOps.INSTANCE, json).get().left().get().getFirst(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + Config worldConfig = null; + if (worldValues.exists()) { + try { + JsonElement json = JsonParser.parseString(Files.readString(worldValues.toPath())); + worldConfig = configCodec.decode(JsonOps.INSTANCE, json).get().left().get().getFirst(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + if (worldConfig == null) { + return biomeConfig; + } + + if (biomeConfig == null) { + return worldConfig; + } + + + List biomePlacements = new ArrayList<>(); + List worldPlacements = new ArrayList<>(); + List placements = new ArrayList<>(); + + if (biomeConfig.getPlacements() != null) { + biomePlacements.addAll(biomeConfig.getPlacements()); + } + + if (worldConfig.getPlacements() != null) { + worldPlacements.addAll(worldConfig.getPlacements()); + } + + for (PlacementModifierConfiguration first : biomePlacements) { + PlacementModifierConfiguration second = null; + for (PlacementModifierConfiguration temp : worldPlacements) { + if (first.getPlacementModifier() == temp.getPlacementModifier()) { + second = temp; + break; + } + } + + if (second != null) { + placements.add(first.getPlacementModifier().merge(first, second)); + worldPlacements.remove(second); + } else { + placements.add(first); + } + } + + placements.addAll(worldPlacements); + + FeatureGeneratorConfiguration configuration; + if (biomeConfig.getFeature() != null && worldConfig.getFeature() != null) { + configuration = biomeConfig.getFeature().getFeatureGenerator().merge(biomeConfig.getFeature(), worldConfig.getFeature()); + } else if (biomeConfig.getFeature() != null) { + configuration = biomeConfig.getFeature(); + } else { + configuration = worldConfig.getFeature(); + } + + return new Config(placements, configuration); + } +} diff --git a/impl/yaml/pom.xml b/common/pom.xml similarity index 72% rename from impl/yaml/pom.xml rename to common/pom.xml index c9611662..afc310ac 100644 --- a/impl/yaml/pom.xml +++ b/common/pom.xml @@ -1,16 +1,16 @@ - 4.0.0 - ore-control-impl + ore-control-parent de.derfrzocker ${revision} - ore-control-impl-yaml + ore-control-common diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeCombinedConfiguration.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatType.java similarity index 61% rename from impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeCombinedConfiguration.java rename to common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatType.java index 56ec48d5..f21d9b6c 100644 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeCombinedConfiguration.java +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatType.java @@ -23,29 +23,34 @@ * */ -package de.derfrzocker.ore.control.impl.v1_16_R3; +package de.derfrzocker.feature.common.value.number; -import net.minecraft.server.v1_16_R3.WorldGenFeatureChanceDecoratorRangeConfiguration; +import com.mojang.serialization.Codec; +import org.bukkit.NamespacedKey; import org.jetbrains.annotations.NotNull; -public class RangeCombinedConfiguration { +public class FixedFloatType extends FloatType { - private final int veinCount; - @NotNull - private final WorldGenFeatureChanceDecoratorRangeConfiguration configuration; + public static final NamespacedKey KEY = NamespacedKey.fromString("feature:fixed_float"); + public static final FixedFloatType INSTANCE = new FixedFloatType(); + public static final Codec CODEC = Codec.FLOAT.xmap(FixedFloatValue::new, FixedFloatValue::getValue); - public RangeCombinedConfiguration(final int veinCount, @NotNull final WorldGenFeatureChanceDecoratorRangeConfiguration configuration) { - this.veinCount = veinCount; - this.configuration = configuration; + private FixedFloatType() { } - public int getVeinCount() { - return this.veinCount; + @Override + public Codec getCodec() { + return CODEC.xmap(value -> value, value -> (FixedFloatValue) value); } - @NotNull - public WorldGenFeatureChanceDecoratorRangeConfiguration getConfiguration() { - return configuration; + @Override + public Class getTypeClass() { + return Float.class; } + @NotNull + @Override + public NamespacedKey getKey() { + return KEY; + } } diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedCombinedConfiguration.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatValue.java similarity index 63% rename from impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedCombinedConfiguration.java rename to common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatValue.java index d2034923..99a23a34 100644 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedCombinedConfiguration.java +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedFloatValue.java @@ -23,29 +23,34 @@ * */ -package de.derfrzocker.ore.control.impl.v1_17_R1; +package de.derfrzocker.feature.common.value.number; -import net.minecraft.world.level.levelgen.feature.configurations.RangeDecoratorConfiguration; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; import org.jetbrains.annotations.NotNull; -public class DepthAveragedCombinedConfiguration { +import java.util.Random; - private final int veinCount; - @NotNull - private final RangeDecoratorConfiguration configuration; +public class FixedFloatValue extends FloatValue { - public DepthAveragedCombinedConfiguration(final int veinCount, @NotNull final RangeDecoratorConfiguration configuration) { - this.veinCount = veinCount; - this.configuration = configuration; + private final float value; + + public FixedFloatValue(float value) { + this.value = value; } - public int getVeinCount() { - return this.veinCount; + @Override + public FixedFloatType getValueType() { + return FixedFloatType.INSTANCE; } - @NotNull - public RangeDecoratorConfiguration getConfiguration() { - return configuration; + @Override + public Float getValue(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion) { + return value; } + public float getValue() { + return value; + } } diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeCombinedConfiguration.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerType.java similarity index 60% rename from impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeCombinedConfiguration.java rename to common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerType.java index 0078cf02..6f239fa9 100644 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeCombinedConfiguration.java +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerType.java @@ -23,29 +23,34 @@ * */ -package de.derfrzocker.ore.control.impl.v1_16_R2; +package de.derfrzocker.feature.common.value.number; -import net.minecraft.server.v1_16_R2.WorldGenFeatureChanceDecoratorRangeConfiguration; +import com.mojang.serialization.Codec; +import org.bukkit.NamespacedKey; import org.jetbrains.annotations.NotNull; -public class RangeCombinedConfiguration { +public class FixedIntegerType extends IntegerType { - private final int veinCount; - @NotNull - private final WorldGenFeatureChanceDecoratorRangeConfiguration configuration; + public static final NamespacedKey KEY = NamespacedKey.fromString("feature:fixed_integer"); + public static final FixedIntegerType INSTANCE = new FixedIntegerType(); + public static final Codec CODEC = Codec.INT.xmap(FixedIntegerValue::new, FixedIntegerValue::getValue); - public RangeCombinedConfiguration(final int veinCount, @NotNull final WorldGenFeatureChanceDecoratorRangeConfiguration configuration) { - this.veinCount = veinCount; - this.configuration = configuration; + private FixedIntegerType() { } - public int getVeinCount() { - return this.veinCount; + @Override + public Codec getCodec() { + return CODEC.xmap(value -> value, value -> (FixedIntegerValue) value); } - @NotNull - public WorldGenFeatureChanceDecoratorRangeConfiguration getConfiguration() { - return configuration; + @Override + public Class getTypeClass() { + return Integer.class; } + @NotNull + @Override + public NamespacedKey getKey() { + return KEY; + } } diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedCombinedConfiguration.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerValue.java similarity index 63% rename from impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedCombinedConfiguration.java rename to common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerValue.java index ec2edeb0..0b88d712 100644 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedCombinedConfiguration.java +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/FixedIntegerValue.java @@ -23,29 +23,34 @@ * */ -package de.derfrzocker.ore.control.impl.v1_16_R3; +package de.derfrzocker.feature.common.value.number; -import net.minecraft.server.v1_16_R3.WorldGenDecoratorHeightAverageConfiguration; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; import org.jetbrains.annotations.NotNull; -public class DepthAveragedCombinedConfiguration { +import java.util.Random; - private final int veinCount; - @NotNull - private final WorldGenDecoratorHeightAverageConfiguration configuration; +public class FixedIntegerValue extends IntegerValue { - public DepthAveragedCombinedConfiguration(final int veinCount, @NotNull final WorldGenDecoratorHeightAverageConfiguration configuration) { - this.veinCount = veinCount; - this.configuration = configuration; + private final int value; + + public FixedIntegerValue(int value) { + this.value = value; } - public int getVeinCount() { - return this.veinCount; + @Override + public FixedIntegerType getValueType() { + return FixedIntegerType.INSTANCE; } - @NotNull - public WorldGenDecoratorHeightAverageConfiguration getConfiguration() { - return configuration; + @Override + public Integer getValue(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion) { + return value; } + public int getValue() { + return value; + } } diff --git a/api/src/main/java/de/derfrzocker/ore/control/api/Dimension.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/FloatType.java similarity index 89% rename from api/src/main/java/de/derfrzocker/ore/control/api/Dimension.java rename to common/src/main/java/de/derfrzocker/feature/common/value/number/FloatType.java index 86fb650e..4f1c4fc3 100644 --- a/api/src/main/java/de/derfrzocker/ore/control/api/Dimension.java +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/FloatType.java @@ -23,10 +23,7 @@ * */ -package de.derfrzocker.ore.control.api; - -public enum Dimension { - - OVERWORLD, NETHER, THE_END, CUSTOM; +package de.derfrzocker.feature.common.value.number; +public abstract class FloatType extends NumberType { } diff --git a/common/src/main/java/de/derfrzocker/feature/common/value/number/FloatValue.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/FloatValue.java new file mode 100644 index 00000000..b2f10dfb --- /dev/null +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/FloatValue.java @@ -0,0 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.common.value.number; + +public abstract class FloatValue extends NumberValue { + +} diff --git a/common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerType.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerType.java new file mode 100644 index 00000000..d928fcc7 --- /dev/null +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerType.java @@ -0,0 +1,29 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.common.value.number; + +public abstract class IntegerType extends NumberType { +} diff --git a/common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerValue.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerValue.java new file mode 100644 index 00000000..d21afeed --- /dev/null +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/IntegerValue.java @@ -0,0 +1,29 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.common.value.number; + +public abstract class IntegerValue extends NumberValue { +} diff --git a/common/src/main/java/de/derfrzocker/feature/common/value/number/NumberType.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/NumberType.java new file mode 100644 index 00000000..d476c5df --- /dev/null +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/NumberType.java @@ -0,0 +1,31 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.common.value.number; + +import de.derfrzocker.feature.api.ValueType; + +public abstract class NumberType, T extends NumberType, O extends Number> implements ValueType { +} diff --git a/common/src/main/java/de/derfrzocker/feature/common/value/number/NumberValue.java b/common/src/main/java/de/derfrzocker/feature/common/value/number/NumberValue.java new file mode 100644 index 00000000..88681c52 --- /dev/null +++ b/common/src/main/java/de/derfrzocker/feature/common/value/number/NumberValue.java @@ -0,0 +1,31 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.common.value.number; + +import de.derfrzocker.feature.api.Value; + +public abstract class NumberValue, T extends NumberType, O extends Number> implements Value { +} diff --git a/impl/pom.xml b/impl/pom.xml index c31f2ec3..48a3c488 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -11,16 +11,7 @@ - v1_14_R1 - v1_13_R1 - v1_13_R2 - v1_15_R1 - v1_16_R1 - yaml - service - v1_16_R2 - v1_16_R3 - v1_17_R1 + v1_18_R1 ore-control-impl diff --git a/impl/service/pom.xml b/impl/service/pom.xml deleted file mode 100644 index 5c92053b..00000000 --- a/impl/service/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-service - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - - \ No newline at end of file diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/NMSServiceImpl.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/NMSServiceImpl.java deleted file mode 100644 index 33e7c2d3..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/NMSServiceImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Random; -import java.util.function.BiFunction; -import java.util.function.Supplier; - -public class NMSServiceImpl implements NMSService { - - private final Map generationHandlerMap = new LinkedHashMap<>(); - @NotNull - private final NMSUtil nMSUtil; - @NotNull - private final Supplier serviceSupplier; - - public NMSServiceImpl(@NotNull final NMSUtil nMSUtil, @NotNull final Supplier serviceSupplier) { - Validate.notNull(nMSUtil, "NMSUtil cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.nMSUtil = nMSUtil; - this.serviceSupplier = serviceSupplier; - } - - @NotNull - @Override - public NMSUtil getNMSUtil() { - return this.nMSUtil; - } - - @Override - public void registerGenerationHandler(@NotNull final Ore ore, @NotNull final GenerationHandler generationHandler) { - Validate.notNull(ore, "Ore can notbe null"); - Validate.notNull(generationHandler, "GenerationHandler cannot be null"); - - this.generationHandlerMap.put(ore, generationHandler); - } - - @Override - public void replaceNMS() { - this.nMSUtil.replaceNMS(); - } - - @Override - public boolean generate(@NotNull final World world, @NotNull final Biome biome, final Ore ore, @NotNull final ChunkCoordIntPair chunkCoordIntPair, - @NotNull final Object defaultConfiguration, @NotNull final Object defaultFeatureConfiguration, - @Nullable final BiFunction generateFunction, @NotNull final BiFunction passFunction, @NotNull final Random random) { - - final OreControlService service = serviceSupplier.get(); - - if (ore == null) { - return passFunction.apply(defaultConfiguration, defaultFeatureConfiguration); - } - - WorldOreConfig worldOreConfig = service.getWorldOreConfig(world).orElse(null); - - if (worldOreConfig == null) { - worldOreConfig = service.getGlobalWorldOreConfig(); - } - - try { - if (!service.isActivated(worldOreConfig, biome, ore)) { - return true; - } - - final GenerationHandler generationHandler = generationHandlerMap.get(ore); - - if (generationHandler == null) { - throw new IllegalArgumentException("There is no GenerationHandler for ore '" + ore + "' registered"); - } - - return generationHandler.generate(world, worldOreConfig, service, biome, ore, chunkCoordIntPair, defaultConfiguration, defaultFeatureConfiguration, generateFunction, passFunction, random); - - } catch (final Exception e) { - final StringBuilder errorMessage = new StringBuilder("Error while generate Chunk" + - ", Worldname: " + worldOreConfig.getName() + - ", Ore: " + ore + - ", Biome: " + biome); - - try { - for (final Setting setting : ore.getSettings()) { - errorMessage.append(", ").append(setting).append(": ").append(service.getValue(worldOreConfig, biome, ore, setting)); - } - } catch (final Exception e1) { - e1.printStackTrace(); - } - - final RuntimeException runtimeException = new RuntimeException(errorMessage.toString(), e); - - runtimeException.printStackTrace(); - - throw runtimeException; - } - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/OreControlServiceImpl.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/OreControlServiceImpl.java deleted file mode 100644 index 233d348d..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/OreControlServiceImpl.java +++ /dev/null @@ -1,476 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl; - -import com.google.common.collect.Sets; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.api.dao.WorldOreConfigDao; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; -import java.util.Set; - -public abstract class OreControlServiceImpl implements OreControlService { - - @NotNull - private final NMSService nmsService; - @NotNull - private final WorldOreConfigDao dao; - - public OreControlServiceImpl(@NotNull final NMSService nmsService, @NotNull final WorldOreConfigDao dao) { - Validate.notNull(nmsService, "NMSService cannot be null"); - Validate.notNull(dao, "WorldOreConfigDao cannot be null"); - - this.nmsService = nmsService; - this.dao = dao; - } - - @NotNull - protected abstract OreSettings getDefaultOreSetting(@NotNull Ore ore); - - @NotNull - protected abstract OreSettings getDefaultOreSetting(@NotNull Biome biome, @NotNull Ore ore); - - @NotNull - protected abstract OreSettings getNewOreSetting(@NotNull Ore ore); - - @NotNull - protected abstract WorldOreConfig getNewWorldOreConfig(@NotNull String name, boolean template); - - @NotNull - protected abstract BiomeOreSettings getNewBiomeOreSettings(@NotNull Biome biome); - - @NotNull - @Override - public NMSService getNMSService() { - return this.nmsService; - } - - @NotNull - @Override - public Optional getWorldOreConfig(@NotNull final World world) { - Validate.notNull(world, "World cannot be null"); - - return this.dao.get(world.getName()); - } - - @NotNull - @Override - public Optional getWorldOreConfig(@NotNull final String name) { - Validate.notNull(name, "Name cannot be null"); - - return this.dao.get(name); - } - - @NotNull - @Override - public WorldOreConfig getGlobalWorldOreConfig() { - return this.dao.getGlobalWorldOreConfig(); - } - - @NotNull - @Override - public WorldOreConfig createWorldOreConfig(@NotNull final World world) { - Validate.notNull(world, "World cannot be null"); - - final WorldOreConfig worldOreConfig = getNewWorldOreConfig(world.getName(), false); - - saveWorldOreConfig(worldOreConfig); - - return worldOreConfig; - } - - @NotNull - @Override - public WorldOreConfig createWorldOreConfigTemplate(@NotNull final String name) { - Validate.notNull(name, "Name cannot be null"); - Validate.notEmpty(name, "Name cannot be empty"); - Validate.notEmpty(name.trim(), "Name cannot consist of only spaces"); - - final WorldOreConfig worldOreConfig = getNewWorldOreConfig(name, true); - - saveWorldOreConfig(worldOreConfig); - - return worldOreConfig; - } - - @Override - public void saveWorldOreConfig(@NotNull final WorldOreConfig config) { - Validate.notNull(config, "WorldOreConfig cannot be null"); - - this.dao.save(config); - } - - @Override - public void removeWorldOreConfig(@NotNull final WorldOreConfig config) { - Validate.notNull(config, "WorldOreConfig cannot be null"); - - this.dao.remove(config); - } - - @NotNull - @Override - public Set getAllWorldOreConfigs() { - return this.dao.getAll(); - } - - @Override - public double getDefaultValue(@NotNull final Ore ore, @NotNull final Setting setting) { - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - Validate.isTrue(Sets.newHashSet(ore.getSettings()).contains(setting), "The Ore '" + ore + "' dont have the Setting '" + setting + "'"); - - return getDefaultValue0(ore, setting); - } - - @Override - public double getDefaultValue(@NotNull Biome biome, @NotNull Ore ore, @NotNull Setting setting) { - Validate.notNull(ore, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - Validate.isTrue(Sets.newHashSet(biome.getOres()).contains(ore), "The Biome '" + biome + "' dont have the Ore '" + ore + "'"); - Validate.isTrue(Sets.newHashSet(ore.getSettings()).contains(setting), "The Ore '" + ore + "' dont have the Setting '" + setting + "'"); - - return getDefaultValue0(biome, ore, setting); - } - - @Override - public double getValue(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Setting setting) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - Validate.isTrue(Sets.newHashSet(biome.getOres()).contains(ore), "The Biome '" + biome + "' dont have the Ore '" + ore + "'"); - Validate.isTrue(Sets.newHashSet(ore.getSettings()).contains(setting), "The Ore '" + ore + "' dont have the Setting '" + setting + "'"); - - final Optional biomeOreSettings = worldOreConfig.getBiomeOreSettings(biome); - - // Check first in BiomeOreSetting - if (biomeOreSettings.isPresent()) { - final Optional oreSettingsOptional = biomeOreSettings.get().getOreSettings(ore); - - //checking if OreSetting in BiomeOreSetting is present - if (oreSettingsOptional.isPresent()) { - final Optional valueOptional = oreSettingsOptional.get().getValue(setting); - - if (valueOptional.isPresent()) { - // value present, returning Biome specific value - return valueOptional.get(); - } - } - } - - // Now checking for WorldOreConfig specific value - return getValue0(worldOreConfig, biome, ore, setting); - } - - @Override - public double getValue(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore, @NotNull final Setting setting) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - Validate.isTrue(Sets.newHashSet(ore.getSettings()).contains(setting), "The Ore '" + ore + "' dont have the Setting '" + setting + "'"); - - return getValue0(worldOreConfig, null, ore, setting); - } - - @Override - public void setValue(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Setting setting, final double value) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - Validate.isTrue(Sets.newHashSet(biome.getOres()).contains(ore), "The Biome '" + biome + "' dont have the Ore '" + ore + "'"); - Validate.isTrue(Sets.newHashSet(ore.getSettings()).contains(setting), "The Ore '" + ore + "' dont have the Setting '" + setting + "'"); - - final Optional biomeOreSettingsOptional = worldOreConfig.getBiomeOreSettings(biome); - final BiomeOreSettings biomeOreSettings; - - if (biomeOreSettingsOptional.isPresent()) { - biomeOreSettings = biomeOreSettingsOptional.get(); - } else { - biomeOreSettings = getNewBiomeOreSettings(biome); - worldOreConfig.setBiomeOreSettings(biomeOreSettings); - } - - final Optional oreSettingsOptional = biomeOreSettings.getOreSettings(ore); - final OreSettings oreSettings; - - if (oreSettingsOptional.isPresent()) { - oreSettings = oreSettingsOptional.get(); - } else { - oreSettings = getNewOreSetting(ore); - biomeOreSettings.setOreSettings(oreSettings); - } - - oreSettings.setValue(setting, value); - } - - @Override - public void setValue(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore, @NotNull final Setting setting, final double value) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - Validate.isTrue(Sets.newHashSet(ore.getSettings()).contains(setting), "The Ore '" + ore + "' dont have the Setting '" + setting + "'"); - - final Optional oreSettingsOptional = worldOreConfig.getOreSettings(ore); - final OreSettings oreSettings; - - if (oreSettingsOptional.isPresent()) { - oreSettings = oreSettingsOptional.get(); - } else { - oreSettings = getNewOreSetting(ore); - worldOreConfig.setOreSettings(oreSettings); - } - - oreSettings.setValue(setting, value); - } - - @Override - public boolean isActivated(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Biome biome, @NotNull final Ore ore) { - { - final Optional biomeOreSettings = worldOreConfig.getBiomeOreSettings(biome); - - if (biomeOreSettings.isPresent()) { - final Optional oreSettings = biomeOreSettings.get().getOreSettings(ore); - - if (oreSettings.isPresent()) { - return oreSettings.get().isActivated(); - } - } - - final Optional oreSettings = worldOreConfig.getOreSettings(ore); - - if (oreSettings.isPresent()) { - return oreSettings.get().isActivated(); - } - } - - //checking in default WorldOreConfig - { - final WorldOreConfig defaultW = getGlobalWorldOreConfig(); - final Optional biomeOreSettings = defaultW.getBiomeOreSettings(biome); - - if (biomeOreSettings.isPresent()) { - final Optional oreSettings = biomeOreSettings.get().getOreSettings(ore); - - if (oreSettings.isPresent()) { - return oreSettings.get().isActivated(); - } - } - - final Optional oreSettings = defaultW.getOreSettings(ore); - - if (oreSettings.isPresent()) { - return oreSettings.get().isActivated(); - } - } - - return true; - } - - @Override - public boolean isActivated(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore) { - - { - final Optional oreSettings = worldOreConfig.getOreSettings(ore); - - if (oreSettings.isPresent()) { - return oreSettings.get().isActivated(); - } - } - - //checking in default WorldOreConfig - { - final WorldOreConfig defaultW = getGlobalWorldOreConfig(); - final Optional oreSettings = defaultW.getOreSettings(ore); - - if (oreSettings.isPresent()) { - return oreSettings.get().isActivated(); - } - } - - return true; - } - - @Override - public void setActivated(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Biome biome, @NotNull final Ore ore, final boolean value) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.isTrue(Sets.newHashSet(biome.getOres()).contains(ore), "The Biome '" + biome + "' dont have the Ore '" + ore + "'"); - - final Optional biomeOreSettingsOptional = worldOreConfig.getBiomeOreSettings(biome); - final BiomeOreSettings biomeOreSettings; - - if (biomeOreSettingsOptional.isPresent()) { - biomeOreSettings = biomeOreSettingsOptional.get(); - } else { - biomeOreSettings = getNewBiomeOreSettings(biome); - worldOreConfig.setBiomeOreSettings(biomeOreSettings); - } - - final Optional oreSettingsOptional = biomeOreSettings.getOreSettings(ore); - final OreSettings oreSettings; - - if (oreSettingsOptional.isPresent()) { - oreSettings = oreSettingsOptional.get(); - } else { - oreSettings = getNewOreSetting(ore); - biomeOreSettings.setOreSettings(oreSettings); - } - - oreSettings.setActivated(value); - } - - @Override - public void setActivated(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore, final boolean value) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - - final Optional oreSettingsOptional = worldOreConfig.getOreSettings(ore); - final OreSettings oreSettings; - - if (oreSettingsOptional.isPresent()) { - oreSettings = oreSettingsOptional.get(); - } else { - oreSettings = getNewOreSetting(ore); - worldOreConfig.setOreSettings(oreSettings); - } - - oreSettings.setActivated(value); - } - - @NotNull - private OreSettings getDefault(@NotNull final Ore ore) { - final OreSettings oreSettings = getDefaultOreSetting(ore); - - Validate.notNull(oreSettings, "Default OreSettings for the ore '" + ore + "' is null, this should never happen"); - - return oreSettings; - } - - @NotNull - private OreSettings getDefault(@NotNull Biome biome, @NotNull final Ore ore) { - final OreSettings oreSettings = getDefaultOreSetting(biome, ore); - - Validate.notNull(oreSettings, "Default OreSettings for the biome '" + biome + "' and the ore '" + ore + "' is null, this should never happen"); - - return oreSettings; - } - - private double getDefaultValue0(@NotNull final Ore ore, @NotNull final Setting setting) { - final OreSettings oreSettings = getDefault(ore); - - final Optional value = oreSettings.getValue(setting); - - if (value.isPresent()) { - return value.get(); - } - - //Something went wrong, this means there is now default value for the given Ore and Setting, this is probably a configuration problem for the default settings - throw new RuntimeException("The default OreSettings for the Ore '" + ore + "' dont contains a default value for the Setting '" + setting + "'"); - } - - private double getDefaultValue0(@NotNull Biome biome, @NotNull final Ore ore, @NotNull final Setting setting) { - final OreSettings oreSettings = getDefault(biome, ore); - - final Optional value = oreSettings.getValue(setting); - - if (value.isPresent()) { - return value.get(); - } - - //Something went wrong, this means there is now default value for the given Ore and Setting, this is probably a configuration problem for the default settings - throw new RuntimeException("The default OreSettings for the Biome '" + biome + "' and the Ore '" + ore + "' dont contains a default value for the Setting '" + setting + "'"); - } - - private double getValue0(@NotNull final WorldOreConfig worldOreConfig, @Nullable Biome biome, @NotNull final Ore ore, @NotNull final Setting setting) { - // Checking first for WorldOreConfig specific value - final Optional oreSettingsOptional = worldOreConfig.getOreSettings(ore); - - //checking if OreSetting in WorldOreConfig is present - if (oreSettingsOptional.isPresent()) { - final Optional valueOptional = oreSettingsOptional.get().getValue(setting); - - if (valueOptional.isPresent()) { - // value present, returning WorldOreConfig specific value - return valueOptional.get(); - } - } - - // checking in default WorldOreConfig - return getDefaultWorldOreConfigValue(biome, ore, setting); - } - - private double getDefaultWorldOreConfigValue(@Nullable Biome biome, @NotNull final Ore ore, @NotNull final Setting setting) { - final WorldOreConfig worldOreConfig = getGlobalWorldOreConfig(); - - if (biome != null) { - final Optional biomeOreSettings = worldOreConfig.getBiomeOreSettings(biome); - - // Check first in BiomeOreSetting - if (biomeOreSettings.isPresent()) { - final Optional oreSettingsOptional = biomeOreSettings.get().getOreSettings(ore); - - //checking if OreSetting in BiomeOreSetting is present - if (oreSettingsOptional.isPresent()) { - final Optional valueOptional = oreSettingsOptional.get().getValue(setting); - - if (valueOptional.isPresent()) { - // value present, returning Biome specific value - return valueOptional.get(); - } - } - } - } - - // Checking first for WorldOreConfig specific value - final Optional oreSettingsOptional = worldOreConfig.getOreSettings(ore); - - //checking if OreSetting in WorldOreConfig is present - if (oreSettingsOptional.isPresent()) { - final Optional valueOptional = oreSettingsOptional.get().getValue(setting); - - if (valueOptional.isPresent()) { - // value present, returning WorldOreConfig specific value - return valueOptional.get(); - } - } - - // If a Biome is present, check for biome specific default values - if (biome != null) { - return getDefaultValue0(biome, ore, setting); - } - - //Now checking for a default value - return getDefaultValue0(ore, setting); - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/EmeraldGenerationHandler.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/EmeraldGenerationHandler.java deleted file mode 100644 index a1a77a78..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/EmeraldGenerationHandler.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.generationhandler; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.utils.GenerationUtil; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import de.derfrzocker.spigot.utils.NumberUtil; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public class EmeraldGenerationHandler implements GenerationHandler { - @NotNull - private final NMSUtil nmsUtil; - - public EmeraldGenerationHandler(@NotNull final NMSUtil nmsUtil) { - Validate.notNull(nmsUtil, "NMSUtil cannot be null"); - - this.nmsUtil = nmsUtil; - } - - @Override - public boolean generate(@NotNull final World world, @NotNull final WorldOreConfig worldOreConfig, @NotNull final OreControlService service, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final ChunkCoordIntPair chunkCoordIntPair, @NotNull final Object defaultConfiguration, @NotNull final Object defaultFeatureConfiguration, @Nullable final BiFunction generateFunction, @NotNull final BiFunction passFunction, @NotNull final Random random) { - final double veinsPerBiome = service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_BIOME); - final int veinsPerChunk; - - if (veinsPerBiome > 0) { - veinsPerChunk = GenerationUtil.calculateVeinsPerChunk(nmsUtil, world, biome, chunkCoordIntPair, veinsPerBiome); - } else { - final int minimumOresPerChunk = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.MINIMUM_ORES_PER_CHUNK), random); - final int oresPerChunkRange = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.ORES_PER_CHUNK_RANGE), random); - - veinsPerChunk = minimumOresPerChunk + oresPerChunkRange == 0 ? 0 : random.nextInt(oresPerChunkRange); - } - - if (veinsPerChunk == 0) { - return true; - } - - int heightRange = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_RANGE), random); - final int minimumHeight = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.MINIMUM_HEIGHT), random); - - if (heightRange == 0) { - heightRange = 1; - } - - final Location location = new Location(null, chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4); - - for (int i = 0; i < veinsPerChunk; ++i) { - final int x = random.nextInt(16); - final int y = random.nextInt(heightRange) + minimumHeight; - final int z = random.nextInt(16); - generateFunction.apply(location.clone().add(x, y, z), -1); - } - - return true; - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/LapisGenerationHandler.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/LapisGenerationHandler.java deleted file mode 100644 index 76a82813..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/LapisGenerationHandler.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.generationhandler; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.utils.GenerationUtil; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import de.derfrzocker.spigot.utils.NumberUtil; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public class LapisGenerationHandler implements GenerationHandler { - @NotNull - private final NMSUtil nmsUtil; - - public LapisGenerationHandler(@NotNull final NMSUtil nmsUtil) { - Validate.notNull(nmsUtil, "NMSUtil cannot be null"); - - this.nmsUtil = nmsUtil; - } - - @Override - public boolean generate(@NotNull final World world, @NotNull final WorldOreConfig worldOreConfig, @NotNull final OreControlService service, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final ChunkCoordIntPair chunkCoordIntPair, @NotNull final Object defaultConfiguration, @NotNull final Object defaultFeatureConfiguration, @Nullable final BiFunction generateFunction, @NotNull final BiFunction passFunction, @NotNull final Random random) { - final double veinsPerBiome = service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_BIOME); - final int veinsPerChunk; - - if (veinsPerBiome > 0) { - veinsPerChunk = GenerationUtil.calculateVeinsPerChunk(nmsUtil, world, biome, chunkCoordIntPair, veinsPerBiome); - } else { - veinsPerChunk = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_CHUNK), random); - } - - if (veinsPerChunk == 0) { - return true; - } - - final Object configuration; - - final int heightCenter = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_CENTER), random); - final int heightRange = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_RANGE), random); - configuration = nmsUtil.createHeightAverageConfiguration(veinsPerChunk, heightCenter, heightRange == 0 ? 1 : heightRange); - - final int veinSize = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEIN_SIZE), random); - - if (veinSize == 0) { - return true; - } - - final Object featureConfiguration = nmsUtil.createFeatureConfiguration(defaultFeatureConfiguration, veinSize); - - return passFunction.apply(configuration, featureConfiguration); - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/MagmaGenerationHandler.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/MagmaGenerationHandler.java deleted file mode 100644 index 2c92b135..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/MagmaGenerationHandler.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.generationhandler; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import de.derfrzocker.spigot.utils.NumberUtil; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public class MagmaGenerationHandler implements GenerationHandler { - - @NotNull - private final NMSUtil nmsUtil; - - public MagmaGenerationHandler(@NotNull final NMSUtil nmsUtil) { - Validate.notNull(nmsUtil, "NMSUtil cannot be null"); - - this.nmsUtil = nmsUtil; - } - - @Override - public boolean generate(@NotNull final World world, @NotNull final WorldOreConfig worldOreConfig, @NotNull final OreControlService service, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final ChunkCoordIntPair chunkCoordIntPair, @NotNull final Object defaultConfiguration, @NotNull final Object defaultFeatureConfiguration, @Nullable final BiFunction generateFunction, @NotNull final BiFunction passFunction, @NotNull final Random random) { - final int veinsPerChunk = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_CHUNK), random); - - if (veinsPerChunk == 0) { - return true; - } - - final int veinSize = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEIN_SIZE), random); - - if (veinSize == 0) { - return true; - } - - int heightRange = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_RANGE), random); - int seaLevelDivider = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.SEA_LEVEL_DIVIDER), random); - final int seaLevelAdder = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.SEA_LEVEL_ADDER), random); - - if (heightRange == 0) { - heightRange = 1; - } - - if (seaLevelDivider == 0) { - seaLevelDivider = 1; - } - - final Location location = new Location(null, chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4); - - final int seaLevel = 63 / seaLevelDivider + seaLevelAdder; - - for (int i = 0; i < veinsPerChunk; ++i) { - final int x = random.nextInt(16); - final int y = seaLevel + random.nextInt(heightRange); - final int z = random.nextInt(16); - generateFunction.apply(location.clone().add(x, y, z), veinSize); - } - - return true; - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherAncientDebrisGenerationHandler.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherAncientDebrisGenerationHandler.java deleted file mode 100644 index da8a6a4f..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherAncientDebrisGenerationHandler.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.generationhandler; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import de.derfrzocker.spigot.utils.NumberUtil; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public class NetherAncientDebrisGenerationHandler implements GenerationHandler { - @NotNull - private final NMSUtil nmsUtil; - - public NetherAncientDebrisGenerationHandler(@NotNull final NMSUtil nmsUtil) { - Validate.notNull(nmsUtil, "NMSUtil cannot be null"); - - this.nmsUtil = nmsUtil; - } - - @Override - public boolean generate(@NotNull final World world, @NotNull final WorldOreConfig worldOreConfig, @NotNull final OreControlService service, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final ChunkCoordIntPair chunkCoordIntPair, @NotNull final Object defaultConfiguration, @NotNull final Object defaultFeatureConfiguration, @Nullable final BiFunction generateFunction, @NotNull final BiFunction passFunction, @NotNull final Random random) { - final int veinsPerChunk = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_CHUNK), random); - - if (veinsPerChunk == 0) { - return true; - } - - final Object configuration; - - final int heightCenter = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_CENTER), random); - final int heightRange = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_RANGE), random); - configuration = nmsUtil.createHeightAverageConfiguration(veinsPerChunk, heightCenter, heightRange == 0 ? 1 : heightRange); - - final int veinSize = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEIN_SIZE), random); - - if (veinSize == 0) { - return true; - } - - final Object featureConfiguration = nmsUtil.createFeatureConfiguration(defaultFeatureConfiguration, veinSize); - - return passFunction.apply(configuration, featureConfiguration); - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherNormalOreGenerationHandler.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherNormalOreGenerationHandler.java deleted file mode 100644 index 2916109c..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NetherNormalOreGenerationHandler.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.generationhandler; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import de.derfrzocker.spigot.utils.NumberUtil; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public class NetherNormalOreGenerationHandler implements GenerationHandler { - - @NotNull - private final NMSUtil nmsUtil; - - public NetherNormalOreGenerationHandler(@NotNull final NMSUtil nmsUtil) { - Validate.notNull(nmsUtil, "NMSUtil cannot be null"); - - this.nmsUtil = nmsUtil; - } - - @Override - public boolean generate(@NotNull final World world, @NotNull final WorldOreConfig worldOreConfig, @NotNull final OreControlService service, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final ChunkCoordIntPair chunkCoordIntPair, @NotNull final Object defaultConfiguration, @NotNull final Object defaultFeatureConfiguration, @Nullable final BiFunction generateFunction, @NotNull final BiFunction passFunction, @NotNull final Random random) { - final int veinsPerChunk = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_CHUNK), random); - - if (veinsPerChunk == 0) { - return true; - } - - final Object configuration; - - final int minimumHeight = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.MINIMUM_HEIGHT), random); - final int heightSubtractValue = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_SUBTRACT_VALUE), random); - final int heightRange = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_RANGE), random); - - configuration = nmsUtil.createCountConfiguration(veinsPerChunk, minimumHeight, heightSubtractValue, heightRange == 0 ? 1 : heightRange); - - final int veinSize = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEIN_SIZE), random); - - if (veinSize == 0) { - return true; - } - - final Object featureConfiguration = nmsUtil.createFeatureConfiguration(defaultFeatureConfiguration, veinSize); - - return passFunction.apply(configuration, featureConfiguration); - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NormalOreGenerationHandler.java b/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NormalOreGenerationHandler.java deleted file mode 100644 index 471dcc46..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/impl/generationhandler/NormalOreGenerationHandler.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.generationhandler; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.utils.GenerationUtil; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import de.derfrzocker.spigot.utils.NumberUtil; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Random; -import java.util.function.BiFunction; - -public class NormalOreGenerationHandler implements GenerationHandler { - - @NotNull - private final NMSUtil nmsUtil; - - public NormalOreGenerationHandler(@NotNull final NMSUtil nmsUtil) { - Validate.notNull(nmsUtil, "NMSUtil cannot be null"); - - this.nmsUtil = nmsUtil; - } - - @Override - public boolean generate(@NotNull final World world, @NotNull final WorldOreConfig worldOreConfig, @NotNull final OreControlService service, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final ChunkCoordIntPair chunkCoordIntPair, @NotNull final Object defaultConfiguration, @NotNull final Object defaultFeatureConfiguration, @Nullable final BiFunction generateFunction, @NotNull final BiFunction passFunction, @NotNull final Random random) { - final double veinsPerBiome = service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_BIOME); - final int veinsPerChunk; - - if (veinsPerBiome > 0) { - veinsPerChunk = GenerationUtil.calculateVeinsPerChunk(nmsUtil, world, biome, chunkCoordIntPair, veinsPerBiome); - } else { - veinsPerChunk = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEINS_PER_CHUNK), random); - } - - if (veinsPerChunk == 0) { - return true; - } - - final Object configuration; - - final int minimumHeight = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.MINIMUM_HEIGHT), random); - final int heightSubtractValue = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_SUBTRACT_VALUE), random); - final int heightRange = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.HEIGHT_RANGE), random); - - configuration = nmsUtil.createCountConfiguration(veinsPerChunk, minimumHeight, heightSubtractValue, heightRange == 0 ? 1 : heightRange); - - final int veinSize = NumberUtil.getInt(service.getValue(worldOreConfig, biome, ore, Setting.VEIN_SIZE), random); - - if (veinSize == 0) { - return true; - } - - final Object featureConfiguration = nmsUtil.createFeatureConfiguration(defaultFeatureConfiguration, veinSize); - - return passFunction.apply(configuration, featureConfiguration); - } - -} diff --git a/impl/service/src/main/java/de/derfrzocker/ore/control/utils/GenerationUtil.java b/impl/service/src/main/java/de/derfrzocker/ore/control/utils/GenerationUtil.java deleted file mode 100644 index 8246f7e5..00000000 --- a/impl/service/src/main/java/de/derfrzocker/ore/control/utils/GenerationUtil.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.utils; - -import com.google.common.collect.Sets; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSUtil; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import de.derfrzocker.spigot.utils.NumberUtil; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.*; - -public class GenerationUtil { - - public static int calculateVeinsPerChunk(@NotNull final NMSUtil nmsUtil, @NotNull final World world, @NotNull final Biome biome, @NotNull final ChunkCoordIntPair chunkCoordIntPair, final double veinsPerBiome) { - final Set chunkCoordIntPairs = getChunkCoordIntPairs(nmsUtil, world, biome, chunkCoordIntPair); - final ChunkCoordIntPair[] coordIntPairs = chunkCoordIntPairs.toArray(new ChunkCoordIntPair[0]); - - final Random random = getRandom(world.getSeed(), coordIntPairs[0]); - final int veinsPerBiomeInt = NumberUtil.getInt(veinsPerBiome, random); - - int veinsAmount = 0; - - if (coordIntPairs.length == 1) { - return veinsPerBiomeInt; - } else { - for (int i = 0; i < veinsPerBiomeInt; i++) { - final int randomInt = random.nextInt((coordIntPairs.length - 1)); - final ChunkCoordIntPair coordIntPair = coordIntPairs[randomInt]; - if (coordIntPair.equals(chunkCoordIntPair)) { - veinsAmount++; - } - } - } - - return veinsAmount; - } - - public static Set getChunkCoordIntPairs(@NotNull final NMSUtil nmsUtil, @NotNull final World world, @NotNull final Biome biome, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final Set chunkCoordIntPairs = new TreeSet<>(); - - final Set chunkCoordIntPairsToCheck = Sets.newHashSet(chunkCoordIntPair); - - Iterator chunkCoordIntPairsToCheckIterator = chunkCoordIntPairsToCheck.iterator(); - while (chunkCoordIntPairsToCheckIterator.hasNext()) { - final ChunkCoordIntPair chunkCoordIntPairToCheck = chunkCoordIntPairsToCheckIterator.next(); - - chunkCoordIntPairs.add(chunkCoordIntPairToCheck); - chunkCoordIntPairsToCheck.remove(chunkCoordIntPairToCheck); - - final Set set = getSurroundedChunkCoordIntPairs(nmsUtil, world, biome, chunkCoordIntPairToCheck); - - set.removeAll(chunkCoordIntPairs); - chunkCoordIntPairsToCheck.addAll(set); - - chunkCoordIntPairsToCheckIterator = chunkCoordIntPairsToCheck.iterator(); - } - - return chunkCoordIntPairs; - - } - - public static Set getSurroundedChunkCoordIntPairs(@NotNull final NMSUtil nmsUtil, @NotNull final World world, @NotNull final Biome biome, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final Set chunkCoordIntPairs = new HashSet<>(); - - for (int x = -1; x < 2; x++) { - for (int z = -1; z < 2; z++) { - final int xToCheck = chunkCoordIntPair.getX() + x; - final int zToCheck = chunkCoordIntPair.getZ() + z; - - - final ChunkCoordIntPair chunkCoordIntPairToCheck = new ChunkCoordIntPair(xToCheck, zToCheck); - - final Biome biomeToCheck = nmsUtil.getBiome(world, chunkCoordIntPairToCheck); - - if (biomeToCheck == null) { - throw new NullPointerException("BiomeBase for chunk position x: " + xToCheck + " and z: " + zToCheck + " is null, this should never happen!"); - } - - if (biome == biomeToCheck) { - chunkCoordIntPairs.add(chunkCoordIntPairToCheck); - } - } - } - return chunkCoordIntPairs; - } - - public static Random getRandom(final long seed, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final Random random = new Random(seed); - - final long long1 = random.nextLong(); - final long long2 = random.nextLong(); - final long newSeed = (long) chunkCoordIntPair.getX() * long1 ^ (long) chunkCoordIntPair.getZ() * long2 ^ seed; - random.setSeed(newSeed); - - return random; - } - -} diff --git a/impl/v1_13_R1/lib/spigot-1.13-simple.jar b/impl/v1_13_R1/lib/spigot-1.13-simple.jar deleted file mode 100644 index 57a652ba4c34e29705d13e00a8938f3d0f7f63cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23242 zcmbt+1yoh(_ckTn-ICJXAWC<)lr+-a-QAtiAW|YJ(k0ypNJ)#dG$P*x#+i#cKb`-_ zT89H`-Fu$r-Sx)a`^ZUxL!g6P|1?UY%HI6(*Dnab-O|vWLGE8af%w-aEKDp7^=);H zfIrJ1fA?t^KYiBD(ALq=7U=QRKYWGo-@f9=^puI^sRGmA--QP0kVBQN(u@M%1qA_F z0|x`kmJ>GjQZ?d%d1q^-vIkUc&}K{Qz6&9KVNfUS

kOyUO@UZL- zY&{zqjFJU0Z>^T^k`6#y_gqS+f%j^4L#?Z=E9JDSW~XE~Bs_~5$s};4tSdHY#xZY`_(`vDk8n~;g;qSHD0RDecwE~|_9c-gzhj2k;5a+;5r)pTbr23c&Pna%4J z!z9Q>#>s0PI)Y}STt<%;93zF2U#3^zcR|8>9Q4tw_JAqF zEYCJBN4u5cQdrFERBi6?QHThc5{2Z_CdkFrac8=HqcpVkx?=}3$72=h}(<2@H+ z@9H@cH>e+q{pu?hhwqVIUy>X_qQRI@D@FLSktBjAzw3dpVZtgePrw;cf(_MWFLGkM z!Wo94>Z^jioqOMn8yX}BVE$Zsnv&uG3(^Gx0ipZ71({e`7+#yvUzQ`^Cj-WhToSVy z;e8qkg_MboWXbO8XWgP2oYf;B_Ao}5z~)_LT0bJ$SD$A6hsn-+;9n{Akx2F-2@7Zx zwUpp@C!`HJw>fr|h{bYKyk)<8L`qg9%)}I)5n%U%D_Dk*t#V>@zcd2zQiF zzK9ulF>~~rE@U2RC!CTmdp?-7tUaDQghv6Jdrh)ZFK}FEcWucBykykR#YNy(6DXMT ziZdTSPc{kCUk#x#$vJ=<>4}zgMl><74JK{1uG8Zd98t4)4h4Qu_82|025}=8lOREN z$RFjwr`kYtULzy90aSf7=C;#)ys18^*xXb`GT{=%flKIUQ6I*DrM9#<+KFtJU|x=0KHKEnNI9(6%r9OB+<@?+|_I{CN%ae%!(+u2r4Oy zqtnl~Fe_`+Y`R0fb_L12#)U!FH|P=H{bKu?ZE$<6rj%WMPw>~8mkc1Ydic3fxzODx zBK~{x<6XSS=U7Q-0(;}`%)0R@sZZCG2ag5U^T{ZlC~ny1l|gqGLK z_wHQ*a55utxnD`oDkWLb3*RPj*PVl3N{k7T;hxKRgO3>Scnfymx!0vgOx~4JjdmOT z7C<^004Y)ZUP{+-@4Ju&0760!7}}Q2VVarYKt}PxMC5l0g}cWe3`;$i*u%LwZUQ!D zGT)c5*ao$io#!-KCdpyEhQH(F_3fLNCuq8UbXG(Lb|dyBc7y-MXnfaGlo`=(L4oxG z*9m`ZONmRyH1wIqcWt)J?`X)k<+#zlGH;zCv5@1hb=N(>QFU${rqs{z(6daZ_CQ@ zMM}cN?U{JJuw4$3?-i+6yakkDPNTZM(YIL6YaQs0hCWftz>0~Jq#)#`lE+owb?lSt-OQ#RD zyD)k4L@{}@5``_gxO3a5bj+D+us?(obkSEsY%df-^IOR18Sifu637f0Dhw0SzX-u& zkHIksS+rRF+{@F;5pPAkpwLw6E_!D9$&9QHZ;z?Tyw3Z*>y_A7s>0{q>Rf8sg;~|= zd_x;tvsqY9Y2@k8%T6WDsXmQ=oRJK$?yE7Xm+S^O;bVXyF#pyW1)n)snu!`(8rtgGTiMo(>8!NUYV4>I97OeKPO<6d_%l5EQ=7m75`x`ZZ{h)2czYIHK9AmeTi@`XzC4o zBkbg>i{y5jS}3{hprFto>W?2P(#TMUc>2c6f@VzH1&S`eBGU3yhtLM)V98iKVa7~2 zQ*34@xY(p0CsXo$r?#!2E6_Y)!kWqGYW}23l1yiv#H?oESSO#QRL>#;cR&UI4Za3K ztdhWvh|S<7b$Zgu)mi4=iJE;v&%(vq>UbD`tn@Gmf7N(zcP|=O9Brlr*?+`x9iz7M zs-q?W;s^kUh2^(m`CB6V`uc`;-<>2{+7z%X33!U5PqB92Hs~wgC{C=F3UM?MWhlL- z#D_#~?qfb_o*=uApbz7xVCn6%6~cUrPk6N_^tjT%Punuu656WUBHHLa>b5jt^3>>^ zH)TkSl0M{ZRw8iYogQ@PihaHDa8u}chEX0zn^l`fmRFD>hox9*H!o&ew|rftAViWa zO-ATyGpBCb@?##%WyP~siLbXj3~U9RdA91I0u0QgD7p~r8+r6T!<38aSwxyv!eq;! z*ODL8l7nRYvQL|9Cv&{B|yu`bxTX zW@5UQ2Ihu;IfP*Z4=flHU_4#2Exo;lr_gUe@kS)%EWd5-6@er0b+XH-ZsC8@>si>WgY}@LB@Lw(`IXyl+lP0F+NkDIJQ$RnN zj6L2&6()NAE{x2qzLhj-b!o*I(|1Ym@WMMFTxUTpaN$k= zsOsAE*a*x#ngHW*19&L?AC5~%*IxIp)t8(&EFfr=IEK-j!yPRlA7btkk-++9Aw@IQ z5aUuX${cVaJ!%mR(SHc7-JgxMv00o$IP`&_1)2`Z0SW<1T7XT5B|`5?YUB8vrc*>y zptC7al(eiwagxNrX~(+OMi}xCy4nJp(gbw?qMEx$DO9YOujGW{IN~J8FlD4aFD8tW zyMl1N%MFc2d!Z}j*o9C;rSXy%asCl><68s&!E(DcqTQ2j*8o1sDe4)W7ebWT=Cxqd zPn_fijJAK!@MkDk)f9jP1_2lAe~^TjmASz`Hp>f;2fDxUW!S6AeMFTfzADt1)Hy`Z zYak!%9|+MBWu|6MCkzs6YRF9j*nv32I32X-m{-M>GvBTsYR}Y2w`2 zya#dbmbvs-*ZQu+b&yvBl;27_tVSHuWW4+kh`(*?p^Ntw-lwG^?qs~8(%#{qwZ?#^ zj}eh#pDJEjQfJD269&3Uu28RG2k{M?+tYuPemz@(FIFfF0EQ^|N3)gq&2%MaYvpM2 z_dpY(`LCn0uoup_K+J3E3a9S&(RyMr_Ag|K{>>+TniMo@Ddx(Aqwe$$`6DKUIN?$l}eV26o-uS$T$ zuJ)kE9!~u20r{9@}UP_eKNukIz-*Z%~PSG2d9Frn(d{eknh*Q z56~_ZMj93rULzslv8H!Vf4;l_b`G?JaguSIaWso1{4LpF05v%ie(APrQmDk9)C$u= z5S4K6;T2;;L{o6CSSTau=f$*|o-DT{1(7Q8N_A!%&Coc3p3h4eI?3yKr(8W$u}gW* z{FNjZyJhTHn|RL=?|L&`|!14kJD0`xc<5BluY!^ zboI>tIsl;ym%g4r{V9%ab$6eCh^P*A+`|PyRy+bl?=M@HmNaJS*K686xpD{H%3?FZ zwF~GxJBw5~9t>+cu(mlKj7XC1OTn1rN9EN-#yd;hAZL=yGdF!*DjV447FFiz{V)iR zAWg-b+A;uEus1cnjBy)i_PjR0w@R1-?tnoA0j@uoYE-Rk%?%U`b^rEFX`qQyqE`1K z=>{$YjV>*1kntK7O9%WzeN5wzV4CsRrEfb|S%bc~KF$PTufRkLd(pbZI6Ki-1E*Ip zMF53hK{p#(<~nFz5gxlSBfQ_cF2pfHD>2PxIX52p4Z-j1eRj*fz=a~iqXb|6fCboy zUR7+bA4am*!l3eBN1|$L0&u8XOZ??X_`|4zu%E{g8!h6z=7hsq%<1S?x?KWXxOstm zS4q8F$Z{i6Nd@}NPMG*qW&5k^&1-0QC0}l^7MVfbUHR-v2c8D79JL> z`Lu0M&&EdZsrEo0>_mH^SLrRG{GMz+)ew_7IVU*-j0rCfFl$X`OVwPSa$Bx?6MJsd zMS2PGzOaws=h?S}Xcro^=`?(;jak{!$CllaIbbGCPvC$Um+H07id|z@wpYr{Z{B0& z@sij;QtV{{ouQND`zN253T^3UgkF5mzVwll-@`5$XPi330Vh>@OR^zFGmtmxmzXMj zWKiC#ta|~fGQ@+CbRjK16V|NZ%1q%SRK5C<5iBZr_MMxwNtmMO+^~U_i|7DHb~|HC z3$)nravNQk5QmO*{uy|9J5Q4>}$*8By)>GlB^E#Ug! zYrMNb(@^>*X!4HrvHEV1syyij@mwnz!9X$>Wh^lb;dMEB_H`d-!r+9glfrmR&m1_ z(GNq@EM=IU#(r_Uko9H!Te`=Pfx_aUPb*_lsRlz;$?#&|z9MzQIAgym#xc4|fd68- z9_*7{Sc}Aqi!j5}QFPgbcX!At%Y`NJ0K1O)qnyL{A%CCq{@QsYD149rlSkJQ9T0z= zmM~|p7(a+rfrH1HCC+n~EkzDs_O^gPLzXe0Yt3LYYOj2_8^#~!;5lk@52 zyMRPP;Zzuj{{Xb_)M!Piu4p^G;GXy)&Qbv6uFc$vidJ(eyU;)nqmV?UrA?t3oGHyZ z722SLBsUjq9F-rj{q&o{8Fzm5rGgJ7unqk$3*@XzaXAnyB{7iVh}Y#Eu}AMoa=ONe zn6i6WA4XQVwN1Kxk~q&(koqhvpG45T^VCjs`0aGI6I!nGBsSxH??ceQ@V6a%KJ6DbO!+L-!520Egpyors8P)HPC%&s$(Zs^~ z`{bAqt04)-kKR4xtidKZR+&?nISP$M<@zis02<7ON^V*er?yArm}I$Rv9`D{>-s#J zn)@YVH0Zz&uai`0syXjH+X@pSoAn5)`5(``-a|W< zR4VoWR7MKOWB&d`{ALkwJ834wevtWaeUL;hBNYzkGb%8YA0Io+ZaF?*T?`S!C-#wu z&pHI(7)CN&b!O^gwKpCay)y_QER$I}2n>le3ky%CmC@C{wsyu-kW;_60q~CuW4eqj z3aZZZ^kzC#(O4cdr6e0xJY3xg;88eZ3%rl<9=+N@(kVO{2V3Ms?5>T zz{3#)c10NH4g65=?(ngd;?4=W@v{4vtCy6|N@%80*~+j(Jz7@Xj>d_<$U=~O9g6P7 zs=*1bEU^iUfpt)eKzylbQLhZx>|=bY|5o$T{}F{a=`5CXU@N!PXSy}GA*HReO7T*W z7u^!J+m5fN-9Lu7y+fI+4teVFF;hz|jah;4DY|+Z#tA)P9o>5o#9Ve-`00xMwk}2y z?1JakY;RI57f&taoFhjg@F)ZXPE{M}bxl?bv}?GA5Zx znI+XX2%Y6jF)f`C>@rN&vz>@@x)F#x(>PywALTkd+d+KCy@>aAn;>u#@vb zAMV`Nir-dH-R3geKlX6FwB2|UgF_6k2TXtq|Ne~V#vX3=ZPL1yy2jrZR0;CDvVd)y z2PsrgutZhcj=;Y)@(Rdy4ME!sOeU533jZ1Nr2bkYLyy9&Tx21$qQ#@Yp zHuiUSuYch2X4y)L7G&$N3|0^375J!$x6J@u@0u$LJ>yseoe;^sY4iw>@_mAzKTUOH zgyCqMjPYq9_US7b82N5W1|!;#4EF;PWy|bzHKEImDzEz?qMu`R-5zp`nVGDJ)j!DQ zRA|cI4%f>3OmkS;(KW`CW?EiqQbxoet--83(AAvcKkAp!pr*BHUgGx@;knd`Kw^xj z578ukqTIkZNsJMhB@`NlTieLO163^o+1CV6K~sxi`^BK1@{?fQ(J_ls>0i3bvyxVw zV)Th=Dh=ZF&(ge6YrMU&tymsx(M~4-W#q3{;ui&^nArfC&jNh#4`mKGoD(wCw*orY ztyYq}PP1gbdNpzGIq{m~z7Az56dD-rh@^*(pD%Q!^!qodJH1AVd&VxP4^P3r$}i=W zc0!G!GexIN_joQmbfhS^8e#ycfC&?R*Xj<62`eY?u0a5HnRq2pbr6~M=>%7slCYR( zJgb=|R0(E`aZQc@W(E`8sKa}c6g(8tc$!$e2JvXQ*Jk?NnzeN`8mli4x+YAfAE|N| z-?y&s7R*nPpW&zUSaqwrTAam=??(XZCKWLV7VYyGhFGx}m%%>ZbUZgdu|jou-_Dt! zF{$UMCuH!P`HAX)=johSfD;8ZrU>OHgA()SEOF1~X@*q~)LBsnAc;R2q&qlqth^Va z!Gg|J9*N$z3Jxl3ZoI@2*nKM7t<~47z1jsm9ZaxWP9dSnpfC7_3-ZxD@|fe}Q3S~C zbq1%l&+#Zs(-l!>wGUZYkvfYd?BAUTb1UcH*MFTU(ADaz3&Ep-%1hgJc;Y>Y3P0i% zKscH_8rwf+8pIk)sOZ4m>l}G9&D00rV;3-h)&6f6fj52ztaD)tz@fgm!EGp>Pyr-(_|O~UIK}b6 z=n&As(A6_ts;UJf_@#rD;O}J@35Y9^u}^fQ6cj{iMQn>{?P1ZL23t;fcYwWG%SCoF zj~nH~#Ve9~U1#^uZpb5jKm5zlhr%I{3WzV_!L1n(2606E^q^-D=+GTBsoB%YU?b+1 ze%^V>79u)11vut&pK7qJMiV1h6xkH>&mmV+osTKV-85c9KPYKgMEEM^$6}j|yRN7%Zz{I4+2zS-Hv6RV_C;f7KsjRUuxhrwfh7$p; zhlZ!9_W6l*!7R;e8sVxin5~!v?~)c+*hi&fXL5IW&yf#LHApIuC0wE$qguXLtHXcr z^Goi_{a~k$SmX4ZkDO?z+>r6&@S}cJ?Zq->wLp&+6~x>m%8j|ajEWpb1PLf`UZl?E}wS6FEbzbQ?e^q?`9Q_>5#@7|8 zQE&kQewcxMW!t*LY%%k#LA!lj?dPgLq7tZ)e zMm#w7K<)YsCmWTcKIOn9cR2VAwxO&0j9MesgJlGnL~GiE((8%%Fk8du!`kDN=}fZ( z8;>l6*fd}lbF;{?TxumF13w4XQBfAj#DHYzL#h`@h0Z81X=<7f8#fTAbBg!0|MHLOti(I0`s zRRz~zmM&FSYu8oH5h=&{lGPQMl0|?jpgm31O=(k`Vsj(j@AT4LirNTcNIlhYKNiIq z+A6`;pli^R?rl%8avD4ts0WDq*1jS80QOx9uzPpyO7aUk zKZ`eh?61|U=DIoT925&L=}c|*x0;pG32R}LK114#gDTjE?Qj+kln}oj*R^R-o3TWn zSTC5^eW=$ZSdfP4AoZDPc`j2?kYdKr5X>KSv^P?oA9U@N*_%Q0hKF5RpX zta&Oi-nf-@vCe5NrghAc+At@5KE4-rW)La@3EHDO$j-PGnEa_k!n=_}Luhl)7kI%E zydO>{gTEZQa!uE6KDWu6$=(DQ_qJIa7b3?S$NJEhNnnt>45OnDRjTr{Gb|6vKCTMA z`w&{wL@4*UHlT>`Q})%%P5iMi0d^P!Lf1-{Ji|*_@&k_kA_X*bilUSIRwEps_e5GD z8wq{4z-^9WrN^r6Yg#)AUfFZHDOXY4vk^mfJ{W2fYZd1VIGHE&J$;NGix`%*XdHGb z>=T?mEb}ogl(dy8@d|o{*B4qUH=-{oS}5&cA4bR= zp2K1I{-w8kg}R8Pd?uWJngBb0NJ+>IwQeH}ux?PcdvBnV7`OU@v4)?TYVy-GmPNkB z95x$ie{W=ly&Zdh)uT#JY8|eR28SH&0xU-AVcaRmNTVQNM*b-3KJwYR9nZ=Ws2t)t zZex-gKwj6_kO2(*x(@JvZ{B~3+jopx(8|)t#Ml8aiT_3!b+8OfQ2p}>gMpI_l zV-y`J`=8>P2U1r>PQqJ&tYQ|y#z(xMb7p`1L*Rjj4y*|Q=!Fsxc=-RjZe$GYpBdWT zYUqc!gRU;55vH;~Gl`c}gO_KjKq;=J=s}bRs*uYtP$8vDyOpY&*kOF-zt3^li6!mM z_~;@x+}Kf7%4~b5m@OuVWnnOVSF>q4Wwq~p)N>FWjKo+*P$$%AX#sd!n0FLed_>wG zA0*w(t7&{vwcOz?_7Q0%mPj*FRnHotSYEUBWnEfO*SQ`)(68(cf|xXW5H|xt6`0ka zfXB?FCxD0H6q=tQBJXAz;$*=BHYQXQp#ISAk)ypm*_dy3PQV1 zyY6(i*6#G$e6nI$V-{)gbnHnrBpc6UOVm|`6^@(6WVEDZ%BnYlB{Q`}>meZ<0{f0i zt-0c6VtrpjO_uIbeJ9k>apnE~c(=$8tT{Pid~h!+B;QKvkf%@5m;3Mb%NDzty@W^< z{Iol|gE9sCB4AghE@t4s= zw5m*QR66_Gv57ksIdlZuN^wrog%kqwDu>n8-mfCjb6j(}uWHB7o|nTr6%H@%Qyig9 z94~CLs%#*2z-(UjT^u^JfGq2^&!aRk_;CmH6d1z!S=c&g&=OumXvu5D`*M;&k6&3* z-Au6Ye!{$!++Udk4BEju_J+dGg?);ehGmxG0!dqKNUlKN@j##?3*b3X5Qng@epCzw zVM>hB4*l8%hZ?fO2M3)xj*JSL-Tm)UL#Cx`u;J;-3b;RX{5j(5QA0#r)j@GX89h2fU7{N75iiW3B*QH z4D;t+G578NiiL+ z3F^00<{mdw=xjgoXSI*IfT&b%t>O|2$$h4p_DGSmpkKZ$p|94I>x&3=xm_!SqLQQ` zikNiT+=2)0+SQ7Z`IHLGw#sZUzhCVkd=P`pv`zA^220I{Mn3qaDDCYr6gKby-q#|+ zqKL+yhIl{0m*o$!CAFo#Zh+0@mg`T<>6-(g37YAr^O@jw5uR>`Ib>kYo?C}I27aoJ1l!BJ0cEtVUc_l z6<8>u;2L$juKj>ck|}GiG-RJDL2HFNQvS1!+?rw8x4e11B3k#{r&hRGzdRWUJ^z^e zv58)IC1OJ?%Z1~hOF-8D_(6ioYRQq@er5upqh&w|EMcemsRuo{4JlZ@OI}sE9?qGB zW4pFgfLxDc;B0QF15t6di5*jU%O`KyIzJ42u6HEsIz8U{IyhW`U03IZYAgti#7Vrn zWxUAz9g9N~%c_@A)^C(7mmqLlbpwUf)Htxff|HE4`klFSU7x%;q5g9O%elO25MkaAwRm>$$>4fS7vhn+_Xe$fr>pJ|u*2M$LlGj!E znbPT^f<*c8eBNNI)3q4t$i=yQVq!=_&}{NCbxM)1rIWhm-$jY7avZhYBSQ>k@$!Ld z_5;_O{Hy{iFFspT^r%1F>EyzwX*%Ze@+7GoqyiF25!sIirY;Ta-VXVqCm11eFjjKs zEQ!y?>{m?C{Ct{rR{)=8v~MPomGyV7TBSiYJSn z39rc1yb!jS6Rvq~C%D1BB5#=l@5ddF5{221&0uGra6$40V(gi)Jx*mX z#t23oZ0P;fMO-8F>DLGG{e(p2xs4yYS>nh`){TgEG1kylR0z2E{&PI~d131j`Mu0)$U8v;Fp*>>lrkpz zVkQcPTLr>1`54D`KB)u2A{W78tgTDmw7w}=!E}gt5>el>gpZ16T0-hGL0-{7@Qx!- zUvCC#VfxXlNcPjCtk;-RE};jOyf~9u@kmQjw69Gk3V5lwjF8p7;g6au^esCOp-KAi z1zf>O_o^m){;*`kO5{Hc2Mq7J-b(zx4ihNg{3Py;z)^}>K>S~BgO*qUQ z5SikCWyiIAZicJ9+l|)peYog=;g$l1%T>{^(^Gpr+!&Y={ly2T^N24h5IlJ|OYY&y z%FmZjw7-cukVy|QRLPjJ7bU+^fT3+>{#12;$fU`OCakX{WSr&E^BQVF^_ zS#=DH4+t?IGUu;4XswRUhrJ~;j7|}VC)G_@f2`NdTYRrwxgdWT;|VNHK_o+-Mc%43 zvkYQ)EsPgqO}eHSZ+zQ?N@h=++Q)F-^2}K~(?g{JQ`Gp8ZupUm7Z$`py&R{0M>_Pl zD7j(YA8nPtFdll)G6ZDqr@7O^bw__=xKw3y9L|v(h6NQ^TYmr_Vl(t^8t9{9gtBZ*tC;yQ!-8_z)$eUsZk8 z5_a9RL4hG0dW4FuwE4<>)M74ntJe|jpW|Nhqa|?(2CFsRwMLw^FP|^LTbNu?QUQX7 z89}%fG*#&=m!O@M*Sq1(v{wcjc@lkT#r=66$WQns7})A51KX&FygC!z6zl@~lq9<) zD_2yc@SjU+NcMd;h{uoELH+j3oT(|%l_=n4$y@5@bCL@iA*m`VoQ8)~g7#L_X?;Ei z^$l0th{idXOf%5f^eVH1!$&4>kzISOUZ?aEwD%}vdmU8xL3*UjgCjG0k?V?uyUA30 z>_Hw&NQ0aC`(X7{%3xo?6SZ}<5i%68H~-+snW}o{-2ee20?yC{|ErK?0ZXW#LsqGx zmMj`SI&ZBOWhu>5l2GW-13A3qf~C09T92%UXUpN(>z3=Y<>_xJ3ab$-I}mQ|zGh5jP!?7W)z{vIv*UV(Ql1gig;wWPgp zv^oaVwvwm{IrpiBfuwL-FK%{S8Mpe>xLDf|9@2Y3I*W?js_^h%UJnq-#pQp z`KpM3yRbwy^Nqfwi0-{wqi_+t3^Dxs1Qo{=(0& zZ=pv0JaM|HAtLNVejIUnuw!PO7`bPf1@-o_0*=V{Hr#^P0W;0KOvzCo;9HU^y zFN#-fNe<}Bs#Lj2H8f;6 z!J5f*!u8(sY8w5j{B1wu@;#$^C&V@EIji8vXs4z45G0o4$s`<;9n`zd*qfxR!vI)* zl>+SK&(GZz?Ez)?LE-eBWf)fPnca(7vx`SCdD#W(j2k;?{bEOg<4cep&#S=6LkouBSnM2^+aqw%A z@ofwCF69)i@Ix;ZAXMJRv>l)E>m2z%Ms8xGtb&cwIPyK3{4#fGL5v5w8+^DcAPmVn z=l*0)5rSb}_Nk#`%UqL!LchUPZg|b7ZMZ-{P2KKsgT=?@j}}QXhZUaN-r1=y2oFGO zHR*X&NcRY)sf-GZrBry+8l-o4LZ5XMh|iNJef1M}P`AxPGiRjDBsHM;khityCm0vZ zksi6izfdSK5)RuTQNttQ$(yJVb7^TZgUBuxJF<7)M5oPFhRO@7rO5gKb38yY+1WdY zdlEZSrrT%?E{`k-BJ(AE${fXE1#r~J*WQd4cZTP z7i3K-6X6a+;azQGY$aYmph}v8fMj&rpolYS=FCyMREO(V$OfkqpT{`nWo*%&A&Dwz3Bz421WP z9u4ctzojG*Lf4gNM2*sQ9P5Hf!%5EA^19CWfqKSIHNY-0vB=F$MCH5~DnCI2p_nqy zjkNSW0%-)n1KXyNC{@(fAVr?X6)b!H;$fj?mP1*@F&5a-Tw^w0u2nbLa7cA_!x=5{ zNl|P#P2*GnH6C@L+2ppjX5U#&2V}kG2eD%7`e!o}m*&5t5u4Xt6gDv+S7) z7`qR(3~EWde}nq%J#T8UKmc?FnRSJCF<4S`tqB406`|`P^Eri~tvZ=0Y7?J8e(q@HAY&XhwT0%$lf*dh>B*Vx+PF=OIZ7w_@U{`ojVl z5(oO~xCX%!1Ls|Cq*sW3+TxigB@`)+-A`ES$85^LUcht{xU~kS;Rti(kA$&o_t7Yy zRv1}wx?~Z@ZS!p~tSEbT zU0XtX4Cf@$JipcIK6S2qG_5HkyBA(X7Y^sT=m3hU_Ektk{gTSG;pN|zm%na=x3V?< zJGTueZUfX40L1_I4;rd!8n3Xuuyt|Nf=F z8z%1B$#abhPBws@5CH7ty4n(m8!+VG-xj=X-oNq0zdSHz;QBlzKvq{LT^GG$p_GR& zpZLvK9WfLAgVf+w@=x#>P=P6V=}yZV(VQYDA{H#Foa6{HlcD%t#PH zGQcu+=Kg7#UC&4=agcA5CgyMern~yQdB%a~lTyF|Gqbgei@6=8QCmAMK9cYhd_;3? zha3}YlrZxmN2^?5Y97X;mu;X2ho|uOa3h(r@Ar(PKcsq7wG@xDDzJ>OMgD40H;zki1VhWYtD55O=!KMmu@<{)4^Pn8CqYrNRR+q?0h z^hg@u|9|j)^=^poctilK#^2)o%bOyAX(acs^~%+Z|q-n+5&SZDtOFxZSbX3ayR1_RQ{R6wF>SwvI296227s+o5SDz zn!x>lz$9c{nQxR3lX**mCiiC&*GjnCCJIcV7XFV(+-({Krt!)u@m7)e4p9m|w!RNWW#orJAHU8a>MPU4gfNA=F z8|7_>>NP%a{~|DpVv3?07K~&HH+oo@`I*JFd){p(1ZF{j@>>?aXe|WhfGsL=vAb_-u2`)l~S?RLQM&}hGf|6XnX zGrSH(+>Hh{SQT$HP@eHK{Iv$|cD(_^UoYo=V+VJ8;DASuvn_BVe5sVWn>EV!JMh}% z+7a*es{zAz{vQ5j)ehXf2FySM?$!|pd~XF1_xWc5Tr;@aX9mn53gfo|xM2X?bq379 z%)sMD1$D!>48l?pQ3;F!(S}Ym^N=c!Q#y=4Yi41)41E` z0!#xN?@ws}cfH(EL}2`lC=8&LZxr!}ROu&ExSk&GHf{iO=)?aV2cSJHFf=oP^v#sW z<#7wmF7Y$;bs)IgBLEEj0q`=q{~ZW!pnvWd0H$HZdm9kEJZ?8D-#0Hm286q1^T0G@ z0XvpIpaEP^{c~94b_l;w1m?l5G{91Rmd15dxLe5$OhXW`*Zhw(?$mVy3xy2ycK?9P zr*dN!kj=klbGP^wm<=KMe`a&1TJdKIxlV`ONa!NsmeU!$@=vCEEup(LlfaxVDE|LA z{UU1vEHntth#P`yA8rZmvizFh-NHd&f=Pg$sQ;)!nV-rCfhqN?zr3L|MWuS9$1$IO zp>(Il3z(7@pl9^YC;?Y|0dwGpiN4`b<8;fRap>0^?$#s$b5NxJQx4w?SN^O*37Dm$ zroj!%tj=4O<;TBfdAFbjnB_yjq28ZK>O0H3u#ohAc8 z0_|=V3Yfxk-an!MoRb13&@;ezvrKClz9qnft@eZU{wg{1oxt_UI?UtSWC!q5Wjjev zuMbDR-}Rkt|Nm#z^{a#q@Kb62dg@=98sLZ1HCa5mKL7fD{|*BD@Sl@Fzz - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-v1_13_R1 - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - org.spigotmc - spigot - 1.13-R0.1-SNAPSHOT - provided - true - - - - \ No newline at end of file diff --git a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSReplacer_v1_13_R1.java b/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSReplacer_v1_13_R1.java deleted file mode 100644 index 37b8f83e..00000000 --- a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSReplacer_v1_13_R1.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.server.v1_13_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -class NMSReplacer_v1_13_R1 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer_v1_13_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - for (final Field field : Biomes.class.getFields()) { - try { - replaceBase((BiomeBase) field.get(null)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome field: " + field.getName(), e); - } - } - } - - private void replaceBase(@NotNull final BiomeBase base) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(BiomeBase.REGISTRY_ID.b(base).getKey().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final Map>> map = get(base); - - final List> list = map.get(WorldGenStage.Decoration.UNDERGROUND_ORES); - - for (final WorldGenFeatureComposite composite : list) { - replace(composite, biome); - } - - final List> decorations = map.get(WorldGenStage.Decoration.UNDERGROUND_DECORATION); - - for (final WorldGenFeatureComposite composite : decorations) { - replaceDecorations(composite, biome); - } - } - - @SuppressWarnings("unchecked") - private Map>> get(@NotNull final BiomeBase base) - throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassCastException { - - final Field field = getField(BiomeBase.class, "aX"); - field.setAccessible(true); - - return (Map>>) field.get(base); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - private void replace(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replaceBadlandsGold(composite, biome)) { - return; - } - - if (replaceEmerald(composite, biome)) { - return; - } - - if (replaceLapis(composite, biome)) { - return; - } - - replaceNormal(composite, biome); - } - - private void replaceDecorations(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replace(composite, biome, Blocks.NETHER_QUARTZ_ORE)) { - return; - } - - if (replace(composite, biome, Blocks.INFESTED_STONE)) { - return; - } - - if (replaceMagma(composite, biome)) { - return; - } - } - - private boolean replace(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome, @NotNull final Block block) throws NoSuchFieldException, IllegalAccessException { - - { - final Field field = getField(WorldGenFeatureComposite.class, "b"); - field.setAccessible(true); - if (!(field.get(composite) instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration configuration = (WorldGenFeatureOreConfiguration) field.get(composite); - - if (configuration.d.getBlock() != block) { - return false; - } - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceMagma(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - { - final Field field = getField(WorldGenFeatureComposite.class, "b"); - field.setAccessible(true); - if (!(field.get(composite) instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration configuration = (WorldGenFeatureOreConfiguration) field.get(composite); - - if (configuration.d.getBlock() != Blocks.MAGMA_BLOCK) { - return false; - } - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherMagmaOverrider_v1_13_R1(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceBadlandsGold(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - final Object object; - - { - final Field field = getField(WorldGenFeatureComposite.class, "d"); - field.setAccessible(true); - object = field.get(composite); - } - - if (!(object instanceof WorldGenFeatureChanceDecoratorCountConfiguration)) { - return false; - } - - final WorldGenFeatureChanceDecoratorCountConfiguration configuration = (WorldGenFeatureChanceDecoratorCountConfiguration) object; - - if (configuration.a != 20) { - return false; - } - - if (configuration.b != 32) { - return false; - } - - if (configuration.c != 32) { - return false; - } - - if (configuration.d != 80) { - return false; - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R1(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceEmerald(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - final Object object; - - { - final Field field = getField(WorldGenFeatureComposite.class, "d"); - field.setAccessible(true); - object = field.get(composite); - } - - if (!(object instanceof WorldGenFeatureDecoratorEmptyConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorEmeraldOverrider_v1_13_R1(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceLapis(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - final Object object; - - { - final Field field = getField(WorldGenFeatureComposite.class, "d"); - field.setAccessible(true); - object = field.get(composite); - } - - if (!(object instanceof WorldGenDecoratorHeightAverageConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorHeightAverageOverrider_v1_13_R1(biome, serviceSupplier)); - } - - return true; - } - - private void replaceNormal(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - { - final Field field = getField(WorldGenFeatureComposite.class, "b"); - field.setAccessible(true); - if (!(field.get(composite) instanceof WorldGenFeatureOreConfiguration)) { - return; - } - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1(biome, serviceSupplier)); - } - } - -} diff --git a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSUtil_v1_13_R1.java b/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSUtil_v1_13_R1.java deleted file mode 100644 index 9ffa5076..00000000 --- a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/NMSUtil_v1_13_R1.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R1; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R1.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_13_R1.CraftWorld; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_13_R1 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_13_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer_v1_13_R1(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final BiomeBase biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(new BlockPosition(chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4), null); - - return Biome.valueOf(BiomeBase.REGISTRY_ID.b(biomeBase).getKey().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) { - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) defaultFeatureConfiguration; - return new WorldGenFeatureOreConfiguration(worldGenFeatureOreConfiguration.b, worldGenFeatureOreConfiguration.d, veinsSize); - } - - @Override - public Object createCountConfiguration(int veinsPerChunk, int minimumHeight, int heightSubtractValue, int heightRange) { - return new WorldGenFeatureChanceDecoratorCountConfiguration(veinsPerChunk, minimumHeight, heightSubtractValue, heightRange); - } - - @Override - public Object createHeightAverageConfiguration(int veinsPerChunk, int heightCenter, int heightRange) { - return new WorldGenDecoratorHeightAverageConfiguration(veinsPerChunk, heightCenter, heightRange); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final WorldServer worldServer = ((CraftWorld) world).getHandle(); - final WorldProvider worldProvider = worldServer.worldProvider.getDimensionManager().d(); - - if (worldProvider instanceof WorldProviderNormal) { - return Dimension.OVERWORLD; - } - if (worldProvider instanceof WorldProviderHell) { - return Dimension.NETHER; - } - if (worldProvider instanceof WorldProviderTheEnd) { - return Dimension.THE_END; - } - - return Dimension.CUSTOM; - } - -} diff --git a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorEmeraldOverrider_v1_13_R1.java b/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorEmeraldOverrider_v1_13_R1.java deleted file mode 100644 index 9c5fbb98..00000000 --- a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorEmeraldOverrider_v1_13_R1.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorEmeraldOverrider_v1_13_R1 extends WorldGenDecoratorEmerald { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorEmeraldOverrider_v1_13_R1(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureDecoratorEmptyConfiguration worldGenFeatureDecoratorEmptyConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.EMERALD, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureDecoratorEmptyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenerator.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), worldGenFeatureConfigured), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureDecoratorEmptyConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } -} diff --git a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorHeightAverageOverrider_v1_13_R1.java b/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorHeightAverageOverrider_v1_13_R1.java deleted file mode 100644 index 4837f8f3..00000000 --- a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorHeightAverageOverrider_v1_13_R1.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorHeightAverageOverrider_v1_13_R1 extends WorldGenDecoratorHeightAverage { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorHeightAverageOverrider_v1_13_R1(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorHeightAverageConfiguration worldGenDecoratorHeightAverageConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.LAPIS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorHeightAverageConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorHeightAverageConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } -} diff --git a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R1.java b/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R1.java deleted file mode 100644 index 2c1e7628..00000000 --- a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R1.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R1(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.GOLD_BADLANDS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1.java b/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1.java deleted file mode 100644 index 5ec56eee..00000000 --- a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R1(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - - return nmsService.generate(generatorAccess.getMinecraftWorld().getWorld(), biome, nmsService.getNMSUtil().getOre(((WorldGenFeatureOreConfiguration) worldGenFeatureConfigured).d.getBlock()), new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } -} diff --git a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherMagmaOverrider_v1_13_R1.java b/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherMagmaOverrider_v1_13_R1.java deleted file mode 100644 index ae677436..00000000 --- a/impl/v1_13_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R1/WorldGenDecoratorNetherMagmaOverrider_v1_13_R1.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class WorldGenDecoratorNetherMagmaOverrider_v1_13_R1 extends WorldGenDecoratorNetherMagma { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherMagmaOverrider_v1_13_R1(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorFrequencyConfiguration worldGenDecoratorFrequencyConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.MAGMA, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorFrequencyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenerator.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), (C) new WorldGenFeatureOreConfiguration(BlockPredicate.a(Blocks.NETHERRACK), Blocks.MAGMA_BLOCK.getBlockData(), Integer)), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorFrequencyConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_13_R2/pom.xml b/impl/v1_13_R2/pom.xml deleted file mode 100644 index 68edc64c..00000000 --- a/impl/v1_13_R2/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-v1_13_R2 - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - org.spigotmc - spigot - 1.13.2-R0.1-SNAPSHOT - provided - true - - - - \ No newline at end of file diff --git a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSReplacer1_13_R2.java b/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSReplacer1_13_R2.java deleted file mode 100644 index 761901f9..00000000 --- a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSReplacer1_13_R2.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R2; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.server.v1_13_R2.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -class NMSReplacer1_13_R2 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer1_13_R2(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - for (final Field field : Biomes.class.getFields()) { - try { - replaceBase((BiomeBase) field.get(null)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome field: " + field.getName(), e); - } - } - } - - private void replaceBase(@NotNull final BiomeBase base) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(IRegistry.BIOME.getKey(base).getKey().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final Map>> map = get(base); - - final List> list = map.get(WorldGenStage.Decoration.UNDERGROUND_ORES); - - for (final WorldGenFeatureComposite composite : list) { - replace(composite, biome); - } - - final List> decorations = map.get(WorldGenStage.Decoration.UNDERGROUND_DECORATION); - - for (final WorldGenFeatureComposite composite : decorations) { - replaceDecorations(composite, biome); - } - } - - @SuppressWarnings("unchecked") - private Map>> get(@NotNull final BiomeBase base) - throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassCastException { - - final Field field = getField(BiomeBase.class, "aW"); - field.setAccessible(true); - - return (Map>>) field.get(base); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - private void replace(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replaceBadlandsGold(composite, biome)) { - return; - } - - if (replaceEmerald(composite, biome)) { - return; - } - - if (replaceLapis(composite, biome)) { - return; - } - - replaceNormal(composite, biome); - } - - private void replaceDecorations(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replace(composite, biome, Blocks.NETHER_QUARTZ_ORE)) { - return; - } - - if (replace(composite, biome, Blocks.INFESTED_STONE)) { - return; - } - - if (replaceMagma(composite, biome)) { - return; - } - } - - private boolean replace(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome, @NotNull final Block block) throws NoSuchFieldException, IllegalAccessException { - - { - final Field field = getField(WorldGenFeatureComposite.class, "b"); - field.setAccessible(true); - if (!(field.get(composite) instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration configuration = (WorldGenFeatureOreConfiguration) field.get(composite); - - if (configuration.d.getBlock() != block) { - return false; - } - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceMagma(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - { - final Field field = getField(WorldGenFeatureComposite.class, "b"); - field.setAccessible(true); - if (!(field.get(composite) instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration configuration = (WorldGenFeatureOreConfiguration) field.get(composite); - - if (configuration.d.getBlock() != Blocks.MAGMA_BLOCK) { - return false; - } - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherMagmaOverrider_v1_13_R2(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceBadlandsGold(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - final Object object; - - { - final Field field = getField(WorldGenFeatureComposite.class, "d"); - field.setAccessible(true); - object = field.get(composite); - } - - if (!(object instanceof WorldGenFeatureChanceDecoratorCountConfiguration)) { - return false; - } - - final WorldGenFeatureChanceDecoratorCountConfiguration configuration = (WorldGenFeatureChanceDecoratorCountConfiguration) object; - - if (configuration.a != 20) { - return false; - } - - if (configuration.b != 32) { - return false; - } - - if (configuration.c != 32) { - return false; - } - - if (configuration.d != 80) { - return false; - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R2(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceEmerald(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - final Object object; - - { - final Field field = getField(WorldGenFeatureComposite.class, "d"); - field.setAccessible(true); - object = field.get(composite); - } - - if (!(object instanceof WorldGenFeatureDecoratorEmptyConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorEmeraldOverrider_v1_13_R2(biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceLapis(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - final Object object; - - { - final Field field = getField(WorldGenFeatureComposite.class, "d"); - field.setAccessible(true); - object = field.get(composite); - } - - if (!(object instanceof WorldGenDecoratorHeightAverageConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorHeightAverageOverrider_v1_13_R2(biome, serviceSupplier)); - } - - return true; - } - - private void replaceNormal(@NotNull final WorldGenFeatureComposite composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - { - final Field field = getField(WorldGenFeatureComposite.class, "b"); - field.setAccessible(true); - if (!(field.get(composite) instanceof WorldGenFeatureOreConfiguration)) { - return; - } - } - - { - final Field field = getField(WorldGenFeatureComposite.class, "c"); - field.setAccessible(true); - field.set(composite, new WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2(biome, serviceSupplier)); - } - } - -} diff --git a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSUtil_v1_13_R2.java b/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSUtil_v1_13_R2.java deleted file mode 100644 index 48eda83e..00000000 --- a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/NMSUtil_v1_13_R2.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R2; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R2.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_13_R2.CraftWorld; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_13_R2 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_13_R2(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer1_13_R2(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final BiomeBase biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(new BlockPosition(chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4), null); - - return Biome.valueOf(IRegistry.BIOME.getKey(biomeBase).getKey().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) { - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) defaultFeatureConfiguration; - return new WorldGenFeatureOreConfiguration(worldGenFeatureOreConfiguration.b, worldGenFeatureOreConfiguration.d, veinsSize); - } - - @Override - public Object createCountConfiguration(int veinsPerChunk, int minimumHeight, int heightSubtractValue, int heightRange) { - return new WorldGenFeatureChanceDecoratorCountConfiguration(veinsPerChunk, minimumHeight, heightSubtractValue, heightRange); - } - - @Override - public Object createHeightAverageConfiguration(int veinsPerChunk, int heightCenter, int heightRange) { - return new WorldGenDecoratorHeightAverageConfiguration(veinsPerChunk, heightCenter, heightRange); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final WorldServer worldServer = ((CraftWorld) world).getHandle(); - final WorldProvider worldProvider = worldServer.worldProvider.getDimensionManager().e(); - - if (worldProvider instanceof WorldProviderNormal) { - return Dimension.OVERWORLD; - } - if (worldProvider instanceof WorldProviderHell) { - return Dimension.NETHER; - } - if (worldProvider instanceof WorldProviderTheEnd) { - return Dimension.THE_END; - } - - return Dimension.CUSTOM; - } - -} diff --git a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorEmeraldOverrider_v1_13_R2.java b/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorEmeraldOverrider_v1_13_R2.java deleted file mode 100644 index 040268bb..00000000 --- a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorEmeraldOverrider_v1_13_R2.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R2; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R2.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorEmeraldOverrider_v1_13_R2 extends WorldGenDecoratorEmerald { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorEmeraldOverrider_v1_13_R2(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureDecoratorEmptyConfiguration worldGenFeatureDecoratorEmptyConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.EMERALD, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureDecoratorEmptyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenerator.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), worldGenFeatureConfigured), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureDecoratorEmptyConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorHeightAverageOverrider_v1_13_R2.java b/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorHeightAverageOverrider_v1_13_R2.java deleted file mode 100644 index 7204dabb..00000000 --- a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorHeightAverageOverrider_v1_13_R2.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R2; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R2.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorHeightAverageOverrider_v1_13_R2 extends WorldGenDecoratorHeightAverage { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorHeightAverageOverrider_v1_13_R2(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorHeightAverageConfiguration worldGenDecoratorHeightAverageConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.LAPIS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorHeightAverageConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorHeightAverageConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R2.java b/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R2.java deleted file mode 100644 index 104d32e8..00000000 --- a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R2.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R2; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R2.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R2 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_13_R2(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.GOLD_BADLANDS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2.java b/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2.java deleted file mode 100644 index 7823aadd..00000000 --- a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R2; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R2.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightNormalOverrider_v1_13_R2(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - - return nmsService.generate(generatorAccess.getMinecraftWorld().getWorld(), biome, nmsService.getNMSUtil().getOre(((WorldGenFeatureOreConfiguration) worldGenFeatureConfigured).d.getBlock()), new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherMagmaOverrider_v1_13_R2.java b/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherMagmaOverrider_v1_13_R2.java deleted file mode 100644 index 180ee8a9..00000000 --- a/impl/v1_13_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_13_R2/WorldGenDecoratorNetherMagmaOverrider_v1_13_R2.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_13_R2; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_13_R2.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class WorldGenDecoratorNetherMagmaOverrider_v1_13_R2 extends WorldGenDecoratorNetherMagma { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherMagmaOverrider_v1_13_R2(@NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - Validate.notNull(biome, "Biome can not be null"); - Validate.notNull(serviceSupplier, "Service Supplier can not be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorFrequencyConfiguration worldGenDecoratorFrequencyConfiguration, final WorldGenerator worldGenerator, final C worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.MAGMA, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorFrequencyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenerator.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), (C) new WorldGenFeatureOreConfiguration(BlockPredicate.a(Blocks.NETHERRACK), Blocks.MAGMA_BLOCK.getBlockData(), Integer)), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorFrequencyConfiguration) configuration, worldGenerator, (C) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_14_R1/pom.xml b/impl/v1_14_R1/pom.xml deleted file mode 100644 index a705288c..00000000 --- a/impl/v1_14_R1/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-v1_14_R1 - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - org.spigotmc - spigot - 1.14.4-R0.1-SNAPSHOT - provided - true - - - - \ No newline at end of file diff --git a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSReplacer_v1_14_R1.java b/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSReplacer_v1_14_R1.java deleted file mode 100644 index 277ba368..00000000 --- a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSReplacer_v1_14_R1.java +++ /dev/null @@ -1,325 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_14_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.server.v1_14_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -class NMSReplacer_v1_14_R1 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer_v1_14_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - for (final Field field : Biomes.class.getFields()) { - try { - replaceBase((BiomeBase) field.get(null)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome field: " + field.getName(), e); - } - } - } - - private void replaceBase(@NotNull final BiomeBase base) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(IRegistry.BIOME.getKey(base).getKey().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final Map>> map = get(base); - - final List> list = map.get(WorldGenStage.Decoration.UNDERGROUND_ORES); - - for (final WorldGenFeatureConfigured composite : list) { - replace(composite, biome); - } - - final List> decorations = map.get(WorldGenStage.Decoration.UNDERGROUND_DECORATION); - - for (final WorldGenFeatureConfigured composite : decorations) { - replaceDecorations(composite, biome); - } - } - - @SuppressWarnings("unchecked") - private Map>> get(@NotNull final BiomeBase base) - throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassCastException { - - final Field field = getField(BiomeBase.class, "r"); - field.setAccessible(true); - - return (Map>>) field.get(base); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - private void replace(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replaceBadlandsGold(composite, biome)) { - return; - } - - if (replaceEmerald(composite, biome)) { - return; - } - - if (replaceLapis(composite, biome)) { - return; - } - - replaceNormal(composite, biome); - } - - private void replaceDecorations(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replace(composite, biome, Blocks.NETHER_QUARTZ_ORE)) { - return; - } - - if (replace(composite, biome, Blocks.INFESTED_STONE)) { - return; - } - - if (replaceMagma(composite, biome)) { - return; - } - } - - private boolean replace(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome, @NotNull final Block block) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.b instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.b; - - if (!(worldGenFeatureDecoratorConfiguration.b.a instanceof WorldGenDecoratorNetherHeight)) { - return false; - } - - if (!(worldGenFeatureDecoratorConfiguration.a.b instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) worldGenFeatureDecoratorConfiguration.a.b; - - if (worldGenFeatureOreConfiguration.c.getBlock() != block) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1(getDynamicFunction(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceMagma(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.b instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.b; - - if (!(worldGenFeatureDecoratorConfiguration.b.a instanceof WorldGenDecoratorNetherMagma)) { - return false; - } - - if (!(worldGenFeatureDecoratorConfiguration.a.b instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) worldGenFeatureDecoratorConfiguration.a.b; - - if (worldGenFeatureOreConfiguration.c.getBlock() != Blocks.MAGMA_BLOCK) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherMagmaOverrider_v1_14_R1(getDynamicFunction3(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceBadlandsGold(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.b instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.b; - - if (!(worldGenFeatureDecoratorConfiguration.b.b instanceof WorldGenFeatureChanceDecoratorCountConfiguration)) { - return false; - } - - final WorldGenFeatureChanceDecoratorCountConfiguration configuration = (WorldGenFeatureChanceDecoratorCountConfiguration) worldGenFeatureDecoratorConfiguration.b.b; - - if (configuration.a != 20) { - return false; - } - - if (configuration.b != 32) { - return false; - } - - if (configuration.c != 32) { - return false; - } - - if (configuration.d != 80) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_14_R1(getDynamicFunction(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceEmerald(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.b instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.b; - - if (!(worldGenFeatureDecoratorConfiguration.b.b instanceof WorldGenFeatureDecoratorEmptyConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorEmeraldOverrider_v1_14_R1(getDynamicFunction1(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceLapis(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.b instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.b; - - if (!(worldGenFeatureDecoratorConfiguration.b.b instanceof WorldGenDecoratorHeightAverageConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorHeightAverageOverrider_v1_14_R1(getDynamicFunction2(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private void replaceNormal(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.b instanceof WorldGenFeatureCompositeConfiguration)) { - return; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.b; - - if (!(worldGenFeatureDecoratorConfiguration.b.a instanceof WorldGenDecoratorNetherHeight)) { - return; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1(getDynamicFunction(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration> getDynamicFunction(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration>) field.get(worldGenDecorator); - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenFeatureDecoratorEmptyConfiguration> getDynamicFunction1(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenFeatureDecoratorEmptyConfiguration>) field.get(worldGenDecorator); - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenDecoratorHeightAverageConfiguration> getDynamicFunction2(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenDecoratorHeightAverageConfiguration>) field.get(worldGenDecorator); - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenDecoratorFrequencyConfiguration> getDynamicFunction3(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenDecoratorFrequencyConfiguration>) field.get(worldGenDecorator); - } - -} diff --git a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSUtil_v1_14_R1.java b/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSUtil_v1_14_R1.java deleted file mode 100644 index a936aaf8..00000000 --- a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/NMSUtil_v1_14_R1.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_14_R1; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_14_R1.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_14_R1 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_14_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer_v1_14_R1(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final BiomeBase biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(chunkCoordIntPair.getX() << 4, chunkCoordIntPair.getZ() << 4); - - return Biome.valueOf(IRegistry.BIOME.getKey(biomeBase).getKey().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, @NotNull final int veinsSize) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) defaultFeatureConfiguration; - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = new WorldGenFeatureOreConfiguration(worldGenFeatureConfigured.b.a, worldGenFeatureConfigured.b.c, veinsSize); - - return new WorldGenFeatureConfigured<>(worldGenFeatureConfigured.a, worldGenFeatureOreConfiguration); - } - - @Override - public Object createCountConfiguration(final int veinsPerChunk, final int minimumHeight, final int heightSubtractValue, final int heightRange) { - return new WorldGenFeatureChanceDecoratorCountConfiguration(veinsPerChunk, minimumHeight, heightSubtractValue, heightRange); - } - - @Override - public Object createHeightAverageConfiguration(final int veinsPerChunk, final int heightCenter, final int heightRange) { - return new WorldGenDecoratorHeightAverageConfiguration(veinsPerChunk, heightCenter, heightRange); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final WorldServer worldServer = ((CraftWorld) world).getHandle(); - final DimensionManager dimensionManager = worldServer.worldProvider.getDimensionManager().getType(); - - if (dimensionManager == DimensionManager.OVERWORLD) { - return Dimension.OVERWORLD; - } - if (dimensionManager == DimensionManager.NETHER) { - return Dimension.NETHER; - } - if (dimensionManager == DimensionManager.THE_END) { - return Dimension.THE_END; - } - - return Dimension.CUSTOM; - } - -} diff --git a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorEmeraldOverrider_v1_14_R1.java b/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorEmeraldOverrider_v1_14_R1.java deleted file mode 100644 index 320049f1..00000000 --- a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorEmeraldOverrider_v1_14_R1.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_14_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_14_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorEmeraldOverrider_v1_14_R1 extends WorldGenDecoratorEmerald { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorEmeraldOverrider_v1_14_R1(final Function, ? extends WorldGenFeatureDecoratorEmptyConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureDecoratorEmptyConfiguration worldGenFeatureDecoratorEmptyConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.EMERALD, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureDecoratorEmptyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenFeatureConfigured.a.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), worldGenFeatureConfigured.b), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureDecoratorEmptyConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorHeightAverageOverrider_v1_14_R1.java b/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorHeightAverageOverrider_v1_14_R1.java deleted file mode 100644 index 99e71a82..00000000 --- a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorHeightAverageOverrider_v1_14_R1.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_14_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_14_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorHeightAverageOverrider_v1_14_R1 extends WorldGenDecoratorHeightAverage { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorHeightAverageOverrider_v1_14_R1(final Function, ? extends WorldGenDecoratorHeightAverageConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorHeightAverageConfiguration worldGenDecoratorHeightAverageConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.LAPIS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorHeightAverageConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorHeightAverageConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_14_R1.java b/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_14_R1.java deleted file mode 100644 index d9db801e..00000000 --- a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_14_R1.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_14_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_14_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_14_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_14_R1(final Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.GOLD_BADLANDS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1.java b/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1.java deleted file mode 100644 index 430835c6..00000000 --- a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_14_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_14_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightNormalOverrider_v1_14_R1(final Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - - return nmsService.generate(generatorAccess.getMinecraftWorld().getWorld(), biome, nmsService.getNMSUtil().getOre(((WorldGenFeatureOreConfiguration) worldGenFeatureConfigured.b).c.getBlock()), new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherMagmaOverrider_v1_14_R1.java b/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherMagmaOverrider_v1_14_R1.java deleted file mode 100644 index cc72af9d..00000000 --- a/impl/v1_14_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_14_R1/WorldGenDecoratorNetherMagmaOverrider_v1_14_R1.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_14_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_14_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -public class WorldGenDecoratorNetherMagmaOverrider_v1_14_R1 extends WorldGenDecoratorNetherMagma { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherMagmaOverrider_v1_14_R1(final Function, ? extends WorldGenDecoratorFrequencyConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorFrequencyConfiguration worldGenDecoratorFrequencyConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.MAGMA, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorFrequencyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenFeatureConfigured.a.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), (C) new WorldGenFeatureOreConfiguration(WorldGenFeatureOreConfiguration.Target.NETHERRACK, Blocks.MAGMA_BLOCK.getBlockData(), Integer)), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorFrequencyConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_15_R1/pom.xml b/impl/v1_15_R1/pom.xml deleted file mode 100644 index 8e6c169b..00000000 --- a/impl/v1_15_R1/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-v1_15_R1 - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - org.spigotmc - spigot - 1.15.2-R0.1-SNAPSHOT - provided - true - - - - \ No newline at end of file diff --git a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSReplacer_v1_15_R1.java b/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSReplacer_v1_15_R1.java deleted file mode 100644 index cf47a74b..00000000 --- a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSReplacer_v1_15_R1.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_15_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.server.v1_15_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -class NMSReplacer_v1_15_R1 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer_v1_15_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - for (final Field field : Biomes.class.getFields()) { - try { - replaceBase((BiomeBase) field.get(null)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome field: " + field.getName(), e); - } - } - } - - private void replaceBase(@NotNull final BiomeBase base) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(IRegistry.BIOME.getKey(base).getKey().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final Map>> map = get(base); - - final List> list = map.get(WorldGenStage.Decoration.UNDERGROUND_ORES); - - for (final WorldGenFeatureConfigured composite : list) { - replace(composite, biome); - } - - final List> decorations = map.get(WorldGenStage.Decoration.UNDERGROUND_DECORATION); - - for (final WorldGenFeatureConfigured composite : decorations) { - replaceDecorations(composite, biome); - } - } - - @SuppressWarnings("unchecked") - private Map>> get(@NotNull final BiomeBase base) - throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassCastException { - - final Field field = getField(BiomeBase.class, "r"); - field.setAccessible(true); - - return (Map>>) field.get(base); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - private void replace(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replaceBadlandsGold(composite, biome)) { - return; - } - - if (replaceEmerald(composite, biome)) { - return; - } - - if (replaceLapis(composite, biome)) { - return; - } - - replaceNormal(composite, biome); - } - - private void replaceDecorations(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replace(composite, biome, Blocks.NETHER_QUARTZ_ORE)) { - return; - } - - if (replace(composite, biome, Blocks.INFESTED_STONE)) { - return; - } - - if (replaceMagma(composite, biome)) - return; - } - - private boolean replace(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome, @NotNull final Block block) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.c instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.c; - - if (!(worldGenFeatureDecoratorConfiguration.b.a instanceof WorldGenDecoratorNetherHeight)) { - return false; - } - - if (!(worldGenFeatureDecoratorConfiguration.a.c instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) worldGenFeatureDecoratorConfiguration.a.c; - - if (worldGenFeatureOreConfiguration.c.getBlock() != block) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1(getDynamicFunction(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceMagma(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.c instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.c; - - if (!(worldGenFeatureDecoratorConfiguration.b.a instanceof WorldGenDecoratorNetherMagma)) { - return false; - } - - if (!(worldGenFeatureDecoratorConfiguration.a.c instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) worldGenFeatureDecoratorConfiguration.a.c; - - if (worldGenFeatureOreConfiguration.c.getBlock() != Blocks.MAGMA_BLOCK) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherMagmaOverrider_v1_15_R1(getDynamicFunction3(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceBadlandsGold(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.c instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.c; - - if (!(worldGenFeatureDecoratorConfiguration.b.b instanceof WorldGenFeatureChanceDecoratorCountConfiguration)) { - return false; - } - - final WorldGenFeatureChanceDecoratorCountConfiguration configuration = (WorldGenFeatureChanceDecoratorCountConfiguration) worldGenFeatureDecoratorConfiguration.b.b; - - if (configuration.a != 20) { - return false; - } - - if (configuration.b != 32) { - return false; - } - - if (configuration.c != 32) { - return false; - } - - if (configuration.d != 80) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_15_R1(getDynamicFunction(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceEmerald(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.c instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.c; - - if (!(worldGenFeatureDecoratorConfiguration.b.b instanceof WorldGenFeatureEmptyConfiguration2)) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorEmeraldOverrider_v1_15_R1(getDynamicFunction1(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceLapis(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.c instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.c; - - if (!(worldGenFeatureDecoratorConfiguration.b.b instanceof WorldGenDecoratorHeightAverageConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorHeightAverageOverrider_v1_15_R1(getDynamicFunction2(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - - return true; - } - - private void replaceNormal(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.c instanceof WorldGenFeatureCompositeConfiguration)) { - return; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.c; - - if (!(worldGenFeatureDecoratorConfiguration.b.a instanceof WorldGenDecoratorNetherHeight)) { - return; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "a"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.b, new WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1(getDynamicFunction(worldGenFeatureDecoratorConfiguration.b.a), biome, serviceSupplier)); - } - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration> getDynamicFunction(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration>) field.get(worldGenDecorator); - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenFeatureEmptyConfiguration2> getDynamicFunction1(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenFeatureEmptyConfiguration2>) field.get(worldGenDecorator); - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenDecoratorHeightAverageConfiguration> getDynamicFunction2(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenDecoratorHeightAverageConfiguration>) field.get(worldGenDecorator); - } - - @SuppressWarnings("unchecked") - private Function, ? extends WorldGenDecoratorFrequencyConfiguration> getDynamicFunction3(@NotNull final WorldGenDecorator worldGenDecorator) throws IllegalAccessException, NoSuchFieldException { - final Field field = getField(WorldGenDecorator.class, "M"); - field.setAccessible(true); - return (Function, ? extends WorldGenDecoratorFrequencyConfiguration>) field.get(worldGenDecorator); - } - -} diff --git a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSUtil_v1_15_R1.java b/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSUtil_v1_15_R1.java deleted file mode 100644 index c1221712..00000000 --- a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/NMSUtil_v1_15_R1.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_15_R1; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_15_R1.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_15_R1 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_15_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer_v1_15_R1(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final BiomeBase biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4); - - return Biome.valueOf(IRegistry.BIOME.getKey(biomeBase).getKey().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) defaultFeatureConfiguration; - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = new WorldGenFeatureOreConfiguration(worldGenFeatureConfigured.c.a, worldGenFeatureConfigured.c.c, veinsSize); - - return new WorldGenFeatureConfigured<>(worldGenFeatureConfigured.b, worldGenFeatureOreConfiguration); - } - - @Override - public Object createCountConfiguration(final int veinsPerChunk, final int minimumHeight, final int heightSubtractValue, final int heightRange) { - return new WorldGenFeatureChanceDecoratorCountConfiguration(veinsPerChunk, minimumHeight, heightSubtractValue, heightRange); - } - - @Override - public Object createHeightAverageConfiguration(final int veinsPerChunk, final int heightCenter, final int heightRange) { - return new WorldGenDecoratorHeightAverageConfiguration(veinsPerChunk, heightCenter, heightRange); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final WorldServer worldServer = ((CraftWorld) world).getHandle(); - final DimensionManager dimensionManager = worldServer.worldProvider.getDimensionManager().getType(); - - if (dimensionManager == DimensionManager.OVERWORLD) { - return Dimension.OVERWORLD; - } - if (dimensionManager == DimensionManager.NETHER) { - return Dimension.NETHER; - } - if (dimensionManager == DimensionManager.THE_END) { - return Dimension.THE_END; - } - - return Dimension.CUSTOM; - } - -} diff --git a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorEmeraldOverrider_v1_15_R1.java b/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorEmeraldOverrider_v1_15_R1.java deleted file mode 100644 index 93ab9e5f..00000000 --- a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorEmeraldOverrider_v1_15_R1.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_15_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_15_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorEmeraldOverrider_v1_15_R1 extends WorldGenDecoratorEmerald { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorEmeraldOverrider_v1_15_R1(final Function, ? extends WorldGenFeatureEmptyConfiguration2> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureEmptyConfiguration2 worldGenFeatureDecoratorEmptyConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.EMERALD, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureDecoratorEmptyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenFeatureConfigured.b.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), worldGenFeatureConfigured.c), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureEmptyConfiguration2) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorHeightAverageOverrider_v1_15_R1.java b/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorHeightAverageOverrider_v1_15_R1.java deleted file mode 100644 index 4038f298..00000000 --- a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorHeightAverageOverrider_v1_15_R1.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_15_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_15_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorHeightAverageOverrider_v1_15_R1 extends WorldGenDecoratorHeightAverage { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorHeightAverageOverrider_v1_15_R1(final Function, ? extends WorldGenDecoratorHeightAverageConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorHeightAverageConfiguration worldGenDecoratorHeightAverageConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.LAPIS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorHeightAverageConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorHeightAverageConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_15_R1.java b/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_15_R1.java deleted file mode 100644 index 583c17f8..00000000 --- a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_15_R1.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_15_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_15_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_15_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_15_R1(final Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.GOLD_BADLANDS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1.java b/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1.java deleted file mode 100644 index c333af0d..00000000 --- a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_15_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_15_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightNormalOverrider_v1_15_R1(final Function, ? extends WorldGenFeatureChanceDecoratorCountConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - - return nmsService.generate(generatorAccess.getMinecraftWorld().getWorld(), biome, nmsService.getNMSUtil().getOre(((WorldGenFeatureOreConfiguration) worldGenFeatureConfigured.c).c.getBlock()), new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherMagmaOverrider_v1_15_R1.java b/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherMagmaOverrider_v1_15_R1.java deleted file mode 100644 index e67ce983..00000000 --- a/impl/v1_15_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_15_R1/WorldGenDecoratorNetherMagmaOverrider_v1_15_R1.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_15_R1; - -import com.mojang.datafixers.Dynamic; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_15_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Function; -import java.util.function.Supplier; - -public class WorldGenDecoratorNetherMagmaOverrider_v1_15_R1 extends WorldGenDecoratorNetherMagma { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherMagmaOverrider_v1_15_R1(final Function, ? extends WorldGenDecoratorFrequencyConfiguration> dynamicFunction, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(dynamicFunction); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccess generatorAccess, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorFrequencyConfiguration worldGenDecoratorFrequencyConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.MAGMA, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorFrequencyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenFeatureConfigured.b.generate(generatorAccess, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), (FC) new WorldGenFeatureOreConfiguration(WorldGenFeatureOreConfiguration.Target.NETHERRACK, Blocks.MAGMA_BLOCK.getBlockData(), Integer)), - (configuration, featureConfiguration) -> super.a(generatorAccess, chunkGenerator, random, blockPosition, (WorldGenDecoratorFrequencyConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_16_R1/pom.xml b/impl/v1_16_R1/pom.xml deleted file mode 100644 index a674187e..00000000 --- a/impl/v1_16_R1/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-v1_16_R1 - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - org.spigotmc - spigot - 1.16.1-R0.1-SNAPSHOT - provided - true - - - - \ No newline at end of file diff --git a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSReplacer_v1_16_R1.java b/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSReplacer_v1_16_R1.java deleted file mode 100644 index a92bd814..00000000 --- a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSReplacer_v1_16_R1.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.server.v1_16_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -class NMSReplacer_v1_16_R1 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer_v1_16_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - for (final Field field : Biomes.class.getFields()) { - try { - replaceBase((BiomeBase) field.get(null)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome field: " + field.getName(), e); - } - } - } - - private void replaceBase(@NotNull final BiomeBase base) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(IRegistry.BIOME.getKey(base).getKey().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final Map>> map = get(base); - - final List> list = map.get(WorldGenStage.Decoration.UNDERGROUND_ORES); - - for (final WorldGenFeatureConfigured composite : list) { - replace(composite, biome); - } - - final List> decorations = map.get(WorldGenStage.Decoration.UNDERGROUND_DECORATION); - - for (final WorldGenFeatureConfigured composite : decorations) { - replaceDecorations(composite, biome); - } - } - - @SuppressWarnings("unchecked") - private Map>> get(@NotNull final BiomeBase base) - throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassCastException { - - final Field field = getField(BiomeBase.class, "r"); - field.setAccessible(true); - - return (Map>>) field.get(base); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - private void replace(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replaceBadlandsGold(composite, biome)) { - return; - } - - if (replaceEmerald(composite, biome)) { - return; - } - - if (replaceLapis(composite, biome)) { - return; - } - - replaceNormal(composite, biome); - } - - private void replaceDecorations(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (replace(composite, biome, Blocks.NETHER_QUARTZ_ORE)) { - return; - } - - if (replace(composite, biome, Blocks.NETHER_GOLD_ORE)) { - return; - } - - if (replace(composite, biome, Blocks.INFESTED_STONE)) { - return; - } - - if (replace(composite, biome, Blocks.ANCIENT_DEBRIS)) { - return; - } - - if (replaceMagma(composite, biome)) { - return; - } - - if (replaceAncientDebris2(composite, biome)) { - return; - } - - } - - private boolean replace(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome, @NotNull final Block block) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.e instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.e; - - if (!(worldGenFeatureDecoratorConfiguration.c.b instanceof WorldGenDecoratorNetherHeight)) { - return false; - } - - if (!(worldGenFeatureDecoratorConfiguration.b.e instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) worldGenFeatureDecoratorConfiguration.b.e; - - if (worldGenFeatureOreConfiguration.d.getBlock() != block) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "b"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.c, new WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1(WorldGenFeatureChanceDecoratorCountConfiguration.a, biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceAncientDebris2(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.e instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.e; - - if (!(worldGenFeatureDecoratorConfiguration.c.c instanceof WorldGenDecoratorHeightAverageConfiguration)) { - return false; - } - - if (!(worldGenFeatureDecoratorConfiguration.b.e instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) worldGenFeatureDecoratorConfiguration.b.e; - - if (worldGenFeatureOreConfiguration.d.getBlock() != Blocks.ANCIENT_DEBRIS) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "b"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.c, new WorldGenDecoratorHeightAverageOverrider_v1_16_R1(WorldGenDecoratorHeightAverageConfiguration.a, biome, Ore.ANCIENT_DEBRIS_2, serviceSupplier)); - } - - return true; - } - - private boolean replaceMagma(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.e instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.e; - - if (!(worldGenFeatureDecoratorConfiguration.c.b instanceof WorldGenDecoratorNetherMagma)) { - return false; - } - - if (!(worldGenFeatureDecoratorConfiguration.b.e instanceof WorldGenFeatureOreConfiguration)) { - return false; - } - - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = (WorldGenFeatureOreConfiguration) worldGenFeatureDecoratorConfiguration.b.e; - - if (worldGenFeatureOreConfiguration.d.getBlock() != Blocks.MAGMA_BLOCK) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "b"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.c, new WorldGenDecoratorNetherMagmaOverrider_v1_16_R1(WorldGenDecoratorFrequencyConfiguration.a, biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceBadlandsGold(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.e instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.e; - - if (!(worldGenFeatureDecoratorConfiguration.b.e instanceof WorldGenFeatureChanceDecoratorCountConfiguration)) { - return false; - } - - final WorldGenFeatureChanceDecoratorCountConfiguration configuration = (WorldGenFeatureChanceDecoratorCountConfiguration) worldGenFeatureDecoratorConfiguration.b.e; - - if (configuration.b != 20) { - return false; - } - - if (configuration.c != 32) { - return false; - } - - if (configuration.d != 32) { - return false; - } - - if (configuration.e != 80) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "b"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.c, new WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_16_R1(WorldGenFeatureChanceDecoratorCountConfiguration.a, biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceEmerald(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.e instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.e; - - if (!(worldGenFeatureDecoratorConfiguration.c.c instanceof WorldGenFeatureEmptyConfiguration2)) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "b"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.c, new WorldGenDecoratorEmeraldOverrider_v1_16_R1(WorldGenFeatureEmptyConfiguration2.a, biome, serviceSupplier)); - } - - return true; - } - - private boolean replaceLapis(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.e instanceof WorldGenFeatureCompositeConfiguration)) { - return false; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.e; - - if (!(worldGenFeatureDecoratorConfiguration.c.c instanceof WorldGenDecoratorHeightAverageConfiguration)) { - return false; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "b"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.c, new WorldGenDecoratorHeightAverageOverrider_v1_16_R1(WorldGenDecoratorHeightAverageConfiguration.a, biome, Ore.LAPIS, serviceSupplier)); - } - - return true; - } - - private void replaceNormal(@NotNull final WorldGenFeatureConfigured composite, @NotNull final Biome biome) throws NoSuchFieldException, IllegalAccessException { - if (!(composite.e instanceof WorldGenFeatureCompositeConfiguration)) { - return; - } - - final WorldGenFeatureCompositeConfiguration worldGenFeatureDecoratorConfiguration = (WorldGenFeatureCompositeConfiguration) composite.e; - - if (!(worldGenFeatureDecoratorConfiguration.c.b instanceof WorldGenDecoratorNetherHeight)) { - return; - } - - { - final Field field = getField(WorldGenDecoratorConfigured.class, "b"); - field.setAccessible(true); - field.set(worldGenFeatureDecoratorConfiguration.c, new WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1(WorldGenFeatureChanceDecoratorCountConfiguration.a, biome, serviceSupplier)); - } - } - -} diff --git a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSUtil_v1_16_R1.java b/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSUtil_v1_16_R1.java deleted file mode 100644 index b4e342a8..00000000 --- a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/NMSUtil_v1_16_R1.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R1; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R1.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_16_R1.CraftWorld; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_16_R1 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_16_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer_v1_16_R1(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final BiomeBase biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4); - - return Biome.valueOf(IRegistry.BIOME.getKey(biomeBase).getKey().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) defaultFeatureConfiguration; - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = new WorldGenFeatureOreConfiguration(worldGenFeatureConfigured.e.b, worldGenFeatureConfigured.e.d, veinsSize); - - return new WorldGenFeatureConfigured<>(worldGenFeatureConfigured.d, worldGenFeatureOreConfiguration); - } - - @Override - public Object createCountConfiguration(final int veinsPerChunk, final int minimumHeight, final int heightSubtractValue, final int heightRange) { - return new WorldGenFeatureChanceDecoratorCountConfiguration(veinsPerChunk, minimumHeight, heightSubtractValue, heightRange); - } - - @Override - public Object createHeightAverageConfiguration(final int veinsPerChunk, final int heightCenter, final int heightRange) { - return new WorldGenDecoratorHeightAverageConfiguration(veinsPerChunk, heightCenter, heightRange); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - if (object == Blocks.NETHER_GOLD_ORE) { - return Ore.NETHER_GOLD; - } - if (object == Blocks.ANCIENT_DEBRIS) { - return Ore.ANCIENT_DEBRIS; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final WorldServer worldServer = ((CraftWorld) world).getHandle(); - final DimensionManager dimensionManager = worldServer.getDimensionManager(); - - final RegistryMaterials registryMaterials = worldServer.worldDataServer.getGeneratorSettings().e(); - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.OVERWORLD); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.OVERWORLD; - } - } - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.THE_NETHER); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.NETHER; - } - } - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.THE_END); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.THE_END; - } - } - - return Dimension.CUSTOM; - } - -} diff --git a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorEmeraldOverrider_v1_16_R1.java b/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorEmeraldOverrider_v1_16_R1.java deleted file mode 100644 index a0d3ffc4..00000000 --- a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorEmeraldOverrider_v1_16_R1.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorEmeraldOverrider_v1_16_R1 extends WorldGenDecoratorEmerald { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorEmeraldOverrider_v1_16_R1(Codec codec, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccessSeed generatorAccess, final StructureManager structureManager, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureEmptyConfiguration2 worldGenFeatureDecoratorEmptyConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.EMERALD, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureDecoratorEmptyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenFeatureConfigured.d.generate(generatorAccess, structureManager, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), worldGenFeatureConfigured.e), - (configuration, featureConfiguration) -> super.a(generatorAccess, structureManager, chunkGenerator, random, blockPosition, (WorldGenFeatureEmptyConfiguration2) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorHeightAverageOverrider_v1_16_R1.java b/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorHeightAverageOverrider_v1_16_R1.java deleted file mode 100644 index 461ef2cb..00000000 --- a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorHeightAverageOverrider_v1_16_R1.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorHeightAverageOverrider_v1_16_R1 extends WorldGenDecoratorHeightAverage { - - @NotNull - private final Biome biome; - - @NotNull - private final Ore ore; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorHeightAverageOverrider_v1_16_R1(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccessSeed generatorAccess, final StructureManager structureManager, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorHeightAverageConfiguration worldGenDecoratorHeightAverageConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorHeightAverageConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, structureManager, chunkGenerator, random, blockPosition, (WorldGenDecoratorHeightAverageConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_16_R1.java b/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_16_R1.java deleted file mode 100644 index 12e7a731..00000000 --- a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_16_R1.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_16_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightBadlandsGoldOverrider_v1_16_R1(final Codec codec, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccessSeed generatorAccess, final StructureManager structureManager, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.GOLD_BADLANDS, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, structureManager, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1.java b/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1.java deleted file mode 100644 index b74d8aee..00000000 --- a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1 extends WorldGenDecoratorNetherHeight { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherHeightNormalOverrider_v1_16_R1(final Codec codec, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccessSeed generatorAccess, final StructureManager structureManager, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenFeatureChanceDecoratorCountConfiguration worldGenFeatureChanceDecoratorCountConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - - return nmsService.generate(generatorAccess.getMinecraftWorld().getWorld(), biome, nmsService.getNMSUtil().getOre(((WorldGenFeatureOreConfiguration) worldGenFeatureConfigured.e).d.getBlock()), new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenFeatureChanceDecoratorCountConfiguration, worldGenFeatureConfigured, - null, - (configuration, featureConfiguration) -> super.a(generatorAccess, structureManager, chunkGenerator, random, blockPosition, (WorldGenFeatureChanceDecoratorCountConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherMagmaOverrider_v1_16_R1.java b/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherMagmaOverrider_v1_16_R1.java deleted file mode 100644 index 2b84ee10..00000000 --- a/impl/v1_16_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R1/WorldGenDecoratorNetherMagmaOverrider_v1_16_R1.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R1.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class WorldGenDecoratorNetherMagmaOverrider_v1_16_R1 extends WorldGenDecoratorNetherMagma { - - @NotNull - private final Biome biome; - - @NotNull - private final Supplier serviceSupplier; - - public WorldGenDecoratorNetherMagmaOverrider_v1_16_R1(final Codec codec, @NotNull final Biome biome, @NotNull final Supplier serviceSupplier) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.biome = biome; - this.serviceSupplier = serviceSupplier; - } - - @Override - public > boolean a(final GeneratorAccessSeed generatorAccess, final StructureManager structureManager, final ChunkGenerator chunkGenerator, final Random random, final BlockPosition blockPosition, final WorldGenDecoratorFrequencyConfiguration worldGenDecoratorFrequencyConfiguration, final WorldGenFeatureConfigured worldGenFeatureConfigured) { - return serviceSupplier.get().getNMSService().generate(generatorAccess.getMinecraftWorld().getWorld(), biome, Ore.MAGMA, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), worldGenDecoratorFrequencyConfiguration, worldGenFeatureConfigured, - (location, Integer) -> worldGenFeatureConfigured.d.generate(generatorAccess, structureManager, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), (FC) new WorldGenFeatureOreConfiguration(WorldGenFeatureOreConfiguration.Target.NETHERRACK, Blocks.MAGMA_BLOCK.getBlockData(), Integer)), - (configuration, featureConfiguration) -> super.a(generatorAccess, structureManager, chunkGenerator, random, blockPosition, (WorldGenDecoratorFrequencyConfiguration) configuration, (WorldGenFeatureConfigured) featureConfiguration) - , random); - } - -} diff --git a/impl/v1_16_R2/pom.xml b/impl/v1_16_R2/pom.xml deleted file mode 100644 index faaa644a..00000000 --- a/impl/v1_16_R2/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-v1_16_R2 - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - org.spigotmc - spigot - 1.16.3-R0.1-SNAPSHOT - provided - true - - - - - \ No newline at end of file diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedWorldGeneratorOverrider.java b/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedWorldGeneratorOverrider.java deleted file mode 100644 index edce3b85..00000000 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/DepthAveragedWorldGeneratorOverrider.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R2; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R2.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class DepthAveragedWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - @NotNull - private final DepthAveragedCombinedConfiguration defaultConfiguration; - - public DepthAveragedWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - - final OreControlService service = serviceSupplier.get(); - - defaultConfiguration = (DepthAveragedCombinedConfiguration) service.getNMSService().getNMSUtil().createHeightAverageConfiguration( - (int) service.getDefaultValue(biome, ore, Setting.VEINS_PER_CHUNK), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_CENTER), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_RANGE)); - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), defaultConfiguration, defaultFeatureConfiguration, null, (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object configuration, Object featureConfiguration) { - final DepthAveragedCombinedConfiguration combinedConfiguration = (DepthAveragedCombinedConfiguration) configuration; - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, combinedConfiguration, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, DepthAveragedCombinedConfiguration combinedConfiguration, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.c.a(null, random, new WorldGenDecoratorFrequencyConfiguration(combinedConfiguration.getVeinCount()), blockPosition) - .forEach(countBlockPosition -> WorldGenDecorator.g.a(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> WorldGenDecorator.o.a(null, random, combinedConfiguration.getConfiguration(), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - -} diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/EmeraldWorldGeneratorOverrider.java b/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/EmeraldWorldGeneratorOverrider.java deleted file mode 100644 index 5ab1f4a6..00000000 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/EmeraldWorldGeneratorOverrider.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R2; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R2.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class EmeraldWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - - public EmeraldWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), WorldGenFeatureEmptyConfiguration2.c, defaultFeatureConfiguration, - (location, Integer) -> WorldGenerator.EMERALD_ORE.generate(generatorAccessSeed, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), defaultFeatureConfiguration.f), - (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object featureConfiguration) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.t.a(null, random, null, blockPosition) - .forEach(emeraldBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, emeraldBlockPosition) - ); - - return true; - } - -} \ No newline at end of file diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/MagmaWorldGeneratorOverrider.java b/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/MagmaWorldGeneratorOverrider.java deleted file mode 100644 index 3ec315f3..00000000 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/MagmaWorldGeneratorOverrider.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R2; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R2.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class MagmaWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - - public MagmaWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), WorldGenFeatureEmptyConfiguration2.c, defaultFeatureConfiguration, - (location, Integer) -> WorldGenerator.ORE.generate(generatorAccessSeed, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), defaultFeatureConfiguration.f), - (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object featureConfiguration) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.s.a(null, random, null, blockPosition) - .forEach(emeraldBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, emeraldBlockPosition) - ); - - return true; - } - -} \ No newline at end of file diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSReplacer_v1_16_R2.java b/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSReplacer_v1_16_R2.java deleted file mode 100644 index 3fbb445b..00000000 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSReplacer_v1_16_R2.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R2; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.server.v1_16_R2.*; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R2.CraftServer; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -class NMSReplacer_v1_16_R2 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer_v1_16_R2(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - final IRegistryWritable registry = getRegistry().b(IRegistry.ay); - for (final BiomeBase biomeBase : registry) { - try { - replaceBase(biomeBase, registry.getKey(biomeBase)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome: " + biomeBase, e); - } - } - } - - private void replaceBase(@NotNull final BiomeBase base, MinecraftKey minecraftKey) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(minecraftKey.getKey().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final List>>> decorations = base.e().c(); - - final List>>> newDecorations = new ArrayList<>(); - - for (final List>> list : decorations) { - final List>> newList = new ArrayList<>(); - newDecorations.add(decorations.indexOf(list), newList); - - for (final Supplier> featureSupplier : list) { - final WorldGenFeatureConfigured feature = featureSupplier.get(); - - WorldGenFeatureConfigured newFeature = check(biome, feature); - - if (newFeature != null) { - addToList(newList, list.indexOf(featureSupplier), newFeature); - } else { - newList.add(list.indexOf(featureSupplier), featureSupplier); - } - } - } - - final Field field = getField(BiomeSettingsGeneration.class, "f"); - field.setAccessible(true); - field.set(base.e(), newDecorations); - } - - private void addToList(List>> list, int index, WorldGenFeatureConfigured feature) { - list.add(index, () -> feature); - } - - @Nullable - private WorldGenFeatureConfigured check(final Biome biome, WorldGenFeatureConfigured feature) { - //Not the best method to do this, but hey it works - final IRegistryWritable> registry = getRegistry().b(IRegistry.au); - feature = RegistryGeneration.e.get(registry.getKey(feature)); - - if (feature == null) { - return null; - } - - if (feature == BiomeDecoratorGroups.ORE_GOLD_DELTAS || feature == BiomeDecoratorGroups.ORE_GOLD_NETHER) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.NETHER_GOLD, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_QUARTZ_DELTAS || feature == BiomeDecoratorGroups.ORE_QUARTZ_NETHER) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.NETHER_QUARTZ, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DIRT) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.DIRT, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GRAVEL) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GRAVEL, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GRANITE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GRANITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DIORITE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.DIORITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_ANDESITE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.ANDESITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_COAL) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.COAL, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_IRON) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.IRON, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GOLD_EXTRA) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GOLD_BADLANDS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GOLD) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GOLD, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_REDSTONE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.REDSTONE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DIAMOND) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.DIAMOND, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_INFESTED) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.INFESTED_STONE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DEBRIS_SMALL) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.ANCIENT_DEBRIS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DEBRIS_LARGE) { - return new WorldGenFeatureConfigured<>(new DepthAveragedWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.ANCIENT_DEBRIS_2, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_LAPIS) { - return new WorldGenFeatureConfigured<>(new DepthAveragedWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.LAPIS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_EMERALD) { - return new WorldGenFeatureConfigured<>(new EmeraldWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.EMERALD, serviceSupplier, getWorldGenFeatureEmeraldConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_MAGMA) { - return new WorldGenFeatureConfigured<>(new MagmaWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.MAGMA, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - - return null; - } - - private WorldGenFeatureConfigured getWorldGenFeatureOreConfiguration(final WorldGenFeatureConfigured feature) { - if (feature.c() instanceof WorldGenFeatureOreConfiguration) { - return (WorldGenFeatureConfigured) feature; - } - - if (feature.c() instanceof WorldGenFeatureCompositeConfiguration) { - final WorldGenFeatureCompositeConfiguration compositeConfiguration = (WorldGenFeatureCompositeConfiguration) feature.c(); - - return getWorldGenFeatureOreConfiguration(compositeConfiguration.b.get()); - } - - throw new RuntimeException("No WorldGenFeatureConfigured found"); - } - - private WorldGenFeatureConfigured getWorldGenFeatureEmeraldConfiguration(final WorldGenFeatureConfigured feature) { - if (feature.c() instanceof WorldGenFeatureReplaceBlockConfiguration) { - return (WorldGenFeatureConfigured) feature; - } - - if (feature.c() instanceof WorldGenFeatureCompositeConfiguration) { - final WorldGenFeatureCompositeConfiguration compositeConfiguration = (WorldGenFeatureCompositeConfiguration) feature.c(); - - return getWorldGenFeatureEmeraldConfiguration(compositeConfiguration.b.get()); - } - - throw new RuntimeException("No WorldGenFeatureConfigured found"); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - @Nullable - private IRegistryCustom iRegistryCustom; - - @NotNull - private IRegistryCustom getRegistry() { - if (iRegistryCustom != null) { - return iRegistryCustom; - } - - final DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); - - IRegistryCustom registryCustom = null; - - // 1.16.2 use the method name 'aX' and 1.16.3 'getCustomRegistry' - try { - registryCustom = server.getCustomRegistry(); - } catch (NoSuchMethodError e) { - try { - @SuppressWarnings("JavaReflectionMemberAccess") Method registryCustomMethod = MinecraftServer.class.getDeclaredMethod("aX"); - - registryCustom = (IRegistryCustom) registryCustomMethod.invoke(server); - - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException noSuchFieldException) { - throw new RuntimeException("Cannot find IRegistryCustom", e); - } - } - - if (registryCustom == null) { - throw new RuntimeException("Cannot find IRegistryCustom"); - } - - return iRegistryCustom = registryCustom; - } - -} diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSUtil_v1_16_R2.java b/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSUtil_v1_16_R2.java deleted file mode 100644 index 37e06d05..00000000 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/NMSUtil_v1_16_R2.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R2; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R2.*; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_16_R2.CraftServer; -import org.bukkit.craftbukkit.v1_16_R2.CraftWorld; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_16_R2 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_16_R2(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer_v1_16_R2(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final BiomeBase biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4); - - return Biome.valueOf(getRegistry().b(IRegistry.ay).getKey(biomeBase).getKey().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) defaultFeatureConfiguration; - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = new WorldGenFeatureOreConfiguration(worldGenFeatureConfigured.f.b, worldGenFeatureConfigured.f.d, veinsSize); - - return new WorldGenFeatureConfigured<>(worldGenFeatureConfigured.e, worldGenFeatureOreConfiguration); - } - - @Override - public Object createCountConfiguration(final int veinsPerChunk, final int minimumHeight, final int heightSubtractValue, final int heightRange) { - return new RangeCombinedConfiguration(veinsPerChunk, new WorldGenFeatureChanceDecoratorRangeConfiguration(minimumHeight, heightSubtractValue, heightRange)); - } - - @Override - public Object createHeightAverageConfiguration(final int veinsPerChunk, final int heightCenter, final int heightRange) { - return new DepthAveragedCombinedConfiguration(veinsPerChunk, new WorldGenDecoratorHeightAverageConfiguration(heightCenter, heightRange)); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - if (object == Blocks.NETHER_GOLD_ORE) { - return Ore.NETHER_GOLD; - } - if (object == Blocks.ANCIENT_DEBRIS) { - return Ore.ANCIENT_DEBRIS; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final WorldServer worldServer = ((CraftWorld) world).getHandle(); - final DimensionManager dimensionManager = worldServer.getDimensionManager(); - - final RegistryMaterials registryMaterials = worldServer.worldDataServer.getGeneratorSettings().d(); - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.OVERWORLD); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.OVERWORLD; - } - } - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.THE_NETHER); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.NETHER; - } - } - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.THE_END); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.THE_END; - } - } - - return Dimension.CUSTOM; - } - - @Nullable - private IRegistryCustom iRegistryCustom; - - @NotNull - private IRegistryCustom getRegistry() { - if (iRegistryCustom != null) { - return iRegistryCustom; - } - - final DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); - - IRegistryCustom registryCustom = null; - - // 1.16.2 use the method name 'aX' and 1.16.3 'getCustomRegistry' - try { - registryCustom = server.getCustomRegistry(); - } catch (NoSuchMethodError e) { - try { - @SuppressWarnings("JavaReflectionMemberAccess") Method registryCustomMethod = MinecraftServer.class.getDeclaredMethod("aX"); - - registryCustom = (IRegistryCustom) registryCustomMethod.invoke(server); - - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException noSuchFieldException) { - throw new RuntimeException("Cannot find IRegistryCustom", e); - } - } - - if (registryCustom == null) { - throw new RuntimeException("Cannot find IRegistryCustom"); - } - - return iRegistryCustom = registryCustom; - } - -} diff --git a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeWorldGeneratorOverrider.java b/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeWorldGeneratorOverrider.java deleted file mode 100644 index 247648ed..00000000 --- a/impl/v1_16_R2/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R2/RangeWorldGeneratorOverrider.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R2; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R2.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class RangeWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - @NotNull - private final RangeCombinedConfiguration defaultConfiguration; - - public RangeWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - - final OreControlService service = serviceSupplier.get(); - - defaultConfiguration = (RangeCombinedConfiguration) service.getNMSService().getNMSUtil().createCountConfiguration( - (int) service.getDefaultValue(biome, ore, Setting.VEINS_PER_CHUNK), - (int) service.getDefaultValue(biome, ore, Setting.MINIMUM_HEIGHT), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_SUBTRACT_VALUE), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_RANGE)); - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), defaultConfiguration, defaultFeatureConfiguration, null, (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object configuration, Object featureConfiguration) { - final RangeCombinedConfiguration combinedConfiguration = (RangeCombinedConfiguration) configuration; - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, combinedConfiguration, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, RangeCombinedConfiguration combinedConfiguration, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.c.a(null, random, new WorldGenDecoratorFrequencyConfiguration(combinedConfiguration.getVeinCount()), blockPosition) - .forEach(countBlockPosition -> WorldGenDecorator.g.a(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> WorldGenDecorator.l.a(null, random, combinedConfiguration.getConfiguration(), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - -} diff --git a/impl/v1_16_R3/pom.xml b/impl/v1_16_R3/pom.xml deleted file mode 100644 index 249eccfa..00000000 --- a/impl/v1_16_R3/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - - ore-control-impl - de.derfrzocker - ${revision} - - - ore-control-impl-v1_16_R3 - - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - org.spigotmc - spigot - 1.16.4-R0.1-SNAPSHOT - provided - true - - - - - \ No newline at end of file diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedWorldGeneratorOverrider.java b/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedWorldGeneratorOverrider.java deleted file mode 100644 index a2b3e46c..00000000 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/DepthAveragedWorldGeneratorOverrider.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R3; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R3.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class DepthAveragedWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - @NotNull - private final DepthAveragedCombinedConfiguration defaultConfiguration; - - public DepthAveragedWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - - final OreControlService service = serviceSupplier.get(); - - defaultConfiguration = (DepthAveragedCombinedConfiguration) service.getNMSService().getNMSUtil().createHeightAverageConfiguration( - (int) service.getDefaultValue(biome, ore, Setting.VEINS_PER_CHUNK), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_CENTER), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_RANGE)); - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), defaultConfiguration, defaultFeatureConfiguration, null, (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object configuration, Object featureConfiguration) { - final DepthAveragedCombinedConfiguration combinedConfiguration = (DepthAveragedCombinedConfiguration) configuration; - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, combinedConfiguration, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, DepthAveragedCombinedConfiguration combinedConfiguration, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.c.a(null, random, new WorldGenDecoratorFrequencyConfiguration(combinedConfiguration.getVeinCount()), blockPosition) - .forEach(countBlockPosition -> WorldGenDecorator.g.a(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> WorldGenDecorator.o.a(null, random, combinedConfiguration.getConfiguration(), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - -} diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/EmeraldWorldGeneratorOverrider.java b/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/EmeraldWorldGeneratorOverrider.java deleted file mode 100644 index 783bf5c1..00000000 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/EmeraldWorldGeneratorOverrider.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R3; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R3.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class EmeraldWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - - public EmeraldWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), WorldGenFeatureEmptyConfiguration2.c, defaultFeatureConfiguration, - (location, Integer) -> WorldGenerator.EMERALD_ORE.generate(generatorAccessSeed, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), defaultFeatureConfiguration.f), - (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object featureConfiguration) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.t.a(null, random, null, blockPosition) - .forEach(emeraldBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, emeraldBlockPosition) - ); - - return true; - } - -} \ No newline at end of file diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/MagmaWorldGeneratorOverrider.java b/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/MagmaWorldGeneratorOverrider.java deleted file mode 100644 index 021b7ee8..00000000 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/MagmaWorldGeneratorOverrider.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R3; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R3.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class MagmaWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - - public MagmaWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), WorldGenFeatureEmptyConfiguration2.c, defaultFeatureConfiguration, - (location, Integer) -> WorldGenerator.ORE.generate(generatorAccessSeed, chunkGenerator, random, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), defaultFeatureConfiguration.f), - (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object featureConfiguration) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.s.a(null, random, null, blockPosition) - .forEach(emeraldBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, emeraldBlockPosition) - ); - - return true; - } - -} \ No newline at end of file diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSReplacer_v1_16_R3.java b/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSReplacer_v1_16_R3.java deleted file mode 100644 index 5c82a1fe..00000000 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSReplacer_v1_16_R3.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R3; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.server.v1_16_R3.*; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R3.CraftServer; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -class NMSReplacer_v1_16_R3 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer_v1_16_R3(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - final IRegistryWritable registry = getRegistry().b(IRegistry.ay); - for (final BiomeBase biomeBase : registry) { - try { - replaceBase(biomeBase, registry.getKey(biomeBase)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome: " + biomeBase, e); - } - } - } - - private void replaceBase(@NotNull final BiomeBase base, MinecraftKey minecraftKey) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(minecraftKey.getKey().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final List>>> decorations = base.e().c(); - - final List>>> newDecorations = new ArrayList<>(); - - for (final List>> list : decorations) { - final List>> newList = new ArrayList<>(); - newDecorations.add(decorations.indexOf(list), newList); - - for (final Supplier> featureSupplier : list) { - final WorldGenFeatureConfigured feature = featureSupplier.get(); - - WorldGenFeatureConfigured newFeature = check(biome, feature); - - if (newFeature != null) { - addToList(newList, list.indexOf(featureSupplier), newFeature); - } else { - newList.add(list.indexOf(featureSupplier), featureSupplier); - } - } - } - - final Field field = getField(BiomeSettingsGeneration.class, "f"); - field.setAccessible(true); - field.set(base.e(), newDecorations); - } - - private void addToList(List>> list, int index, WorldGenFeatureConfigured feature) { - list.add(index, () -> feature); - } - - @Nullable - private WorldGenFeatureConfigured check(final Biome biome, WorldGenFeatureConfigured feature) { - //Not the best method to do this, but hey it works - final IRegistryWritable> registry = getRegistry().b(IRegistry.au); - feature = RegistryGeneration.e.get(registry.getKey(feature)); - - if (feature == null) { - return null; - } - - if (feature == BiomeDecoratorGroups.ORE_GOLD_DELTAS || feature == BiomeDecoratorGroups.ORE_GOLD_NETHER) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.NETHER_GOLD, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_QUARTZ_DELTAS || feature == BiomeDecoratorGroups.ORE_QUARTZ_NETHER) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.NETHER_QUARTZ, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DIRT) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.DIRT, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GRAVEL) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GRAVEL, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GRANITE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GRANITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DIORITE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.DIORITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_ANDESITE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.ANDESITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_COAL) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.COAL, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_IRON) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.IRON, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GOLD_EXTRA) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GOLD_BADLANDS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_GOLD) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.GOLD, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_REDSTONE) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.REDSTONE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DIAMOND) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.DIAMOND, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_INFESTED) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.INFESTED_STONE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DEBRIS_SMALL) { - return new WorldGenFeatureConfigured<>(new RangeWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.ANCIENT_DEBRIS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_DEBRIS_LARGE) { - return new WorldGenFeatureConfigured<>(new DepthAveragedWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.ANCIENT_DEBRIS_2, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_LAPIS) { - return new WorldGenFeatureConfigured<>(new DepthAveragedWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.LAPIS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_EMERALD) { - return new WorldGenFeatureConfigured<>(new EmeraldWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.EMERALD, serviceSupplier, getWorldGenFeatureEmeraldConfiguration(feature)), null); - } - if (feature == BiomeDecoratorGroups.ORE_MAGMA) { - return new WorldGenFeatureConfigured<>(new MagmaWorldGeneratorOverrider(WorldGenFeatureEmptyConfiguration.a, biome, Ore.MAGMA, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - - return null; - } - - private WorldGenFeatureConfigured getWorldGenFeatureOreConfiguration(final WorldGenFeatureConfigured feature) { - if (feature.c() instanceof WorldGenFeatureOreConfiguration) { - return (WorldGenFeatureConfigured) feature; - } - - if (feature.c() instanceof WorldGenFeatureCompositeConfiguration) { - final WorldGenFeatureCompositeConfiguration compositeConfiguration = (WorldGenFeatureCompositeConfiguration) feature.c(); - - return getWorldGenFeatureOreConfiguration(compositeConfiguration.b.get()); - } - - throw new RuntimeException("No WorldGenFeatureConfigured found"); - } - - private WorldGenFeatureConfigured getWorldGenFeatureEmeraldConfiguration(final WorldGenFeatureConfigured feature) { - if (feature.c() instanceof WorldGenFeatureReplaceBlockConfiguration) { - return (WorldGenFeatureConfigured) feature; - } - - if (feature.c() instanceof WorldGenFeatureCompositeConfiguration) { - final WorldGenFeatureCompositeConfiguration compositeConfiguration = (WorldGenFeatureCompositeConfiguration) feature.c(); - - return getWorldGenFeatureEmeraldConfiguration(compositeConfiguration.b.get()); - } - - throw new RuntimeException("No WorldGenFeatureConfigured found"); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - @NotNull - private IRegistryCustom getRegistry() { - final DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); - - return server.getCustomRegistry(); - } - -} diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSUtil_v1_16_R3.java b/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSUtil_v1_16_R3.java deleted file mode 100644 index dad2ed3b..00000000 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/NMSUtil_v1_16_R3.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R3; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R3.*; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_16_R3.CraftServer; -import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_16_R3 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_16_R3(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer_v1_16_R3(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final BiomeBase biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4); - - return Biome.valueOf(getRegistry().b(IRegistry.ay).getKey(biomeBase).getKey().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) { - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) defaultFeatureConfiguration; - final WorldGenFeatureOreConfiguration worldGenFeatureOreConfiguration = new WorldGenFeatureOreConfiguration(worldGenFeatureConfigured.f.b, worldGenFeatureConfigured.f.d, veinsSize); - - return new WorldGenFeatureConfigured<>(worldGenFeatureConfigured.e, worldGenFeatureOreConfiguration); - } - - @Override - public Object createCountConfiguration(final int veinsPerChunk, final int minimumHeight, final int heightSubtractValue, final int heightRange) { - return new RangeCombinedConfiguration(veinsPerChunk, new WorldGenFeatureChanceDecoratorRangeConfiguration(minimumHeight, heightSubtractValue, heightRange)); - } - - @Override - public Object createHeightAverageConfiguration(final int veinsPerChunk, final int heightCenter, final int heightRange) { - return new DepthAveragedCombinedConfiguration(veinsPerChunk, new WorldGenDecoratorHeightAverageConfiguration(heightCenter, heightRange)); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - if (object == Blocks.NETHER_GOLD_ORE) { - return Ore.NETHER_GOLD; - } - if (object == Blocks.ANCIENT_DEBRIS) { - return Ore.ANCIENT_DEBRIS; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final WorldServer worldServer = ((CraftWorld) world).getHandle(); - final DimensionManager dimensionManager = worldServer.getDimensionManager(); - - final RegistryMaterials registryMaterials = worldServer.worldDataServer.getGeneratorSettings().d(); - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.OVERWORLD); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.OVERWORLD; - } - } - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.THE_NETHER); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.NETHER; - } - } - - check: - { - final WorldDimension worlddimension = registryMaterials.a(WorldDimension.THE_END); - - if (worlddimension == null) { - break check; - } - - final DimensionManager other = worlddimension.a().get(); - - if (other == dimensionManager) { - return Dimension.THE_END; - } - } - - return Dimension.CUSTOM; - } - - @NotNull - private IRegistryCustom getRegistry() { - final DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); - - return server.getCustomRegistry(); - } - -} diff --git a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeWorldGeneratorOverrider.java b/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeWorldGeneratorOverrider.java deleted file mode 100644 index c8a331b3..00000000 --- a/impl/v1_16_R3/src/main/java/de/derfrzocker/ore/control/impl/v1_16_R3/RangeWorldGeneratorOverrider.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_16_R3; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.server.v1_16_R3.*; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class RangeWorldGeneratorOverrider extends WorldGenerator { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final WorldGenFeatureConfigured defaultFeatureConfiguration; - @NotNull - private final RangeCombinedConfiguration defaultConfiguration; - - public RangeWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final WorldGenFeatureConfigured defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - - final OreControlService service = serviceSupplier.get(); - - defaultConfiguration = (RangeCombinedConfiguration) service.getNMSService().getNMSUtil().createCountConfiguration( - (int) service.getDefaultValue(biome, ore, Setting.VEINS_PER_CHUNK), - (int) service.getDefaultValue(biome, ore, Setting.MINIMUM_HEIGHT), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_SUBTRACT_VALUE), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_RANGE)); - } - - public boolean a(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), defaultConfiguration, defaultFeatureConfiguration, null, (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object, object1), random); - } - - @Override - public boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, WorldGenFeatureEmptyConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, Object configuration, Object featureConfiguration) { - final RangeCombinedConfiguration combinedConfiguration = (RangeCombinedConfiguration) configuration; - final WorldGenFeatureConfigured worldGenFeatureConfigured = (WorldGenFeatureConfigured) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, combinedConfiguration, worldGenFeatureConfigured); - } - - private boolean generate(GeneratorAccessSeed generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPosition blockPosition, RangeCombinedConfiguration combinedConfiguration, WorldGenFeatureConfigured feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - WorldGenDecorator.c.a(null, random, new WorldGenDecoratorFrequencyConfiguration(combinedConfiguration.getVeinCount()), blockPosition) - .forEach(countBlockPosition -> WorldGenDecorator.g.a(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> WorldGenDecorator.l.a(null, random, combinedConfiguration.getConfiguration(), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.a(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - -} diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedWorldGeneratorOverrider.java b/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedWorldGeneratorOverrider.java deleted file mode 100644 index 340d4442..00000000 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/DepthAveragedWorldGeneratorOverrider.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_17_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.WorldGenLevel; -import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; -import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -import net.minecraft.world.level.levelgen.placement.FeatureDecorator; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class DepthAveragedWorldGeneratorOverrider extends Feature { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final ConfiguredFeature defaultFeatureConfiguration; - @NotNull - private final DepthAveragedCombinedConfiguration defaultConfiguration; - - public DepthAveragedWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final ConfiguredFeature defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - - final OreControlService service = serviceSupplier.get(); - - defaultConfiguration = (DepthAveragedCombinedConfiguration) service.getNMSService().getNMSUtil().createHeightAverageConfiguration( - (int) service.getDefaultValue(biome, ore, Setting.VEINS_PER_CHUNK), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_CENTER), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_RANGE)); - } - - public boolean a(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, NoneFeatureConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), defaultConfiguration, defaultFeatureConfiguration, null, (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object, object1), random); - } - - public boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, NoneFeatureConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, Object configuration, Object featureConfiguration) { - final DepthAveragedCombinedConfiguration combinedConfiguration = (DepthAveragedCombinedConfiguration) configuration; - final ConfiguredFeature worldGenFeatureConfigured = (ConfiguredFeature) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, combinedConfiguration, worldGenFeatureConfigured); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, DepthAveragedCombinedConfiguration combinedConfiguration, ConfiguredFeature feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - FeatureDecorator.COUNT.getPositions(null, random, new CountConfiguration(combinedConfiguration.getVeinCount()), blockPosition) - .forEach(countBlockPosition -> FeatureDecorator.SQUARE.getPositions(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> FeatureDecorator.RANGE.getPositions(null, random, combinedConfiguration.getConfiguration(), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.place(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - - @Override - public boolean place(FeaturePlaceContext featurePlaceContext) { - return this.a(featurePlaceContext.level(), featurePlaceContext.chunkGenerator(), featurePlaceContext.random(), featurePlaceContext.origin(), featurePlaceContext.config()); - } -} diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/EmeraldWorldGeneratorOverrider.java b/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/EmeraldWorldGeneratorOverrider.java deleted file mode 100644 index 610a1e7c..00000000 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/EmeraldWorldGeneratorOverrider.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_17_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.core.BlockPos; -import net.minecraft.util.valueproviders.UniformInt; -import net.minecraft.world.level.WorldGenLevel; -import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.VerticalAnchor; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; -import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneDecoratorConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.RangeDecoratorConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.ReplaceBlockConfiguration; -import net.minecraft.world.level.levelgen.heightproviders.UniformHeight; -import net.minecraft.world.level.levelgen.placement.FeatureDecorator; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class EmeraldWorldGeneratorOverrider extends Feature { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final ConfiguredFeature defaultFeatureConfiguration; - - public EmeraldWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final ConfiguredFeature defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - } - - public boolean a(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, NoneFeatureConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), NoneDecoratorConfiguration.INSTANCE, defaultFeatureConfiguration, - (location, Integer) -> Feature.REPLACE_SINGLE_BLOCK.place(new FeaturePlaceContext<>(generatorAccessSeed, chunkGenerator, random, new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()), defaultFeatureConfiguration.config)), - (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object1), random); - } - - public boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, NoneFeatureConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, Object featureConfiguration) { - final ConfiguredFeature worldGenFeatureConfigured = (ConfiguredFeature) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, worldGenFeatureConfigured); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, ConfiguredFeature feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - FeatureDecorator.COUNT.getPositions(null, random, new CountConfiguration(UniformInt.of(6, 24)), blockPosition) - .forEach(countBlockPosition -> FeatureDecorator.SQUARE.getPositions(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> FeatureDecorator.RANGE.getPositions(null, random, new RangeDecoratorConfiguration(UniformHeight.of(VerticalAnchor.absolute(4), VerticalAnchor.absolute(31))), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.place(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - - @Override - public boolean place(FeaturePlaceContext featurePlaceContext) { - return this.a(featurePlaceContext.level(), featurePlaceContext.chunkGenerator(), featurePlaceContext.random(), featurePlaceContext.origin(), featurePlaceContext.config()); - } -} \ No newline at end of file diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/MagmaWorldGeneratorOverrider.java b/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/MagmaWorldGeneratorOverrider.java deleted file mode 100644 index df9b4fbc..00000000 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/MagmaWorldGeneratorOverrider.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_17_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.WorldGenLevel; -import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.VerticalAnchor; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; -import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneDecoratorConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.RangeDecoratorConfiguration; -import net.minecraft.world.level.levelgen.heightproviders.UniformHeight; -import net.minecraft.world.level.levelgen.placement.FeatureDecorator; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class MagmaWorldGeneratorOverrider extends Feature { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final ConfiguredFeature defaultFeatureConfiguration; - - public MagmaWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final ConfiguredFeature defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - } - - public boolean a(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, NoneFeatureConfiguration configuration) { - - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), NoneDecoratorConfiguration.INSTANCE, defaultFeatureConfiguration, - (location, Integer) -> Feature.ORE.place(new FeaturePlaceContext<>(generatorAccessSeed, chunkGenerator, random, new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()), defaultFeatureConfiguration.config)), - (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object1), random); - } - - public boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, NoneFeatureConfiguration configuration) { - return this.a(generatorAccessSeed, chunkGenerator, random, blockPosition, configuration); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, Object featureConfiguration) { - final ConfiguredFeature worldGenFeatureConfigured = (ConfiguredFeature) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, worldGenFeatureConfigured); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, ConfiguredFeature feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - FeatureDecorator.COUNT.getPositions(null, random, new CountConfiguration(4), blockPosition) - .forEach(countBlockPosition -> FeatureDecorator.SQUARE.getPositions(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> FeatureDecorator.RANGE.getPositions(null, random, new RangeDecoratorConfiguration(UniformHeight.of(VerticalAnchor.absolute(27), VerticalAnchor.absolute(36))), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.place(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - - @Override - public boolean place(FeaturePlaceContext featurePlaceContext) { - return this.a(featurePlaceContext.level(), featurePlaceContext.chunkGenerator(), featurePlaceContext.random(), featurePlaceContext.origin(), featurePlaceContext.config()); - } -} \ No newline at end of file diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSReplacer_v1_17_R1.java b/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSReplacer_v1_17_R1.java deleted file mode 100644 index d9baee71..00000000 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSReplacer_v1_17_R1.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_17_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.data.BuiltinRegistries; -import net.minecraft.data.worldgen.Features; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.world.level.biome.BiomeGenerationSettings; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.configurations.DecoratedFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.ReplaceBlockConfiguration; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_17_R1.CraftServer; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; - - -@SuppressWarnings("Duplicates") -class NMSReplacer_v1_17_R1 { - - @NotNull - private final Supplier serviceSupplier; - - NMSReplacer_v1_17_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - void replaceNMS() { - final Registry registry = getRegistry().registryOrThrow(Registry.BIOME_REGISTRY); - for (final net.minecraft.world.level.biome.Biome biomeBase : registry) { - try { - replaceBase(biomeBase, registry.getKey(biomeBase)); - } catch (final Exception e) { - throw new RuntimeException("Unexpected error while hook in NMS for Biome: " + biomeBase, e); - } - } - } - - private void replaceBase(@NotNull final net.minecraft.world.level.biome.Biome base, ResourceLocation minecraftKey) throws NoSuchFieldException, IllegalAccessException { - final Biome biome; - - try { - biome = Biome.valueOf(minecraftKey.getPath().toUpperCase()); - } catch (final IllegalArgumentException e) { - return; - } - - final List>>> decorations = base.getGenerationSettings().features(); - - final List>>> newDecorations = new ArrayList<>(); - - for (final List>> list : decorations) { - final List>> newList = new ArrayList<>(); - newDecorations.add(decorations.indexOf(list), newList); - - for (final Supplier> featureSupplier : list) { - final ConfiguredFeature feature = featureSupplier.get(); - - ConfiguredFeature newFeature = check(biome, feature); - - if (newFeature != null) { - addToList(newList, list.indexOf(featureSupplier), newFeature); - } else { - newList.add(list.indexOf(featureSupplier), featureSupplier); - } - } - } - - final Field field = getField(BiomeGenerationSettings.class, "f"); - field.setAccessible(true); - field.set(base.getGenerationSettings(), newDecorations); - } - - private void addToList(List>> list, int index, ConfiguredFeature feature) { - list.add(index, () -> feature); - } - - @Nullable - private ConfiguredFeature check(final Biome biome, ConfiguredFeature feature) { - //Not the best method to do this, but hey it works - final Registry> registry = getRegistry().registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY); - feature = BuiltinRegistries.CONFIGURED_FEATURE.get(registry.getKey(feature)); - - if (feature == null) { - return null; - } - - if (feature == Features.ORE_GOLD_DELTAS || feature == Features.ORE_GOLD_NETHER) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.NETHER_GOLD, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_QUARTZ_DELTAS || feature == Features.ORE_QUARTZ_NETHER) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.NETHER_QUARTZ, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_DIRT) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.DIRT, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_GRAVEL) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.GRAVEL, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_GRANITE) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.GRANITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_DIORITE) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.DIORITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_ANDESITE) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.ANDESITE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_COAL) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.COAL, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_IRON) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.IRON, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_GOLD_EXTRA) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.GOLD_BADLANDS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_GOLD) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.GOLD, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_REDSTONE) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.REDSTONE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_DIAMOND) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.DIAMOND, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_INFESTED) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.INFESTED_STONE, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_DEBRIS_SMALL) { - return new ConfiguredFeature<>(new RangeWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.ANCIENT_DEBRIS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_DEBRIS_LARGE) { - return new ConfiguredFeature<>(new DepthAveragedWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.ANCIENT_DEBRIS_2, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_LAPIS) { - return new ConfiguredFeature<>(new DepthAveragedWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.LAPIS, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_EMERALD) { - return new ConfiguredFeature<>(new EmeraldWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.EMERALD, serviceSupplier, getWorldGenFeatureEmeraldConfiguration(feature)), null); - } - if (feature == Features.ORE_MAGMA) { - return new ConfiguredFeature<>(new MagmaWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.MAGMA, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - if (feature == Features.ORE_COPPER) { - return new ConfiguredFeature<>(new DepthAveragedWorldGeneratorOverrider(NoneFeatureConfiguration.CODEC, biome, Ore.COPPER, serviceSupplier, getWorldGenFeatureOreConfiguration(feature)), null); - } - - return null; - } - - private ConfiguredFeature getWorldGenFeatureOreConfiguration(final ConfiguredFeature feature) { - if (feature.config() instanceof OreConfiguration) { - return (ConfiguredFeature) feature; - } - - if (feature.config() instanceof DecoratedFeatureConfiguration) { - final DecoratedFeatureConfiguration compositeConfiguration = (DecoratedFeatureConfiguration) feature.config(); - - return getWorldGenFeatureOreConfiguration(compositeConfiguration.feature.get()); - } - - throw new RuntimeException("No ConfiguredFeature found"); - } - - private ConfiguredFeature getWorldGenFeatureEmeraldConfiguration(final ConfiguredFeature feature) { - if (feature.config() instanceof ReplaceBlockConfiguration) { - return (ConfiguredFeature) feature; - } - - if (feature.config() instanceof DecoratedFeatureConfiguration) { - final DecoratedFeatureConfiguration compositeConfiguration = (DecoratedFeatureConfiguration) feature.config(); - - return getWorldGenFeatureEmeraldConfiguration(compositeConfiguration.feature.get()); - } - - throw new RuntimeException("No WorldGenFeatureConfigured found"); - } - - @SuppressWarnings("rawtypes") - private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { - try { - return clazz.getDeclaredField(fieldName); - } catch (final NoSuchFieldException e) { - final Class superClass = clazz.getSuperclass(); - if (superClass == null) { - throw e; - } else { - return getField(superClass, fieldName); - } - } - } - - @NotNull - private RegistryAccess getRegistry() { - final DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); - - return server.registryAccess(); - } - -} \ No newline at end of file diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSUtil_v1_17_R1.java b/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSUtil_v1_17_R1.java deleted file mode 100644 index 0036d781..00000000 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/NMSUtil_v1_17_R1.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_17_R1; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Dimension; -import de.derfrzocker.ore.control.api.NMSUtil; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.core.MappedRegistry; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.dimension.LevelStem; -import net.minecraft.world.level.levelgen.VerticalAnchor; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.RangeDecoratorConfiguration; -import net.minecraft.world.level.levelgen.heightproviders.TrapezoidHeight; -import net.minecraft.world.level.levelgen.heightproviders.UniformHeight; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_17_R1.CraftServer; -import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -@SuppressWarnings("Duplicates") -public class NMSUtil_v1_17_R1 implements NMSUtil { - - @NotNull - private final Supplier serviceSupplier; - - public NMSUtil_v1_17_R1(@NotNull final Supplier serviceSupplier) { - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - - this.serviceSupplier = serviceSupplier; - } - - @Override - public void replaceNMS() { - new NMSReplacer_v1_17_R1(serviceSupplier).replaceNMS(); - } - - @Override - public Biome getBiome(@NotNull final World world, @NotNull final ChunkCoordIntPair chunkCoordIntPair) { - final net.minecraft.world.level.biome.Biome biomeBase = ((CraftWorld) world).getHandle().getChunkProvider().getGenerator().getBiomeSource().getNoiseBiome(chunkCoordIntPair.getX() << 4, 0, chunkCoordIntPair.getZ() << 4); - - return Biome.valueOf(getRegistry().registryOrThrow(Registry.BIOME_REGISTRY).getKey(biomeBase).getPath().toUpperCase()); - } - - @Override - public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) { - final ConfiguredFeature worldGenFeatureConfigured = (ConfiguredFeature) defaultFeatureConfiguration; - final OreConfiguration worldGenFeatureOreConfiguration = new OreConfiguration(worldGenFeatureConfigured.config.targetStates, veinsSize, worldGenFeatureConfigured.config.discardChanceOnAirExposure); - - return new ConfiguredFeature<>(worldGenFeatureConfigured.feature, worldGenFeatureOreConfiguration); - } - - @Override - public Object createCountConfiguration(final int veinsPerChunk, final int minimumHeight, final int heightSubtractValue, final int heightRange) { - return new RangeCombinedConfiguration(veinsPerChunk, new RangeDecoratorConfiguration(UniformHeight.of(VerticalAnchor.absolute(minimumHeight), VerticalAnchor.absolute(minimumHeight + (heightRange - heightSubtractValue))))); - } - - @Override - public Object createHeightAverageConfiguration(final int veinsPerChunk, final int heightCenter, final int heightRange) { - return new DepthAveragedCombinedConfiguration(veinsPerChunk, new RangeDecoratorConfiguration(TrapezoidHeight.of(VerticalAnchor.absolute(heightCenter - heightRange), VerticalAnchor.absolute(heightCenter + heightRange)))); - } - - @Override - public Ore getOre(@NotNull final Object object) { - if (object == Blocks.DIAMOND_ORE) { - return Ore.DIAMOND; - } - if (object == Blocks.COAL_ORE) { - return Ore.COAL; - } - if (object == Blocks.IRON_ORE) { - return Ore.IRON; - } - if (object == Blocks.REDSTONE_ORE) { - return Ore.REDSTONE; - } - if (object == Blocks.GOLD_ORE) { - return Ore.GOLD; - } - if (object == Blocks.DIRT) { - return Ore.DIRT; - } - if (object == Blocks.GRAVEL) { - return Ore.GRAVEL; - } - if (object == Blocks.GRANITE) { - return Ore.GRANITE; - } - if (object == Blocks.DIORITE) { - return Ore.DIORITE; - } - if (object == Blocks.ANDESITE) { - return Ore.ANDESITE; - } - if (object == Blocks.NETHER_QUARTZ_ORE) { - return Ore.NETHER_QUARTZ; - } - if (object == Blocks.INFESTED_STONE) { - return Ore.INFESTED_STONE; - } - if (object == Blocks.MAGMA_BLOCK) { - return Ore.MAGMA; - } - if (object == Blocks.NETHER_GOLD_ORE) { - return Ore.NETHER_GOLD; - } - if (object == Blocks.ANCIENT_DEBRIS) { - return Ore.ANCIENT_DEBRIS; - } - if (object == Blocks.COPPER_ORE) { - return Ore.COPPER; - } - - return null; - } - - @NotNull - @Override - public Dimension getDimension(@NotNull final World world) { - if (world.getGenerator() != null) { - return Dimension.CUSTOM; - } - - final ServerLevel worldServer = ((CraftWorld) world).getHandle(); - final DimensionType dimensionManager = worldServer.dimensionType(); - - final MappedRegistry registryMaterials = worldServer.E.worldGenSettings().dimensions(); - - check: - { - final LevelStem worlddimension = registryMaterials.get(LevelStem.OVERWORLD); - - if (worlddimension == null) { - break check; - } - - final DimensionType other = worlddimension.typeSupplier().get(); - - if (other == dimensionManager) { - return Dimension.OVERWORLD; - } - } - - check: - { - final LevelStem worlddimension = registryMaterials.get(LevelStem.NETHER); - - if (worlddimension == null) { - break check; - } - - final DimensionType other = worlddimension.typeSupplier().get(); - - if (other == dimensionManager) { - return Dimension.NETHER; - } - } - - check: - { - final LevelStem worlddimension = registryMaterials.get(LevelStem.END); - - if (worlddimension == null) { - break check; - } - - final DimensionType other = worlddimension.typeSupplier().get(); - - if (other == dimensionManager) { - return Dimension.THE_END; - } - } - - return Dimension.CUSTOM; - } - - @NotNull - private RegistryAccess getRegistry() { - final DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); - - return server.registryAccess(); - } - -} diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeWorldGeneratorOverrider.java b/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeWorldGeneratorOverrider.java deleted file mode 100644 index c5a886d7..00000000 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeWorldGeneratorOverrider.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.v1_17_R1; - -import com.mojang.serialization.Codec; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.NMSService; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.spigot.utils.ChunkCoordIntPair; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.WorldGenLevel; -import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; -import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -import net.minecraft.world.level.levelgen.placement.FeatureDecorator; -import org.apache.commons.lang.Validate; -import org.bukkit.World; -import org.jetbrains.annotations.NotNull; - -import java.util.Random; -import java.util.function.Supplier; - -public class RangeWorldGeneratorOverrider extends Feature { - - @NotNull - private final Biome biome; - @NotNull - private final Ore ore; - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final ConfiguredFeature defaultFeatureConfiguration; - @NotNull - private final RangeCombinedConfiguration defaultConfiguration; - - public RangeWorldGeneratorOverrider(Codec codec, @NotNull final Biome biome, @NotNull final Ore ore, @NotNull final Supplier serviceSupplier, @NotNull final ConfiguredFeature defaultFeatureConfiguration) { - super(codec); - - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(serviceSupplier, "Service Supplier cannot be null"); - Validate.notNull(defaultFeatureConfiguration, "WorldGenFeatureConfigured cannot be null"); - - this.biome = biome; - this.ore = ore; - this.serviceSupplier = serviceSupplier; - this.defaultFeatureConfiguration = defaultFeatureConfiguration; - - final OreControlService service = serviceSupplier.get(); - - defaultConfiguration = (RangeCombinedConfiguration) service.getNMSService().getNMSUtil().createCountConfiguration( - (int) service.getDefaultValue(biome, ore, Setting.VEINS_PER_CHUNK), - (int) service.getDefaultValue(biome, ore, Setting.MINIMUM_HEIGHT), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_SUBTRACT_VALUE), - (int) service.getDefaultValue(biome, ore, Setting.HEIGHT_RANGE)); - } - - public boolean a(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, NoneFeatureConfiguration configuration) { - final NMSService nmsService = serviceSupplier.get().getNMSService(); - final World world = generatorAccessSeed.getMinecraftWorld().getWorld(); - return nmsService.generate(world, biome, ore, new ChunkCoordIntPair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), defaultConfiguration, defaultFeatureConfiguration, null, (object, object1) -> generate(generatorAccessSeed, chunkGenerator, random, blockPosition, object, object1), random); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, Object configuration, Object featureConfiguration) { - final RangeCombinedConfiguration combinedConfiguration = (RangeCombinedConfiguration) configuration; - final ConfiguredFeature worldGenFeatureConfigured = (ConfiguredFeature) featureConfiguration; - - return generate(generatorAccessSeed, chunkGenerator, random, blockPosition, combinedConfiguration, worldGenFeatureConfigured); - } - - private boolean generate(WorldGenLevel generatorAccessSeed, ChunkGenerator chunkGenerator, Random random, BlockPos blockPosition, RangeCombinedConfiguration combinedConfiguration, ConfiguredFeature feature) { - // We are doing this, in this more or less complicated way, to simulate Minecraft's normal flow as exactly as possible - FeatureDecorator.COUNT.getPositions(null, random, new CountConfiguration(combinedConfiguration.getVeinCount()), blockPosition) - .forEach(countBlockPosition -> FeatureDecorator.SQUARE.getPositions(null, random, null, countBlockPosition) - .forEach(squareBlockPosition -> FeatureDecorator.RANGE.getPositions(null, random, combinedConfiguration.getConfiguration(), squareBlockPosition) - .forEach(rangeBlockPosition -> feature.place(generatorAccessSeed, chunkGenerator, random, rangeBlockPosition) - ) - ) - ); - - return true; - } - - @Override - public boolean place(FeaturePlaceContext featurePlaceContext) { - return this.a(featurePlaceContext.level(), featurePlaceContext.chunkGenerator(), featurePlaceContext.random(), featurePlaceContext.origin(), featurePlaceContext.config()); - } -} diff --git a/impl/v1_17_R1/pom.xml b/impl/v1_18_R1/pom.xml similarity index 83% rename from impl/v1_17_R1/pom.xml rename to impl/v1_18_R1/pom.xml index 2e1d8b0d..20008eaa 100644 --- a/impl/v1_17_R1/pom.xml +++ b/impl/v1_18_R1/pom.xml @@ -10,7 +10,7 @@ ${revision} - ore-control-impl-v1_17_R1 + ore-control-impl-v1_18_R1 @@ -19,10 +19,16 @@ ${project.version} provided + + de.derfrzocker + ore-control-common + ${project.version} + provided + org.spigotmc spigot - 1.17-R0.1-SNAPSHOT + 1.18.1-R0.1-SNAPSHOT remapped-mojang provided true @@ -34,7 +40,7 @@ net.md-5 specialsource-maven-plugin - 1.2.2 + 1.2.3 package @@ -43,9 +49,9 @@ remap-obf - org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:txt:maps-mojang + org.spigotmc:minecraft-server:1.18-R0.1-SNAPSHOT:txt:maps-mojang true - org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-mojang + org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-mojang true remapped-obf @@ -61,8 +67,8 @@ ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-obf + org.spigotmc:minecraft-server:1.18-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-obf diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/MinecraftFeatureGenerator.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/MinecraftFeatureGenerator.java new file mode 100644 index 00000000..3754236d --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/MinecraftFeatureGenerator.java @@ -0,0 +1,87 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.feature.generator; + +import com.mojang.serialization.Codec; +import de.derfrzocker.feature.api.FeatureGenerator; +import de.derfrzocker.feature.api.FeatureGeneratorConfiguration; +import de.derfrzocker.feature.api.Registries; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; +import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.v1_18_R1.generator.CraftLimitedRegion; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; +import java.util.Random; + +public abstract class MinecraftFeatureGenerator implements FeatureGenerator { + + private final Codec codec; + private final Feature feature; + private final NamespacedKey namespacedKey; + + public MinecraftFeatureGenerator(Registries registries, Feature feature, String name) { + this.codec = (Codec) createCodec(registries); + this.feature = feature; + this.namespacedKey = NamespacedKey.minecraft(name); + } + + public abstract C mergeConfig(C first, C second); + + public abstract Codec createCodec(Registries registries); + + public abstract M createConfiguration(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration); + + @Override + public C merge(FeatureGeneratorConfiguration first, FeatureGeneratorConfiguration second) { + return mergeConfig((C) first, (C) second); + } + + @Override + public void place(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration) { + WorldGenLevel level = ((CraftLimitedRegion) limitedRegion).getHandle(); + M config = createConfiguration(worldInfo, random, position, limitedRegion, configuration); + feature.place(new FeaturePlaceContext<>(Optional.empty(), level, level.getMinecraftWorld().getChunkSource().getGenerator(), random, new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), config)); + } + + @Override + public Codec getCodec() { + return codec; + } + + @NotNull + @Override + public NamespacedKey getKey() { + return namespacedKey; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/OreFeatureGenerator.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/OreFeatureGenerator.java new file mode 100644 index 00000000..aa957f90 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/OreFeatureGenerator.java @@ -0,0 +1,98 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.feature.generator; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.common.value.number.FloatType; +import de.derfrzocker.feature.common.value.number.FloatValue; +import de.derfrzocker.feature.common.value.number.IntegerType; +import de.derfrzocker.feature.common.value.number.IntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.feature.generator.configuration.OreFeatureConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.TargetType; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.TargetValue; +import net.minecraft.world.level.levelgen.feature.OreFeature; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.Random; + +public class OreFeatureGenerator extends MinecraftFeatureGenerator { + + public OreFeatureGenerator(Registries registries) { + super(registries, OreFeature.ORE, "ore"); + } + + public Codec createCodec(Registries registries) { + return RecordCodecBuilder.create((builder) -> builder.group( + Codec.list(registries.getValueTypeRegistry(TargetType.class). + dispatch("target_type", TargetValue::getValueType, TargetType::getCodec)). + optionalFieldOf("targets"). + forGetter(config -> Optional.ofNullable(config.getTargets())), + registries.getValueTypeRegistry(IntegerType.class).dispatch("size_type", IntegerValue::getValueType, IntegerType::getCodec). + optionalFieldOf("size").forGetter(config -> Optional.ofNullable(config.getSize())), + registries.getValueTypeRegistry(FloatType.class).dispatch("discard_chance_on_air_exposure_type", FloatValue::getValueType, FloatType::getCodec). + optionalFieldOf("discard_chance_on_air_exposure").forGetter(config -> Optional.ofNullable(config.getDiscardChanceOnAirExposure())) + ).apply(builder, (targets, size, discardChanceOnAirExposure) -> new OreFeatureConfiguration(this, targets.orElse(null), size.orElse(null), discardChanceOnAirExposure.orElse(null)))); + } + + @Override + public OreFeatureConfiguration mergeConfig(OreFeatureConfiguration first, OreFeatureConfiguration second) { + return new OreFeatureConfiguration(this, + first.getTargets() != null ? first.getTargets() : second.getTargets(), + first.getSize() != null ? first.getSize() : second.getSize(), + first.getDiscardChanceOnAirExposure() != null ? first.getDiscardChanceOnAirExposure() : second.getDiscardChanceOnAirExposure()); + } + + @Override + public OreConfiguration createConfiguration(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull OreFeatureConfiguration configuration) { + List blockStates = new ArrayList<>(); + if (configuration.getTargets() != null) { + for (TargetValue targetValue : configuration.getTargets()) { + blockStates.add(targetValue.getValue(worldInfo, random, position, limitedRegion)); + } + } + + int size = 0; + if (configuration.getSize() != null) { + size = configuration.getSize().getValue(worldInfo, random, position, limitedRegion); + } + + float discardChanceOnAirExposure = 0f; + if (configuration.getDiscardChanceOnAirExposure() != null) { + discardChanceOnAirExposure = configuration.getDiscardChanceOnAirExposure().getValue(worldInfo, random, position, limitedRegion); + } + + return new OreConfiguration(blockStates, size, discardChanceOnAirExposure); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/configuration/OreFeatureConfiguration.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/configuration/OreFeatureConfiguration.java new file mode 100644 index 00000000..a2727369 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/feature/generator/configuration/OreFeatureConfiguration.java @@ -0,0 +1,66 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.feature.generator.configuration; + +import de.derfrzocker.feature.api.FeatureGenerator; +import de.derfrzocker.feature.api.FeatureGeneratorConfiguration; +import de.derfrzocker.feature.common.value.number.FloatValue; +import de.derfrzocker.feature.common.value.number.IntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.TargetValue; + +import java.util.List; + +public class OreFeatureConfiguration implements FeatureGeneratorConfiguration { + + private final FeatureGenerator featureGenerator; + private final List targets; + private final IntegerValue size; + private final FloatValue discardChanceOnAirExposure; + + public OreFeatureConfiguration(FeatureGenerator featureGenerator, List targets, IntegerValue size, FloatValue discardChanceOnAirExposure) { + this.featureGenerator = featureGenerator; + this.targets = targets; + this.size = size; + this.discardChanceOnAirExposure = discardChanceOnAirExposure; + } + + public List getTargets() { + return targets; + } + + public IntegerValue getSize() { + return size; + } + + public FloatValue getDiscardChanceOnAirExposure() { + return discardChanceOnAirExposure; + } + + @Override + public FeatureGenerator getFeatureGenerator() { + return featureGenerator; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/CountModifier.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/CountModifier.java new file mode 100644 index 00000000..07384d39 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/CountModifier.java @@ -0,0 +1,76 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.CountModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.intprovider.IntProviderType; +import de.derfrzocker.feature.impl.v1_18_R1.value.intprovider.IntProviderValue; +import net.minecraft.util.valueproviders.ConstantInt; +import net.minecraft.util.valueproviders.IntProvider; +import net.minecraft.world.level.levelgen.placement.CountPlacement; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; +import java.util.Random; + +public class CountModifier extends MinecraftPlacementModifier { + + public CountModifier(@NotNull Registries registries) { + super(registries, "count"); + } + + @Override + public CountModifierConfiguration mergeConfig(CountModifierConfiguration first, CountModifierConfiguration second) { + return new CountModifierConfiguration(this, + first.getCount() != null ? first.getCount() : second.getCount()); + } + + @Override + public Codec createCodec(Registries registries) { + return RecordCodecBuilder.create((builder) -> builder.group( + registries.getValueTypeRegistry(IntProviderType.class).dispatch("count_type", IntProviderValue::getValueType, IntProviderType::getCodec). + optionalFieldOf("count").forGetter(config -> Optional.ofNullable(config.getCount())) + ).apply(builder, (count) -> new CountModifierConfiguration(this, count.orElse(null)))); + } + + @Override + public CountPlacement createPlacementModifier(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull CountModifierConfiguration configuration) { + IntProvider count; + if (configuration.getCount() != null) { + count = configuration.getCount().getValue(worldInfo, random, position, limitedRegion); + } else { + count = ConstantInt.of(0); + } + + return CountPlacement.of(count); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/HeightRangeModifier.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/HeightRangeModifier.java new file mode 100644 index 00000000..1e253a5c --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/HeightRangeModifier.java @@ -0,0 +1,77 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.HeightRangeModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider.HeightProviderType; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider.HeightProviderValue; +import net.minecraft.world.level.levelgen.VerticalAnchor; +import net.minecraft.world.level.levelgen.heightproviders.ConstantHeight; +import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; +import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; +import java.util.Random; + +public class HeightRangeModifier extends MinecraftPlacementModifier { + + public HeightRangeModifier(@NotNull Registries registries) { + super(registries, "height_range"); + } + + @Override + public HeightRangeModifierConfiguration mergeConfig(HeightRangeModifierConfiguration first, HeightRangeModifierConfiguration second) { + return new HeightRangeModifierConfiguration(this, + first.getHeight() != null ? first.getHeight() : second.getHeight()); + } + + @Override + public Codec createCodec(Registries registries) { + return RecordCodecBuilder.create((builder) -> builder.group( + registries.getValueTypeRegistry(HeightProviderType.class).dispatch("height_range_type", HeightProviderValue::getValueType, HeightProviderType::getCodec). + optionalFieldOf("height").forGetter(config -> Optional.ofNullable(config.getHeight())) + ).apply(builder, (count) -> new HeightRangeModifierConfiguration(this, count.orElse(null)))); + } + + @Override + public HeightRangePlacement createPlacementModifier(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull HeightRangeModifierConfiguration configuration) { + HeightProvider height; + if (configuration.getHeight() != null) { + height = configuration.getHeight().getValue(worldInfo, random, position, limitedRegion); + } else { + height = ConstantHeight.of(VerticalAnchor.bottom()); + } + + return HeightRangePlacement.of(height); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/MinecraftPlacementModifier.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/MinecraftPlacementModifier.java new file mode 100644 index 00000000..47ed8e32 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/MinecraftPlacementModifier.java @@ -0,0 +1,86 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement; + +import com.mojang.serialization.Codec; +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.api.Registries; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.levelgen.placement.PlacementContext; +import net.minecraft.world.level.levelgen.placement.PlacementModifier; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.v1_18_R1.generator.CraftLimitedRegion; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; +import java.util.Random; +import java.util.stream.Stream; + +public abstract class MinecraftPlacementModifier implements FeaturePlacementModifier { + + private final Codec codec; + private final NamespacedKey namespacedKey; + + public MinecraftPlacementModifier(@NotNull Registries registries, @NotNull String name) { + this.codec = (Codec) createCodec(registries); + this.namespacedKey = NamespacedKey.minecraft(name); + } + + public abstract C mergeConfig(C first, C second); + + public abstract Codec createCodec(Registries registries); + + public abstract M createPlacementModifier(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration); + + @Override + public C merge(PlacementModifierConfiguration first, PlacementModifierConfiguration second) { + return mergeConfig((C) first, (C) second); + } + + @Override + public Stream getPositions(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration) { + WorldGenLevel level = ((CraftLimitedRegion) limitedRegion).getHandle(); + M placementModifier = createPlacementModifier(worldInfo, random, position, limitedRegion, configuration); + return placementModifier.getPositions(new PlacementContext(level, level.getMinecraftWorld().getChunkSource().getGenerator(), Optional.empty()), random, new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ())). + map(pos -> new BlockVector(pos.getX(), pos.getY(), pos.getZ())); + } + + @Override + public Codec getCodec() { + return codec; + } + + @NotNull + @Override + public NamespacedKey getKey() { + return namespacedKey; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/RarityModifier.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/RarityModifier.java new file mode 100644 index 00000000..571b93ce --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/RarityModifier.java @@ -0,0 +1,72 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.common.value.number.IntegerType; +import de.derfrzocker.feature.common.value.number.IntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.RarityModifierConfiguration; +import net.minecraft.world.level.levelgen.placement.RarityFilter; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; +import java.util.Random; + +public class RarityModifier extends MinecraftPlacementModifier { + + public RarityModifier(@NotNull Registries registries) { + super(registries, "rarity_filter"); + } + + + @Override + public RarityModifierConfiguration mergeConfig(RarityModifierConfiguration first, RarityModifierConfiguration second) { + return new RarityModifierConfiguration(this, + first.getChance() != null ? first.getChance() : second.getChance()); + } + + @Override + public Codec createCodec(Registries registries) { + return RecordCodecBuilder.create((builder) -> builder.group( + registries.getValueTypeRegistry(IntegerType.class).dispatch("chance_type", IntegerValue::getValueType, IntegerType::getCodec). + optionalFieldOf("chance").forGetter(config -> Optional.ofNullable(config.getChance())) + ).apply(builder, (chance) -> new RarityModifierConfiguration(this, chance.orElse(null)))); + } + + @Override + public RarityFilter createPlacementModifier(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull RarityModifierConfiguration configuration) { + int chance = 0; + if (configuration.getChance() != null) { + chance = configuration.getChance().getValue(worldInfo, random, position, limitedRegion); + } + return RarityFilter.onAverageOnceEvery(chance); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifier.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifier.java new file mode 100644 index 00000000..d7a11445 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifier.java @@ -0,0 +1,89 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.common.value.number.IntegerType; +import de.derfrzocker.feature.common.value.number.IntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.SurfaceRelativeThresholdModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightmap.HeightmapType; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightmap.HeightmapValue; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.placement.SurfaceRelativeThresholdFilter; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; +import java.util.Random; + +public class SurfaceRelativeThresholdModifier extends MinecraftPlacementModifier { + public SurfaceRelativeThresholdModifier(@NotNull Registries registries) { + super(registries, "surface_relative_threshold_filter"); + } + + @Override + public SurfaceRelativeThresholdModifierConfiguration mergeConfig(SurfaceRelativeThresholdModifierConfiguration first, SurfaceRelativeThresholdModifierConfiguration second) { + return new SurfaceRelativeThresholdModifierConfiguration(this, + first.getHeightmap() != null ? first.getHeightmap() : second.getHeightmap(), + first.getMinInclusive() != null ? first.getMinInclusive() : second.getMinInclusive(), + first.getMaxInclusive() != null ? first.getMaxInclusive() : second.getMaxInclusive()); + } + + @Override + public Codec createCodec(Registries registries) { + return RecordCodecBuilder.create((builder) -> builder.group( + registries.getValueTypeRegistry(HeightmapType.class).dispatch("heightmap_type", HeightmapValue::getValueType, HeightmapType::getCodec). + optionalFieldOf("heightmap").forGetter(config -> Optional.ofNullable(config.getHeightmap())), + registries.getValueTypeRegistry(IntegerType.class).dispatch("min_inclusive_type", IntegerValue::getValueType, IntegerType::getCodec). + optionalFieldOf("min_inclusive").forGetter(config -> Optional.ofNullable(config.getMinInclusive())), + registries.getValueTypeRegistry(IntegerType.class).dispatch("max_inclusive_type", IntegerValue::getValueType, IntegerType::getCodec). + optionalFieldOf("max_inclusive").forGetter(config -> Optional.ofNullable(config.getMaxInclusive())) + ).apply(builder, (heightmap, minInclusive, maxInclusive) -> new SurfaceRelativeThresholdModifierConfiguration(this, heightmap.orElse(null), minInclusive.orElse(null), maxInclusive.orElse(null)))); + } + + @Override + public SurfaceRelativeThresholdFilter createPlacementModifier(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull SurfaceRelativeThresholdModifierConfiguration configuration) { + Heightmap.Types heightmap = Heightmap.Types.MOTION_BLOCKING; + if (configuration.getHeightmap() != null) { + heightmap = configuration.getHeightmap().getValue(worldInfo, random, position, limitedRegion); + } + + int minInclusive = 0; + if (configuration.getMinInclusive() != null) { + minInclusive = configuration.getMinInclusive().getValue(worldInfo, random, position, limitedRegion); + } + + int maxInclusive = 0; + if (configuration.getMaxInclusive() != null) { + maxInclusive = configuration.getMaxInclusive().getValue(worldInfo, random, position, limitedRegion); + } + return SurfaceRelativeThresholdFilter.of(heightmap, minInclusive, maxInclusive); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceWaterDepthModifier.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceWaterDepthModifier.java new file mode 100644 index 00000000..bc2fda64 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/SurfaceWaterDepthModifier.java @@ -0,0 +1,71 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.common.value.number.IntegerType; +import de.derfrzocker.feature.common.value.number.IntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.SurfaceWaterDepthModifierConfiguration; +import net.minecraft.world.level.levelgen.placement.SurfaceWaterDepthFilter; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; +import java.util.Random; + +public class SurfaceWaterDepthModifier extends MinecraftPlacementModifier { + + public SurfaceWaterDepthModifier(@NotNull Registries registries) { + super(registries, "surface_water_depth_filter"); + } + + @Override + public SurfaceWaterDepthModifierConfiguration mergeConfig(SurfaceWaterDepthModifierConfiguration first, SurfaceWaterDepthModifierConfiguration second) { + return new SurfaceWaterDepthModifierConfiguration(this, + first.getMaxWaterDepth() != null ? first.getMaxWaterDepth() : second.getMaxWaterDepth()); + } + + @Override + public Codec createCodec(Registries registries) { + return RecordCodecBuilder.create((builder) -> builder.group( + registries.getValueTypeRegistry(IntegerType.class).dispatch("max_water_depth_type", IntegerValue::getValueType, IntegerType::getCodec). + optionalFieldOf("max_water_depth").forGetter(config -> Optional.ofNullable(config.getMaxWaterDepth())) + ).apply(builder, (maxWaterDepth) -> new SurfaceWaterDepthModifierConfiguration(this, maxWaterDepth.orElse(null)))); + } + + @Override + public SurfaceWaterDepthFilter createPlacementModifier(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull SurfaceWaterDepthModifierConfiguration configuration) { + int maxWaterDepth = 0; + if (configuration.getMaxWaterDepth() != null) { + maxWaterDepth = configuration.getMaxWaterDepth().getValue(worldInfo, random, position, limitedRegion); + } + return SurfaceWaterDepthFilter.forMaxDepth(maxWaterDepth); + } +} \ No newline at end of file diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/CountModifierConfiguration.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/CountModifierConfiguration.java new file mode 100644 index 00000000..ea2bdbd2 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/CountModifierConfiguration.java @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement.configuration; + +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.intprovider.IntProviderValue; + +public class CountModifierConfiguration implements PlacementModifierConfiguration { + + private final FeaturePlacementModifier placementModifier; + private final IntProviderValue count; + + public CountModifierConfiguration(FeaturePlacementModifier placementModifier, IntProviderValue count) { + this.placementModifier = placementModifier; + this.count = count; + } + + public IntProviderValue getCount() { + return count; + } + + @Override + public FeaturePlacementModifier getPlacementModifier() { + return placementModifier; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/HeightRangeModifierConfiguration.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/HeightRangeModifierConfiguration.java new file mode 100644 index 00000000..c4585b7f --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/HeightRangeModifierConfiguration.java @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement.configuration; + +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider.HeightProviderValue; + +public class HeightRangeModifierConfiguration implements PlacementModifierConfiguration { + + private final FeaturePlacementModifier placementModifier; + private final HeightProviderValue height; + + public HeightRangeModifierConfiguration(FeaturePlacementModifier placementModifier, HeightProviderValue height) { + this.placementModifier = placementModifier; + this.height = height; + } + + public HeightProviderValue getHeight() { + return height; + } + + @Override + public FeaturePlacementModifier getPlacementModifier() { + return placementModifier; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/RarityModifierConfiguration.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/RarityModifierConfiguration.java new file mode 100644 index 00000000..2372ea3f --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/RarityModifierConfiguration.java @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement.configuration; + +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.common.value.number.IntegerValue; + +public class RarityModifierConfiguration implements PlacementModifierConfiguration { + + private final FeaturePlacementModifier placementModifier; + private final IntegerValue chance; + + public RarityModifierConfiguration(FeaturePlacementModifier placementModifier, IntegerValue chance) { + this.placementModifier = placementModifier; + this.chance = chance; + } + + public IntegerValue getChance() { + return chance; + } + + @Override + public FeaturePlacementModifier getPlacementModifier() { + return placementModifier; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceRelativeThresholdModifierConfiguration.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceRelativeThresholdModifierConfiguration.java new file mode 100644 index 00000000..5637b431 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceRelativeThresholdModifierConfiguration.java @@ -0,0 +1,64 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement.configuration; + +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.common.value.number.IntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightmap.HeightmapValue; + +public class SurfaceRelativeThresholdModifierConfiguration implements PlacementModifierConfiguration { + + private final FeaturePlacementModifier placementModifier; + private final HeightmapValue heightmap; + private final IntegerValue minInclusive; + private final IntegerValue maxInclusive; + + + public SurfaceRelativeThresholdModifierConfiguration(FeaturePlacementModifier placementModifier, HeightmapValue heightmap, IntegerValue minInclusive, IntegerValue maxInclusive) { + this.placementModifier = placementModifier; + this.heightmap = heightmap; + this.minInclusive = minInclusive; + this.maxInclusive = maxInclusive; + } + + @Override + public FeaturePlacementModifier getPlacementModifier() { + return placementModifier; + } + + public HeightmapValue getHeightmap() { + return heightmap; + } + + public IntegerValue getMinInclusive() { + return minInclusive; + } + + public IntegerValue getMaxInclusive() { + return maxInclusive; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceWaterDepthModifierConfiguration.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceWaterDepthModifierConfiguration.java new file mode 100644 index 00000000..8f8281e4 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/placement/configuration/SurfaceWaterDepthModifierConfiguration.java @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.placement.configuration; + +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.common.value.number.IntegerValue; + +public class SurfaceWaterDepthModifierConfiguration implements PlacementModifierConfiguration { + + private final FeaturePlacementModifier placementModifier; + private final IntegerValue maxWaterDepth; + + public SurfaceWaterDepthModifierConfiguration(FeaturePlacementModifier placementModifier, IntegerValue maxWaterDepth) { + this.placementModifier = placementModifier; + this.maxWaterDepth = maxWaterDepth; + } + + public IntegerValue getMaxWaterDepth() { + return maxWaterDepth; + } + + @Override + public FeaturePlacementModifier getPlacementModifier() { + return placementModifier; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapType.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapType.java new file mode 100644 index 00000000..fbd1cdeb --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapType.java @@ -0,0 +1,56 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightmap; + +import com.mojang.serialization.Codec; +import net.minecraft.world.level.levelgen.Heightmap; +import org.bukkit.NamespacedKey; +import org.jetbrains.annotations.NotNull; + +public class FixedHeightmapType extends HeightmapType { + public static final NamespacedKey KEY = NamespacedKey.fromString("feature:fixed_heightmap_type"); + public static final FixedHeightmapType INSTANCE = new FixedHeightmapType(); + public static final Codec CODEC = Heightmap.Types.CODEC.xmap(FixedHeightmapValue::new, FixedHeightmapValue::getValue); + + private FixedHeightmapType() { + } + + @Override + public Codec getCodec() { + return CODEC.xmap(value -> value, value -> (FixedHeightmapValue) value); + } + + @Override + public Class getTypeClass() { + return Heightmap.Types.class; + } + + @NotNull + @Override + public NamespacedKey getKey() { + return KEY; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapValue.java new file mode 100644 index 00000000..edc303e3 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/FixedHeightmapValue.java @@ -0,0 +1,57 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightmap; + +import net.minecraft.world.level.levelgen.Heightmap; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Random; + +public class FixedHeightmapValue extends HeightmapValue { + + private final Heightmap.Types value; + + public FixedHeightmapValue(Heightmap.Types value) { + this.value = value; + } + + @Override + public FixedHeightmapType getValueType() { + return FixedHeightmapType.INSTANCE; + } + + @Override + public Heightmap.Types getValue(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion) { + return value; + } + + public Heightmap.Types getValue() { + return value; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapType.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapType.java new file mode 100644 index 00000000..fc66552d --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapType.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightmap; + +import de.derfrzocker.feature.api.ValueType; +import net.minecraft.world.level.levelgen.Heightmap; + +public abstract class HeightmapType implements ValueType { +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapValue.java new file mode 100644 index 00000000..6ebbfbfb --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightmap/HeightmapValue.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightmap; + +import de.derfrzocker.feature.api.Value; +import net.minecraft.world.level.levelgen.Heightmap; + +public abstract class HeightmapValue implements Value { +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderType.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderType.java new file mode 100644 index 00000000..e1a75e2f --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderType.java @@ -0,0 +1,56 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider; + +import com.mojang.serialization.Codec; +import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; +import org.bukkit.NamespacedKey; +import org.jetbrains.annotations.NotNull; + +public class FixedHeightProviderType extends HeightProviderType { + public static final NamespacedKey KEY = NamespacedKey.fromString("feature:fixed_height_provider"); + public static final FixedHeightProviderType INSTANCE = new FixedHeightProviderType(); + public static final Codec CODEC = HeightProvider.CODEC.xmap(FixedHeightProviderValue::new, FixedHeightProviderValue::getValue); + + private FixedHeightProviderType() { + } + + @Override + public Codec getCodec() { + return CODEC.xmap(value -> value, value -> (FixedHeightProviderValue) value); + } + + @Override + public Class getTypeClass() { + return HeightProvider.class; + } + + @NotNull + @Override + public NamespacedKey getKey() { + return KEY; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderValue.java new file mode 100644 index 00000000..1ba68dea --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/FixedHeightProviderValue.java @@ -0,0 +1,57 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider; + +import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Random; + +public class FixedHeightProviderValue extends HeightProviderValue { + + private final HeightProvider value; + + public FixedHeightProviderValue(HeightProvider value) { + this.value = value; + } + + @Override + public FixedHeightProviderType getValueType() { + return FixedHeightProviderType.INSTANCE; + } + + @Override + public HeightProvider getValue(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion) { + return value; + } + + public HeightProvider getValue() { + return value; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderType.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderType.java new file mode 100644 index 00000000..18c72b63 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderType.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider; + +import de.derfrzocker.feature.api.ValueType; +import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; + +public abstract class HeightProviderType implements ValueType { +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderValue.java new file mode 100644 index 00000000..8521b76f --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/heightprovider/HeightProviderValue.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider; + +import de.derfrzocker.feature.api.Value; +import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; + +public abstract class HeightProviderValue implements Value { +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderType.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderType.java new file mode 100644 index 00000000..dca6fff2 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderType.java @@ -0,0 +1,56 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.intprovider; + +import com.mojang.serialization.Codec; +import net.minecraft.util.valueproviders.IntProvider; +import org.bukkit.NamespacedKey; +import org.jetbrains.annotations.NotNull; + +public class FixedIntProviderType extends IntProviderType { + public static final NamespacedKey KEY = NamespacedKey.fromString("feature:fixed_int_provider"); + public static final FixedIntProviderType INSTANCE = new FixedIntProviderType(); + public static final Codec CODEC = IntProvider.CODEC.xmap(FixedIntProviderValue::new, FixedIntProviderValue::getValue); + + private FixedIntProviderType() { + } + + @Override + public Codec getCodec() { + return CODEC.xmap(value -> value, value -> (FixedIntProviderValue) value); + } + + @Override + public Class getTypeClass() { + return IntProvider.class; + } + + @NotNull + @Override + public NamespacedKey getKey() { + return KEY; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderValue.java new file mode 100644 index 00000000..a61a3910 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/FixedIntProviderValue.java @@ -0,0 +1,57 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.intprovider; + +import net.minecraft.util.valueproviders.IntProvider; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Random; + +public class FixedIntProviderValue extends IntProviderValue { + + private final IntProvider value; + + public FixedIntProviderValue(IntProvider value) { + this.value = value; + } + + @Override + public FixedIntProviderType getValueType() { + return FixedIntProviderType.INSTANCE; + } + + @Override + public IntProvider getValue(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion) { + return value; + } + + public IntProvider getValue() { + return value; + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderType.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderType.java new file mode 100644 index 00000000..9d5b5119 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderType.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.intprovider; + +import de.derfrzocker.feature.api.ValueType; +import net.minecraft.util.valueproviders.IntProvider; + +public abstract class IntProviderType implements ValueType { +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderValue.java new file mode 100644 index 00000000..8de044dd --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/intprovider/IntProviderValue.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.intprovider; + +import de.derfrzocker.feature.api.Value; +import net.minecraft.util.valueproviders.IntProvider; + +public abstract class IntProviderValue implements Value { +} diff --git a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao_Old.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetType.java similarity index 56% rename from impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao_Old.java rename to impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetType.java index cd47e69b..06597212 100644 --- a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao_Old.java +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetType.java @@ -23,42 +23,35 @@ * */ -package de.derfrzocker.ore.control.impl.dao; +package de.derfrzocker.feature.impl.v1_18_R1.value.target; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.api.dao.WorldOreConfigDao; -import de.derfrzocker.spigot.utils.dao.yaml.BasicYamlDao; +import com.mojang.serialization.Codec; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +import org.bukkit.NamespacedKey; import org.jetbrains.annotations.NotNull; -import java.io.File; -import java.util.Optional; +public class FixedTargetType extends TargetType { -@Deprecated -public class WorldOreConfigYamlDao_Old extends BasicYamlDao implements WorldOreConfigDao { + public static final NamespacedKey KEY = NamespacedKey.fromString("feature:fixed_ore_target"); + public static final FixedTargetType INSTANCE = new FixedTargetType(); + public static final Codec CODEC = OreConfiguration.TargetBlockState.CODEC.xmap(FixedTargetValue::new, FixedTargetValue::getValue); - public WorldOreConfigYamlDao_Old(@NotNull final File file) { - super(file); + private FixedTargetType() { } @Override - public Optional get(@NotNull final String name) { - return getFromStringKey(name); + public Codec getCodec() { + return CODEC.xmap(value -> value, value -> (FixedTargetValue) value); } @Override - public void remove(@NotNull final WorldOreConfig config) { - throw new UnsupportedOperationException("Not supported"); - } - - @Override - public void save(@NotNull final WorldOreConfig config) { - throw new UnsupportedOperationException("Not supported"); + public Class getTypeClass() { + return OreConfiguration.TargetBlockState.class; } @NotNull @Override - public WorldOreConfig getGlobalWorldOreConfig() { - throw new UnsupportedOperationException("Not supported"); + public NamespacedKey getKey() { + return KEY; } - } diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetValue.java new file mode 100644 index 00000000..20c4b17a --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/FixedTargetValue.java @@ -0,0 +1,57 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.target; + +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Random; + +public class FixedTargetValue extends TargetValue { + + private final OreConfiguration.TargetBlockState value; + + public FixedTargetValue(OreConfiguration.TargetBlockState value) { + this.value = value; + } + + @Override + public FixedTargetType getValueType() { + return FixedTargetType.INSTANCE; + } + + @Override + public OreConfiguration.TargetBlockState getValue(@NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion) { + return value; + } + + public OreConfiguration.TargetBlockState getValue() { + return value; + } +} diff --git a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeCombinedConfiguration.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetType.java similarity index 64% rename from impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeCombinedConfiguration.java rename to impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetType.java index 68260643..718969ae 100644 --- a/impl/v1_17_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_17_R1/RangeCombinedConfiguration.java +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetType.java @@ -23,29 +23,10 @@ * */ -package de.derfrzocker.ore.control.impl.v1_17_R1; +package de.derfrzocker.feature.impl.v1_18_R1.value.target; -import net.minecraft.world.level.levelgen.feature.configurations.RangeDecoratorConfiguration; -import org.jetbrains.annotations.NotNull; - -public class RangeCombinedConfiguration { - - private final int veinCount; - @NotNull - private final RangeDecoratorConfiguration configuration; - - public RangeCombinedConfiguration(final int veinCount, @NotNull final RangeDecoratorConfiguration configuration) { - this.veinCount = veinCount; - this.configuration = configuration; - } - - public int getVeinCount() { - return this.veinCount; - } - - @NotNull - public RangeDecoratorConfiguration getConfiguration() { - return configuration; - } +import de.derfrzocker.feature.api.ValueType; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +public abstract class TargetType implements ValueType { } diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetValue.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetValue.java new file mode 100644 index 00000000..fef2fd6d --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/feature/impl/v1_18_R1/value/target/TargetValue.java @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.feature.impl.v1_18_R1.value.target; + +import de.derfrzocker.feature.api.Value; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; + +public abstract class TargetValue implements Value { +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/NMSReplacer_v1_18_R1.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/NMSReplacer_v1_18_R1.java new file mode 100644 index 00000000..393c7041 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/NMSReplacer_v1_18_R1.java @@ -0,0 +1,367 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.JsonOps; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.common.value.number.FixedFloatType; +import de.derfrzocker.feature.common.value.number.FixedFloatValue; +import de.derfrzocker.feature.common.value.number.FixedIntegerType; +import de.derfrzocker.feature.common.value.number.FixedIntegerValue; +import de.derfrzocker.feature.common.value.number.FloatType; +import de.derfrzocker.feature.common.value.number.IntegerType; +import de.derfrzocker.feature.impl.v1_18_R1.feature.generator.OreFeatureGenerator; +import de.derfrzocker.feature.impl.v1_18_R1.feature.generator.configuration.OreFeatureConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.placement.CountModifier; +import de.derfrzocker.feature.impl.v1_18_R1.placement.HeightRangeModifier; +import de.derfrzocker.feature.impl.v1_18_R1.placement.RarityModifier; +import de.derfrzocker.feature.impl.v1_18_R1.placement.SurfaceRelativeThresholdModifier; +import de.derfrzocker.feature.impl.v1_18_R1.placement.SurfaceWaterDepthModifier; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightmap.FixedHeightmapType; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightmap.HeightmapType; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider.FixedHeightProviderType; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider.HeightProviderType; +import de.derfrzocker.feature.impl.v1_18_R1.value.intprovider.FixedIntProviderType; +import de.derfrzocker.feature.impl.v1_18_R1.value.intprovider.IntProviderType; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.FixedTargetType; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.FixedTargetValue; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.TargetType; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.TargetValue; +import de.derfrzocker.ore.control.api.Config; +import de.derfrzocker.ore.control.api.OreControlRegistries; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import de.derfrzocker.ore.control.impl.v1_18_R1.feature.generator.OreFeatureGeneratorHook; +import de.derfrzocker.ore.control.impl.v1_18_R1.placement.CountModifierHook; +import de.derfrzocker.ore.control.impl.v1_18_R1.placement.HeightRangeModifierHook; +import de.derfrzocker.ore.control.impl.v1_18_R1.placement.RarityModifierHook; +import de.derfrzocker.ore.control.impl.v1_18_R1.placement.SurfaceRelativeThresholdModifierHook; +import de.derfrzocker.ore.control.impl.v1_18_R1.placement.SurfaceWaterDepthModifierHook; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.data.BuiltinRegistries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.BiomeGenerationSettings; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.feature.OreFeature; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +import net.minecraft.world.level.levelgen.placement.CountPlacement; +import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import net.minecraft.world.level.levelgen.placement.PlacementModifier; +import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import net.minecraft.world.level.levelgen.placement.RarityFilter; +import net.minecraft.world.level.levelgen.placement.SurfaceRelativeThresholdFilter; +import net.minecraft.world.level.levelgen.placement.SurfaceWaterDepthFilter; +import org.bukkit.Bukkit; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.v1_18_R1.CraftServer; +import org.bukkit.craftbukkit.v1_18_R1.util.CraftNamespacedKey; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +public class NMSReplacer_v1_18_R1 { + + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + private final Codec configCodec; + @NotNull + private final OreControlRegistries registries; + private final ConfigDao configDao; + + public NMSReplacer_v1_18_R1(@NotNull OreControlRegistries registries, ConfigDao configDao) { + this.registries = registries; + this.configDao = configDao; + this.configCodec = configDao.getConfigCodec(); + } + + public void register() { + registerValueTypes(); + registerFeatureGenerators(); + registerPlacementModifier(); + registerBiomes(); + } + + public void registerValueTypes() { + registries.getValueTypeRegistry(IntegerType.class).register(FixedIntegerType.INSTANCE); + registries.getValueTypeRegistry(TargetType.class).register(FixedTargetType.INSTANCE); + registries.getValueTypeRegistry(HeightmapType.class).register(FixedHeightmapType.INSTANCE); + registries.getValueTypeRegistry(IntProviderType.class).register(FixedIntProviderType.INSTANCE); + registries.getValueTypeRegistry(HeightProviderType.class).register(FixedHeightProviderType.INSTANCE); + registries.getValueTypeRegistry(FloatType.class).register(FixedFloatType.INSTANCE); + } + + public void registerFeatureGenerators() { + registries.getFeatureGeneratorRegistry().register(new OreFeatureGenerator(registries)); + } + + public void registerPlacementModifier() { + registries.getPlacementModifierRegistry().register(new RarityModifier(registries)); + registries.getPlacementModifierRegistry().register(new SurfaceRelativeThresholdModifier(registries)); + registries.getPlacementModifierRegistry().register(new SurfaceWaterDepthModifier(registries)); + registries.getPlacementModifierRegistry().register(new CountModifier(registries)); + registries.getPlacementModifierRegistry().register(new HeightRangeModifier(registries)); + } + + public void registerBiomes() { + forEachBiome((biome, resourceLocation) -> registries.getBiomeRegistry().register(new de.derfrzocker.ore.control.api.Biome(CraftNamespacedKey.fromMinecraft(resourceLocation)))); + } + + public void saveDefaultValues(File directory) { + File world = new File(directory, "world"); + File biomes = new File(directory, "biome"); + + saveWorldValues(world); + saveBiomeValues(biomes); + } + + public void hookIntoBiomes() { + forEachBiome((biome, resourceLocation) -> { + try { + hookIntoBiome(biome, resourceLocation); + } catch (final Exception e) { + throw new RuntimeException("Unexpected error while hooking in NMS for Biome: " + biome, e); + } + }); + } + + private void saveWorldValues(File directory) { + Registry registry = BuiltinRegistries.PLACED_FEATURE; + for (Map.Entry, PlacedFeature> entry : registry.entrySet()) { + ResourceLocation key = entry.getKey().location(); + File file = new File(directory, key.getNamespace() + "/" + key.getPath() + ".json"); + saveFeature(file, entry.getValue()); + } + } + + private void saveBiomeValues(File directory) { + forEachBiome((biome, biomeKey) -> { + File biomeFile = new File(directory, biomeKey.getNamespace() + "/" + biomeKey.getPath()); + List>> decorations = biome.getGenerationSettings().features(); + for (List> list : decorations) { + for (Supplier featureSupplier : list) { + PlacedFeature feature = featureSupplier.get(); + Registry registry = getRegistry().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); + ResourceLocation featureKey = registry.getKey(feature); + File featureFile = new File(biomeFile, featureKey.getNamespace() + "/" + featureKey.getPath() + ".json"); + saveFeature(featureFile, feature); + } + } + }); + } + + private void saveFeature(File file, PlacedFeature feature) { + ConfiguredFeature configuredFeature = feature.getFeatures().findAny().orElse(null); + + if (configuredFeature == null) { + return; + } + + if (!(configuredFeature.feature() instanceof OreFeature)) { + return; + } + + file.getParentFile().mkdirs(); + + if (file.exists()) { + return; + } + + try { + file.createNewFile(); + } catch (IOException e) { + throw new RuntimeException(e); + } + + OreConfiguration configuration = (OreConfiguration) configuredFeature.config; + List targetValues = new ArrayList<>(); + + for (OreConfiguration.TargetBlockState state : configuration.targetStates) { + targetValues.add(new FixedTargetValue(state)); + } + + OreFeatureConfiguration featureConfiguration = new OreFeatureConfiguration(registries.getFeatureGeneratorRegistry().get(NamespacedKey.minecraft("ore")).get(), targetValues, new FixedIntegerValue(configuration.size), new FixedFloatValue(configuration.discardChanceOnAirExposure)); + + List placementConfiguration = new ArrayList<>(); + for (PlacementModifier placement : feature.getPlacement()) { + if (placement.type() == PlacementModifierType.RARITY_FILTER) { + RarityModifierHook hook = new RarityModifierHook(registries, configDao, null, null, (RarityFilter) placement); + placementConfiguration.add(hook.createDefaultConfiguration((RarityFilter) placement)); + } + if (placement.type() == PlacementModifierType.SURFACE_RELATIVE_THRESHOLD_FILTER) { + SurfaceRelativeThresholdModifierHook hook = new SurfaceRelativeThresholdModifierHook(registries, configDao, null, null, (SurfaceRelativeThresholdFilter) placement); + placementConfiguration.add(hook.createDefaultConfiguration((SurfaceRelativeThresholdFilter) placement)); + } + if (placement.type() == PlacementModifierType.SURFACE_WATER_DEPTH_FILTER) { + SurfaceWaterDepthModifierHook hook = new SurfaceWaterDepthModifierHook(registries, configDao, null, null, (SurfaceWaterDepthFilter) placement); + placementConfiguration.add(hook.createDefaultConfiguration((SurfaceWaterDepthFilter) placement)); + } + if (placement.type() == PlacementModifierType.COUNT) { + CountModifierHook hook = new CountModifierHook(registries, configDao, null, null, (CountPlacement) placement); + placementConfiguration.add(hook.createDefaultConfiguration((CountPlacement) placement)); + } + if (placement.type() == PlacementModifierType.HEIGHT_RANGE) { + HeightRangeModifierHook hook = new HeightRangeModifierHook(registries, configDao, null, null, (HeightRangePlacement) placement); + placementConfiguration.add(hook.createDefaultConfiguration((HeightRangePlacement) placement)); + } + } + + Config config = new Config(placementConfiguration, featureConfiguration); + + DataResult result = configCodec.encodeStart(JsonOps.INSTANCE, config); + JsonElement element = result.get().left().get(); + try (FileWriter writer = new FileWriter(file)) { + writer.write(GSON.toJson(element)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void forEachBiome(BiConsumer consumer) { + Registry registry = getRegistry().registryOrThrow(Registry.BIOME_REGISTRY); + for (Biome biome : registry) { + consumer.accept(biome, registry.getKey(biome)); + } + } + + private void hookIntoBiome(@NotNull final Biome biome, ResourceLocation minecraftKey) throws NoSuchFieldException, IllegalAccessException { + de.derfrzocker.ore.control.api.Biome oreControlBiome = registries.getBiomeRegistry().get(CraftNamespacedKey.fromMinecraft(minecraftKey)).get(); + List>> decorations = biome.getGenerationSettings().features(); + List>> newDecorations = new ArrayList<>(); + for (List> list : decorations) { + List> newList = new ArrayList<>(); + newDecorations.add(decorations.indexOf(list), newList); + + for (Supplier featureSupplier : list) { + PlacedFeature feature = featureSupplier.get(); + + PlacedFeature newFeature = check(oreControlBiome, minecraftKey, feature); + + if (newFeature != null) { + addToList(newList, list.indexOf(featureSupplier), newFeature); + } else { + newList.add(list.indexOf(featureSupplier), featureSupplier); + } + } + } + + { + final Field field = getField(BiomeGenerationSettings.class, "e"); + field.setAccessible(true); + field.set(biome.getGenerationSettings(), newDecorations); + } + { + final Field field = getField(BiomeGenerationSettings.class, "g"); + field.setAccessible(true); + field.set(biome.getGenerationSettings(), newDecorations.stream().flatMap(Collection::stream).map(Supplier::get).collect(Collectors.toSet())); + } + } + + private void addToList(List> list, int index, PlacedFeature feature) { + list.add(index, () -> feature); + } + + @Nullable + private PlacedFeature check(de.derfrzocker.ore.control.api.Biome biome, ResourceLocation biomeKey, PlacedFeature feature) { + // Not the best method to do this, but hey it works + final Registry registry = getRegistry().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); + ResourceLocation featureKey = registry.getKey(feature); + NamespacedKey key = CraftNamespacedKey.fromMinecraft(featureKey); + feature = BuiltinRegistries.PLACED_FEATURE.get(featureKey); + + if (feature == null) { + return null; + } + + ConfiguredFeature configuredFeature = feature.getFeatures().findAny().orElse(null); + + if (configuredFeature == null) { + return null; + } + + if (!(configuredFeature.feature() instanceof OreFeature)) { + return null; + } + + List placementModifiers = new ArrayList<>(); + for (PlacementModifier placement : feature.getPlacement()) { + if (placement.type() == PlacementModifierType.RARITY_FILTER) { + placementModifiers.add(new RarityModifierHook(registries, configDao, biome, key, (RarityFilter) placement)); + } else if (placement.type() == PlacementModifierType.SURFACE_RELATIVE_THRESHOLD_FILTER) { + placementModifiers.add(new SurfaceRelativeThresholdModifierHook(registries, configDao, biome, key, (SurfaceRelativeThresholdFilter) placement)); + } else if (placement.type() == PlacementModifierType.SURFACE_WATER_DEPTH_FILTER) { + placementModifiers.add(new SurfaceWaterDepthModifierHook(registries, configDao, biome, key, (SurfaceWaterDepthFilter) placement)); + } else if (placement.type() == PlacementModifierType.COUNT) { + placementModifiers.add(new CountModifierHook(registries, configDao, biome, key, (CountPlacement) placement)); + } else if (placement.type() == PlacementModifierType.HEIGHT_RANGE) { + placementModifiers.add(new HeightRangeModifierHook(registries, configDao, biome, key, (HeightRangePlacement) placement)); + } else { + placementModifiers.add(placement); + } + } + + return new PlacedFeature(() -> new ConfiguredFeature(new OreFeatureGeneratorHook(registries, configDao, key, biome), configuredFeature.config), placementModifiers); + } + + @SuppressWarnings("rawtypes") + private Field getField(@NotNull final Class clazz, @NotNull final String fieldName) throws NoSuchFieldException { + try { + return clazz.getDeclaredField(fieldName); + } catch (final NoSuchFieldException e) { + final Class superClass = clazz.getSuperclass(); + if (superClass == null) { + throw e; + } else { + return getField(superClass, fieldName); + } + } + } + + @NotNull + private RegistryAccess getRegistry() { + final DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); + + return server.registryAccess(); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/MinecraftFeatureGeneratorHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/MinecraftFeatureGeneratorHook.java new file mode 100644 index 00000000..71584d74 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/MinecraftFeatureGeneratorHook.java @@ -0,0 +1,121 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.feature.generator; + +import com.mojang.serialization.Codec; +import de.derfrzocker.feature.api.FeatureGenerator; +import de.derfrzocker.feature.api.FeatureGeneratorConfiguration; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.Config; +import de.derfrzocker.ore.control.api.FeatureGeneratorHook; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; +import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.v1_18_R1.generator.CraftLimitedRegion; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.Optional; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; + +public abstract class MinecraftFeatureGeneratorHook extends Feature implements FeatureGeneratorHook { + + private final Map cache = new ConcurrentHashMap<>(); + private final Feature feature; + private final ConfigDao configDao; + private final FeatureGenerator featureGenerator; + private final Biome biome; + private final NamespacedKey namespacedKey; + + public MinecraftFeatureGeneratorHook(Codec codec, Feature feature, @NotNull Registries registries, ConfigDao configDao, @NotNull String name, Biome biome, NamespacedKey namespacedKey) { + super(codec); + this.feature = feature; + this.configDao = configDao; + this.featureGenerator = (FeatureGenerator) registries.getFeatureGeneratorRegistry().get(NamespacedKey.minecraft(name)).get(); + this.biome = biome; + this.namespacedKey = namespacedKey; + } + + public abstract M createConfig(@NotNull M defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration); + + @Override + public FeatureGenerator getFeatureGenerator() { + return featureGenerator; + } + + @Override + public Biome getBiome() { + return biome; + } + + @NotNull + @Override + public NamespacedKey getKey() { + return namespacedKey; + } + + @Override + public boolean place(FeaturePlaceContext context) { + BlockPos origin = context.origin(); + + FeatureGeneratorConfiguration configuration = cache.computeIfAbsent(context.level().getMinecraftWorld().getWorld().getName(), this::loadConfig); + if (configuration == null) { + return feature.place(context); + } + + CraftLimitedRegion limitedRegion = new CraftLimitedRegion(context.level(), new ChunkPos(origin)); + M config = createConfig(context.config(), context.level().getMinecraftWorld().getWorld(), context.random(), new BlockVector(origin.getX(), origin.getY(), origin.getZ()), limitedRegion, (C) configuration); + limitedRegion.breakLink(); + + return place(context.topFeature(), context.level(), context.chunkGenerator(), context.random(), origin, config); + } + + private FeatureGeneratorConfiguration loadConfig(String name) { + Config config = configDao.getConfig(name, biome, namespacedKey).orElse(null); + + if (config == null) { + return null; + } + + return config.getFeature(); + } + + private boolean place(Optional> top, WorldGenLevel world, ChunkGenerator generator, Random random, BlockPos pos, M config) { + return feature.place(new FeaturePlaceContext<>(top, world, generator, random, pos, config)); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/OreFeatureGeneratorHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/OreFeatureGeneratorHook.java new file mode 100644 index 00000000..41c94189 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/feature/generator/OreFeatureGeneratorHook.java @@ -0,0 +1,80 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.feature.generator; + +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.impl.v1_18_R1.feature.generator.configuration.OreFeatureConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.target.TargetValue; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +import org.bukkit.NamespacedKey; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class OreFeatureGeneratorHook extends MinecraftFeatureGeneratorHook { + + public OreFeatureGeneratorHook(@NotNull Registries registries, ConfigDao configDao, @NotNull NamespacedKey namespacedKey, @NotNull Biome biome) { + super(OreConfiguration.CODEC, Feature.ORE, registries, configDao, "ore", biome, namespacedKey); + } + + @Override + public OreConfiguration createConfig(@NotNull OreConfiguration defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull OreFeatureConfiguration configuration) { + List blockStates; + if (configuration.getTargets() == null) { + blockStates = defaultConfiguration.targetStates; + } else { + blockStates = new ArrayList<>(); + + for (TargetValue targetValue : configuration.getTargets()) { + blockStates.add(targetValue.getValue(worldInfo, random, position, limitedRegion)); + } + } + + int size; + if (configuration.getSize() == null) { + size = defaultConfiguration.size; + } else { + size = configuration.getSize().getValue(worldInfo, random, position, limitedRegion); + } + + float discardChanceOnAirExposure; + if (configuration.getDiscardChanceOnAirExposure() == null) { + discardChanceOnAirExposure = defaultConfiguration.discardChanceOnAirExposure; + } else { + discardChanceOnAirExposure = configuration.getDiscardChanceOnAirExposure().getValue(worldInfo, random, position, limitedRegion); + } + + return new OreConfiguration(blockStates, size, discardChanceOnAirExposure); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/CountModifierHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/CountModifierHook.java new file mode 100644 index 00000000..e610109a --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/CountModifierHook.java @@ -0,0 +1,73 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.placement; + +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.CountModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.intprovider.FixedIntProviderValue; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.util.valueproviders.IntProvider; +import net.minecraft.world.level.levelgen.placement.CountPlacement; +import org.bukkit.NamespacedKey; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.Field; +import java.util.Random; + +public class CountModifierHook extends MinecraftPlacementModifierHook { + + public CountModifierHook(@NotNull Registries registries, ConfigDao configDao, @NotNull Biome biome, @NotNull NamespacedKey namespacedKey, @NotNull CountPlacement defaultModifier) { + super(registries, configDao, "count", defaultModifier, biome, namespacedKey); + } + + @Override + public CountModifierConfiguration createDefaultConfiguration(@NotNull CountPlacement defaultModifier) { + try { + Field chance = CountPlacement.class.getDeclaredField("c"); + chance.setAccessible(true); + Object value = chance.get(defaultModifier); + return new CountModifierConfiguration(getPlacementModifier(), new FixedIntProviderValue((IntProvider) value)); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + @Override + public CountPlacement createModifier(@NotNull CountModifierConfiguration defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull CountModifierConfiguration configuration) { + IntProvider count; + if (configuration.getCount() == null) { + count = defaultConfiguration.getCount().getValue(worldInfo, random, position, limitedRegion); + } else { + count = configuration.getCount().getValue(worldInfo, random, position, limitedRegion); + } + + return CountPlacement.of(count); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/HeightRangeModifierHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/HeightRangeModifierHook.java new file mode 100644 index 00000000..f5d245af --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/HeightRangeModifierHook.java @@ -0,0 +1,73 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.placement; + +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.HeightRangeModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightprovider.FixedHeightProviderValue; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; +import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; +import org.bukkit.NamespacedKey; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.Field; +import java.util.Random; + +public class HeightRangeModifierHook extends MinecraftPlacementModifierHook { + + public HeightRangeModifierHook(@NotNull Registries registries, ConfigDao configDao, @NotNull Biome biome, @NotNull NamespacedKey namespacedKey, @NotNull HeightRangePlacement defaultModifier) { + super(registries, configDao, "height_range", defaultModifier, biome, namespacedKey); + } + + @Override + public HeightRangeModifierConfiguration createDefaultConfiguration(@NotNull HeightRangePlacement defaultModifier) { + try { + Field chance = HeightRangePlacement.class.getDeclaredField("c"); + chance.setAccessible(true); + Object value = chance.get(defaultModifier); + return new HeightRangeModifierConfiguration(getPlacementModifier(), new FixedHeightProviderValue((HeightProvider) value)); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + @Override + public HeightRangePlacement createModifier(@NotNull HeightRangeModifierConfiguration defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull HeightRangeModifierConfiguration configuration) { + HeightProvider height; + if (configuration.getHeight() == null) { + height = defaultConfiguration.getHeight().getValue(worldInfo, random, position, limitedRegion); + } else { + height = configuration.getHeight().getValue(worldInfo, random, position, limitedRegion); + } + + return HeightRangePlacement.of(height); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/MinecraftPlacementModifierHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/MinecraftPlacementModifierHook.java new file mode 100644 index 00000000..080a857b --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/MinecraftPlacementModifierHook.java @@ -0,0 +1,139 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.placement; + +import de.derfrzocker.feature.api.FeaturePlacementModifier; +import de.derfrzocker.feature.api.PlacementModifierConfiguration; +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.Config; +import de.derfrzocker.ore.control.api.PlacementModifierHook; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import net.minecraft.world.level.levelgen.placement.PlacementContext; +import net.minecraft.world.level.levelgen.placement.PlacementModifier; +import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.v1_18_R1.generator.CraftLimitedRegion; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.Optional; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Stream; + +public abstract class MinecraftPlacementModifierHook extends PlacementModifier implements PlacementModifierHook { + + private final Map cache = new ConcurrentHashMap<>(); + private final FeaturePlacementModifier placementModifier; + private final ConfigDao configDao; + private final M defaultModifier; + private final C defaultConfiguration; + private final Biome biome; + private final NamespacedKey namespacedKey; + + public MinecraftPlacementModifierHook(@NotNull Registries registries, ConfigDao configDao, @NotNull String name, @NotNull M defaultModifier, @NotNull Biome biome, @NotNull NamespacedKey namespacedKey) { + this.configDao = configDao; + this.placementModifier = (FeaturePlacementModifier) registries.getPlacementModifierRegistry().get(NamespacedKey.minecraft(name)).get(); + this.defaultModifier = defaultModifier; + this.defaultConfiguration = createDefaultConfiguration(defaultModifier); + this.biome = biome; + this.namespacedKey = namespacedKey; + } + + public abstract M createModifier(@NotNull C defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull C configuration); + + public abstract C createDefaultConfiguration(M defaultModifier); + + @Override + public FeaturePlacementModifier getPlacementModifier() { + return placementModifier; + } + + @Override + public Biome getBiome() { + return biome; + } + + @NotNull + @Override + public NamespacedKey getKey() { + return namespacedKey; + } + + @Override + public Stream getPositions(PlacementContext context, Random random, BlockPos blockPos) { + BlockPos origin = blockPos; + + PlacementModifierConfiguration configuration = cache.computeIfAbsent(context.getLevel().getMinecraftWorld().getWorld().getName(), this::loadConfig); + + M modifier = defaultModifier; + if (configuration != null) { + CraftLimitedRegion limitedRegion = new CraftLimitedRegion(context.getLevel(), new ChunkPos(origin)); + modifier = createModifier(defaultConfiguration, context.getLevel().getMinecraftWorld().getWorld(), random, new BlockVector(origin.getX(), origin.getY(), origin.getZ()), limitedRegion, (C) configuration); + limitedRegion.breakLink(); + } + + return getPositions(context.topFeature(), context.getLevel(), context.generator(), random, origin, modifier); + } + + private PlacementModifierConfiguration loadConfig(String name) { + Config config = configDao.getConfig(name, biome, namespacedKey).orElse(null); + + if (config == null) { + return null; + } + + if (config.getPlacements() == null) { + return null; + } + + for (PlacementModifierConfiguration configuration : config.getPlacements()) { + if (configuration.getPlacementModifier() == placementModifier) { + return configuration; + } + } + + return null; + } + + @Override + public PlacementModifierType type() { + return null; + } + + private Stream getPositions(Optional top, WorldGenLevel world, ChunkGenerator generator, Random random, BlockPos pos, M modifier) { + return modifier.getPositions(new PlacementContext(world, generator, top), random, pos); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/RarityModifierHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/RarityModifierHook.java new file mode 100644 index 00000000..9684bfe1 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/RarityModifierHook.java @@ -0,0 +1,73 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.placement; + +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.common.value.number.FixedIntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.RarityModifierConfiguration; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.world.level.levelgen.placement.RarityFilter; +import org.bukkit.NamespacedKey; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.bukkit.util.NumberConversions; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.Field; +import java.util.Random; + +public class RarityModifierHook extends MinecraftPlacementModifierHook { + + public RarityModifierHook(@NotNull Registries registries, ConfigDao configDao, @NotNull Biome biome, @NotNull NamespacedKey namespacedKey, @NotNull RarityFilter defaultModifier) { + super(registries, configDao, "rarity_filter", defaultModifier, biome, namespacedKey); + } + + @Override + public RarityModifierConfiguration createDefaultConfiguration(@NotNull RarityFilter defaultModifier) { + try { + Field chance = RarityFilter.class.getDeclaredField("c"); + chance.setAccessible(true); + Object value = chance.get(defaultModifier); + return new RarityModifierConfiguration(getPlacementModifier(), new FixedIntegerValue(NumberConversions.toInt(value))); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + @Override + public RarityFilter createModifier(@NotNull RarityModifierConfiguration defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull RarityModifierConfiguration configuration) { + int chance; + if (configuration.getChance() == null) { + chance = defaultConfiguration.getChance().getValue(worldInfo, random, position, limitedRegion); + } else { + chance = configuration.getChance().getValue(worldInfo, random, position, limitedRegion); + } + + return RarityFilter.onAverageOnceEvery(chance); + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifierHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifierHook.java new file mode 100644 index 00000000..7a5210ee --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceRelativeThresholdModifierHook.java @@ -0,0 +1,97 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.placement; + +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.common.value.number.FixedIntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.SurfaceRelativeThresholdModifierConfiguration; +import de.derfrzocker.feature.impl.v1_18_R1.value.heightmap.FixedHeightmapValue; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.placement.SurfaceRelativeThresholdFilter; +import org.bukkit.NamespacedKey; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.bukkit.util.NumberConversions; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.Field; +import java.util.Random; + +public class SurfaceRelativeThresholdModifierHook extends MinecraftPlacementModifierHook { + public SurfaceRelativeThresholdModifierHook(@NotNull Registries registries, ConfigDao configDao, @NotNull Biome biome, @NotNull NamespacedKey namespacedKey, @NotNull SurfaceRelativeThresholdFilter defaultModifier) { + super(registries, configDao, "surface_relative_threshold_filter", defaultModifier, biome, namespacedKey); + } + + @Override + public SurfaceRelativeThresholdFilter createModifier(@NotNull SurfaceRelativeThresholdModifierConfiguration defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull SurfaceRelativeThresholdModifierConfiguration configuration) { + Heightmap.Types heightmap; + if (configuration.getHeightmap() == null) { + heightmap = defaultConfiguration.getHeightmap().getValue(worldInfo, random, position, limitedRegion); + } else { + heightmap = configuration.getHeightmap().getValue(worldInfo, random, position, limitedRegion); + } + + int minInclusive; + if (configuration.getMinInclusive() == null) { + minInclusive = defaultConfiguration.getMinInclusive().getValue(worldInfo, random, position, limitedRegion); + } else { + minInclusive = configuration.getMinInclusive().getValue(worldInfo, random, position, limitedRegion); + } + + int maxInclusive; + if (configuration.getMaxInclusive() == null) { + maxInclusive = defaultConfiguration.getMaxInclusive().getValue(worldInfo, random, position, limitedRegion); + } else { + maxInclusive = configuration.getMaxInclusive().getValue(worldInfo, random, position, limitedRegion); + } + + return SurfaceRelativeThresholdFilter.of(heightmap, minInclusive, maxInclusive); + } + + @Override + public SurfaceRelativeThresholdModifierConfiguration createDefaultConfiguration(SurfaceRelativeThresholdFilter defaultModifier) { + try { + Field heightmap = SurfaceRelativeThresholdFilter.class.getDeclaredField("c"); + heightmap.setAccessible(true); + + Field minInclusive = SurfaceRelativeThresholdFilter.class.getDeclaredField("d"); + minInclusive.setAccessible(true); + + Field maxInclusive = SurfaceRelativeThresholdFilter.class.getDeclaredField("e"); + maxInclusive.setAccessible(true); + + Object heightmapValue = heightmap.get(defaultModifier); + Object minInclusiveValue = minInclusive.get(defaultModifier); + Object maxInclusiveValue = maxInclusive.get(defaultModifier); + return new SurfaceRelativeThresholdModifierConfiguration(getPlacementModifier(), new FixedHeightmapValue((Heightmap.Types) heightmapValue), new FixedIntegerValue(NumberConversions.toInt(minInclusiveValue)), new FixedIntegerValue(NumberConversions.toInt(maxInclusiveValue))); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } +} diff --git a/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceWaterDepthModifierHook.java b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceWaterDepthModifierHook.java new file mode 100644 index 00000000..afa91052 --- /dev/null +++ b/impl/v1_18_R1/src/main/java/de/derfrzocker/ore/control/impl/v1_18_R1/placement/SurfaceWaterDepthModifierHook.java @@ -0,0 +1,73 @@ +/* + * MIT License + * + * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +package de.derfrzocker.ore.control.impl.v1_18_R1.placement; + +import de.derfrzocker.feature.api.Registries; +import de.derfrzocker.feature.common.value.number.FixedIntegerValue; +import de.derfrzocker.feature.impl.v1_18_R1.placement.configuration.SurfaceWaterDepthModifierConfiguration; +import de.derfrzocker.ore.control.api.Biome; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import net.minecraft.world.level.levelgen.placement.SurfaceWaterDepthFilter; +import org.bukkit.NamespacedKey; +import org.bukkit.generator.LimitedRegion; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.BlockVector; +import org.bukkit.util.NumberConversions; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.Field; +import java.util.Random; + +public class SurfaceWaterDepthModifierHook extends MinecraftPlacementModifierHook { + + public SurfaceWaterDepthModifierHook(@NotNull Registries registries, ConfigDao configDao, @NotNull Biome biome, @NotNull NamespacedKey namespacedKey, @NotNull SurfaceWaterDepthFilter defaultModifier) { + super(registries, configDao, "surface_water_depth_filter", defaultModifier, biome, namespacedKey); + } + + @Override + public SurfaceWaterDepthModifierConfiguration createDefaultConfiguration(@NotNull SurfaceWaterDepthFilter defaultModifier) { + try { + Field chance = SurfaceWaterDepthFilter.class.getDeclaredField("c"); + chance.setAccessible(true); + Object value = chance.get(defaultModifier); + return new SurfaceWaterDepthModifierConfiguration(getPlacementModifier(), new FixedIntegerValue(NumberConversions.toInt(value))); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + @Override + public SurfaceWaterDepthFilter createModifier(@NotNull SurfaceWaterDepthModifierConfiguration defaultConfiguration, @NotNull WorldInfo worldInfo, @NotNull Random random, @NotNull BlockVector position, @NotNull LimitedRegion limitedRegion, @NotNull SurfaceWaterDepthModifierConfiguration configuration) { + int maxWaterDepth; + if (configuration.getMaxWaterDepth() == null) { + maxWaterDepth = defaultConfiguration.getMaxWaterDepth().getValue(worldInfo, random, position, limitedRegion); + } else { + maxWaterDepth = configuration.getMaxWaterDepth().getValue(worldInfo, random, position, limitedRegion); + } + + return SurfaceWaterDepthFilter.forMaxDepth(maxWaterDepth); + } +} \ No newline at end of file diff --git a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/BiomeOreSettingsYamlImpl.java b/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/BiomeOreSettingsYamlImpl.java deleted file mode 100644 index 4d134d58..00000000 --- a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/BiomeOreSettingsYamlImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.BiomeOreSettings; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreSettings; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.bukkit.configuration.serialization.SerializableAs; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.*; - -@SerializableAs("OreControl#BiomeOreSettings") -public class BiomeOreSettingsYamlImpl implements ConfigurationSerializable, BiomeOreSettings { - - private static final String BIOME_KEY = "biome"; - private static final String ORE_SETTINGS_KEY = "ore-settings"; - - @NotNull - private final Biome biome; - @NotNull - private final Map oreSettings = new LinkedHashMap<>(); - - public BiomeOreSettingsYamlImpl(@NotNull final Biome biome) { - Validate.notNull(biome, "Biome cannot be null"); - - this.biome = biome; - } - - public BiomeOreSettingsYamlImpl(@NotNull final Biome biome, @NotNull final Map oreSettings) { - this(biome); - Validate.notNull(oreSettings, "OreSettings map cannot be null"); - - oreSettings.forEach((key, value) -> this.oreSettings.put(key, value.clone())); - } - - @NotNull - public static BiomeOreSettingsYamlImpl deserialize(@NotNull final Map map) { - Validate.notNull(map, "Map cannot be null"); - - final Map oreSettings = new HashMap<>(); - - // if no ore settings key is present we have - // a) no ore settings in this biome ore config - // b) the old storage type - if (map.containsKey(ORE_SETTINGS_KEY)) { - // new storage type - final List list = (List) map.get(ORE_SETTINGS_KEY); - - list.forEach(oreSettings1 -> oreSettings.put(oreSettings1.getOre(), oreSettings1)); - } else { - // old storage type - map.entrySet().stream().filter(entry -> isOre(entry.getKey())). - forEach(entry -> oreSettings.put(Ore.valueOf(entry.getKey().toUpperCase()), (OreSettings) entry.getValue())); - } - - return new BiomeOreSettingsYamlImpl(Biome.valueOf(((String) map.get(BIOME_KEY)).toUpperCase()), oreSettings); - } - - private static boolean isOre(@Nullable final String string) { - if (string == null) { - return false; - } - - try { - Ore.valueOf(string.toUpperCase()); - return true; - } catch (final IllegalArgumentException e) { - return false; - } - - } - - @NotNull - @Override - public Biome getBiome() { - return this.biome; - } - - @NotNull - @Override - public Optional getOreSettings(@NotNull final Ore ore) { - Validate.notNull(ore, "Ore cannot be null"); - - return Optional.ofNullable(getOreSettings().get(ore)); - } - - @NotNull - @Override - public Map getOreSettings() { - return this.oreSettings; - } - - @Override - public void setOreSettings(@NotNull final OreSettings oreSettings) { - Validate.notNull(oreSettings, "OreSettings cannot be null"); - - this.oreSettings.put(oreSettings.getOre(), oreSettings); - } - - @NotNull - @Override - public BiomeOreSettings clone() { - return new BiomeOreSettingsYamlImpl(getBiome(), getOreSettings()); - } - - @NotNull - @Override - public Map serialize() { - final Map serialize = new LinkedHashMap<>(); - - serialize.put(BIOME_KEY, getBiome().toString()); - - final Map oreSettingsMap = getOreSettings(); - if (!oreSettingsMap.isEmpty()) { - final List oreSettingsList = new LinkedList<>(); - - oreSettingsMap.values().forEach(oreSettings -> { - if (!oreSettings.getSettings().isEmpty() || !oreSettings.isActivated()) { - if (oreSettings instanceof ConfigurationSerializable) { - oreSettingsList.add(oreSettings); - } else { - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(oreSettings.getOre(), oreSettings.getSettings()); - oreSettingsYaml.setActivated(oreSettings.isActivated()); - oreSettingsList.add(oreSettingsYaml); - } - } - }); - - serialize.put(ORE_SETTINGS_KEY, oreSettingsList); - } - - return serialize; - } - -} diff --git a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImpl.java b/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImpl.java deleted file mode 100644 index d04ee4a0..00000000 --- a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImpl.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl; - -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.ore.control.api.OreSettings; -import de.derfrzocker.ore.control.api.Setting; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.bukkit.configuration.serialization.SerializableAs; -import org.bukkit.util.NumberConversions; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.ConcurrentHashMap; - -@SerializableAs("OreControl#OreSettings") -public class OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { - - private static final String ORE_KEY = "ore"; - private static final String STATUS_KEY = "status"; - private static final String SETTINGS_KEY = "settings"; - - @NotNull - private final Map settings = new ConcurrentHashMap<>(); - @NotNull - private final Ore ore; - private boolean activated = true; - - public OreSettingsYamlImpl(@NotNull final Ore ore) { - Validate.notNull(ore, "Ore cannot be null"); - - this.ore = ore; - } - - public OreSettingsYamlImpl(@NotNull final Ore ore, @NotNull final Map settings) { - this(ore); - Validate.notNull(settings, "Settings map cannot be null"); - - this.settings.putAll(settings); - } - - @NotNull - public static OreSettingsYamlImpl deserialize(@NotNull final Map map) { - Validate.notNull(map, "Map cannot be null"); - - final Map settings = new LinkedHashMap<>(); - - // if no settings key is present we have - // a) no settings in this ore config - // b) the old storage type - if (map.containsKey(SETTINGS_KEY)) { - // new storage type - ((Map) map.get(SETTINGS_KEY)).forEach((setting, value) -> settings.put(Setting.valueOf(setting.toUpperCase()), NumberConversions.toDouble(value))); - } else { - // old storage type - final OreControlService service = Bukkit.getServicesManager().load(OreControlService.class); - - Validate.notNull(service, "OreControlService cannot be null"); - - map.entrySet().stream().filter(entry -> isSetting(entry.getKey())). - forEach(entry -> settings.put(Setting.valueOf(entry.getKey().toUpperCase()), NumberConversions.toDouble(entry.getValue()))); - } - - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(Ore.valueOf(((String) map.get(ORE_KEY)).toUpperCase()), settings); - - if (map.containsKey(STATUS_KEY)) { - oreSettingsYaml.setActivated((boolean) map.get(STATUS_KEY)); - } - - return oreSettingsYaml; - } - - private static boolean isSetting(@Nullable final String string) { - if (string == null) { - return false; - } - - try { - Setting.valueOf(string.toUpperCase()); - return true; - } catch (final IllegalArgumentException e) { - return false; - } - } - - @NotNull - @Override - public Ore getOre() { - return this.ore; - } - - @NotNull - @Override - public Optional getValue(@NotNull final Setting setting) { - Validate.notNull(setting, "Setting cannot be null"); - - return Optional.ofNullable(getSettings().get(setting)); - } - - @Override - public void setValue(@NotNull final Setting setting, final double value) { - Validate.notNull(setting, "Setting cannot be null"); - - this.settings.put(setting, value); - } - - @NotNull - @Override - public Map getSettings() { - return this.settings; - } - - @Override - public boolean isActivated() { - return this.activated; - } - - @Override - public void setActivated(final boolean status) { - this.activated = status; - } - - @NotNull - @Override - public OreSettingsYamlImpl clone() { - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(getOre(), getSettings()); - - oreSettingsYaml.setActivated(isActivated()); - - return oreSettingsYaml; - } - - @Override - public boolean equals(@Nullable final Object object) { - if (this == object) { - return true; - } - if (object == null || getClass() != object.getClass()) { - return false; - } - - final OreSettingsYamlImpl that = (OreSettingsYamlImpl) object; - - return isActivated() == that.isActivated() && - getSettings().equals(that.getSettings()) && - getOre() == that.getOre(); - } - - @Override - public int hashCode() { - return getOre().hashCode(); - } - - @NotNull - @Override - public Map serialize() { - final Map serialize = new HashMap<>(); - - serialize.put(ORE_KEY, getOre().toString()); - - if (!isActivated()) { - serialize.put(STATUS_KEY, false); - } - - final Map settingsMap = getSettings(); - if (!settingsMap.isEmpty()) { - final Map data = new LinkedHashMap<>(); - - settingsMap.forEach((key, value) -> data.put(key.toString(), value)); - - serialize.put(SETTINGS_KEY, data); - } - - return serialize; - } - -} diff --git a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/WorldOreConfigYamlImpl.java b/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/WorldOreConfigYamlImpl.java deleted file mode 100644 index 582783a7..00000000 --- a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/WorldOreConfigYamlImpl.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl; - -import de.derfrzocker.ore.control.api.*; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.bukkit.configuration.serialization.SerializableAs; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.*; - -@SerializableAs("OreControl#WorldOreConfig") -public class WorldOreConfigYamlImpl implements ConfigurationSerializable, WorldOreConfig { - - @Deprecated - private static final String WORLD_KEY = "world"; - @Deprecated - private static final String TEMPLATE_KEY = "template"; - private static final String NAME_KEY = "name"; - private static final String CONFIG_TYPE_KEY = "config-type"; - private static final String ORE_SETTINGS_KEY = "ore-settings"; - private static final String BIOME_ORE_SETTINGS_KEY = "biome-ore-settings"; - - @NotNull - private final Map oreSettings = new LinkedHashMap<>(); - @NotNull - private final Map biomeOreSettings = new LinkedHashMap<>(); - @NotNull - private final String name; - @NotNull - private ConfigType configType; - - public WorldOreConfigYamlImpl(@NotNull final String name, @NotNull final ConfigType configType) { - Validate.notNull(name, "Name cannot be null"); - Validate.notNull(configType, "Config Type cannot be null"); - - this.name = name; - this.configType = configType; - } - - public WorldOreConfigYamlImpl(@NotNull final String name, @NotNull final ConfigType configType, @NotNull final Map oreSettings) { - this(name, configType); - Validate.notNull(oreSettings, "OreSettings map cannot be null"); - - oreSettings.forEach((key, value) -> this.oreSettings.put(key, value.clone())); - } - - public WorldOreConfigYamlImpl(@NotNull final String name, @NotNull final ConfigType configType, @NotNull final Map oreSettings, @NotNull final Map biomeOreSettings) { - this(name, configType, oreSettings); - Validate.notNull(biomeOreSettings, "BiomeOreSettings map cannot be null"); - - biomeOreSettings.forEach((key, value) -> this.biomeOreSettings.put(key, value.clone())); - } - - @NotNull - public static WorldOreConfigYamlImpl deserialize(@NotNull final Map map) { - Validate.notNull(map, "Map cannot be null"); - - final Map oreSettings = new LinkedHashMap<>(); - final Map biomeOreSettings = new LinkedHashMap<>(); - - // if no ore settings key is present we have - // a) no ore settings in this world ore config - // b) the old storage type - if (map.containsKey(ORE_SETTINGS_KEY)) { - // new storage type - final List list = (List) map.get(ORE_SETTINGS_KEY); - - list.forEach(oreSettings1 -> oreSettings.put(oreSettings1.getOre(), oreSettings1)); - } else { - // old storage type - map.entrySet().stream().filter(entry -> isOre(entry.getKey())). - forEach(entry -> oreSettings.put(Ore.valueOf(entry.getKey().toUpperCase()), (OreSettings) entry.getValue())); - } - - // if no biome ore settings key is present we have - // a) no biome ore settings in this world ore config - // b) the old storage type - if (map.containsKey(BIOME_ORE_SETTINGS_KEY)) { - // new storage type - final List list = (List) map.get(BIOME_ORE_SETTINGS_KEY); - - list.forEach(biomeOreSettings1 -> biomeOreSettings.put(biomeOreSettings1.getBiome(), biomeOreSettings1)); - } else { - // old storage type - map.entrySet().stream().filter(entry -> isBiome(entry.getKey())). - forEach(entry -> biomeOreSettings.put(Biome.valueOf(entry.getKey().toUpperCase()), (BiomeOreSettings) entry.getValue())); - } - - final String name; - - if (map.containsKey(WORLD_KEY)) { - name = (String) map.get(WORLD_KEY); - } else { - name = (String) map.get(NAME_KEY); - } - - String configTypeString = (String) map.get(CONFIG_TYPE_KEY); - ConfigType configType; - if (configTypeString == null) { - if ((boolean) map.getOrDefault(TEMPLATE_KEY, false)) { - configType = ConfigType.TEMPLATE; - } else { - configType = ConfigType.UNKNOWN; - } - } else { - configType = ConfigType.valueOf(configTypeString.toUpperCase()); - } - - return new WorldOreConfigYamlImpl(name, configType, oreSettings, biomeOreSettings); - } - - private static boolean isOre(@Nullable final String string) { - if (string == null) { - return false; - } - - try { - Ore.valueOf(string.toUpperCase()); - return true; - } catch (final IllegalArgumentException e) { - return false; - } - - } - - private static boolean isBiome(@Nullable final String string) { - if (string == null) { - return false; - } - - try { - Biome.valueOf(string.toUpperCase()); - return true; - } catch (final IllegalArgumentException e) { - return false; - } - } - - @NotNull - @Override - public String getName() { - return this.name; - } - - @NotNull - @Override - public Optional getOreSettings(@NotNull final Ore ore) { - Validate.notNull(ore, "Ore cannot be null"); - - return Optional.ofNullable(this.oreSettings.get(ore)); - } - - @NotNull - @Override - public Map getOreSettings() { - return this.oreSettings; - } - - @Override - public void setOreSettings(@NotNull final OreSettings oreSettings) { - Validate.notNull(oreSettings, "OreSettings cannot be null"); - - this.oreSettings.put(oreSettings.getOre(), oreSettings); - } - - @NotNull - @Override - public Optional getBiomeOreSettings(@NotNull final Biome biome) { - Validate.notNull(biome, "Biome cannot be null"); - - return Optional.ofNullable(getBiomeOreSettings().get(biome)); - } - - @NotNull - @Override - public Map getBiomeOreSettings() { - return this.biomeOreSettings; - } - - @Override - public void setBiomeOreSettings(@NotNull final BiomeOreSettings biomeOreSettings) { - Validate.notNull(biomeOreSettings, "BiomeOreSettings cannot be null"); - - getBiomeOreSettings().put(biomeOreSettings.getBiome(), biomeOreSettings); - } - - @Override - public boolean isTemplate() { - return configType == ConfigType.TEMPLATE || configType == ConfigType.GLOBAL; - } - - @Override - public void setTemplate(boolean status) { - if (status) { - this.configType = ConfigType.TEMPLATE; - } else { - this.configType = ConfigType.UNKNOWN; - } - } - - @NotNull - @Override - public ConfigType getConfigType() { - return this.configType; - } - - @Override - public void setConfigType(@NotNull ConfigType configType) { - Validate.notNull(configType, "ConfigType cannot be null"); - - this.configType = configType; - } - - @NotNull - @Override - public WorldOreConfig clone(@NotNull final String name) { - Validate.notNull(name, "Name cannot be null"); - - return new WorldOreConfigYamlImpl(name, getConfigType(), getOreSettings(), getBiomeOreSettings()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof WorldOreConfigYamlImpl)) return false; - - WorldOreConfigYamlImpl that = (WorldOreConfigYamlImpl) o; - - if (!getOreSettings().equals(that.getOreSettings())) return false; - if (!getBiomeOreSettings().equals(that.getBiomeOreSettings())) return false; - if (!getName().equals(that.getName())) return false; - return getConfigType() == that.getConfigType(); - } - - @Override - public int hashCode() { - return getName().hashCode(); - } - - @NotNull - @Override - public Map serialize() { - final Map serialize = new LinkedHashMap<>(); - - serialize.put(NAME_KEY, getName()); - serialize.put(CONFIG_TYPE_KEY, configType.name()); - - final Map oreSettingsMap = getOreSettings(); - if (!oreSettingsMap.isEmpty()) { - final List oreSettingsList = new LinkedList<>(); - - oreSettingsMap.values().forEach(oreSettings -> { - if (!oreSettings.getSettings().isEmpty() || !oreSettings.isActivated()) { - if (oreSettings instanceof ConfigurationSerializable) { - oreSettingsList.add(oreSettings); - } else { - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(oreSettings.getOre(), oreSettings.getSettings()); - oreSettingsYaml.setActivated(oreSettings.isActivated()); - oreSettingsList.add(oreSettingsYaml); - } - } - }); - - serialize.put(ORE_SETTINGS_KEY, oreSettingsList); - } - - final Map biomeOreSettingsMap = getBiomeOreSettings(); - if (!biomeOreSettingsMap.isEmpty()) { - final List biomeOreSettingsList = new LinkedList<>(); - - biomeOreSettingsMap.values().forEach(biomeOreSettings -> { - if (biomeOreSettings.getOreSettings().isEmpty()) { - return; - } - - if (biomeOreSettings.getOreSettings().values().stream(). - anyMatch(oreSettings -> !oreSettings.getSettings().isEmpty() || !oreSettings.isActivated())) { - if (biomeOreSettings instanceof ConfigurationSerializable) { - biomeOreSettingsList.add(biomeOreSettings); - } else { - biomeOreSettingsList.add(new BiomeOreSettingsYamlImpl(biomeOreSettings.getBiome(), biomeOreSettings.getOreSettings())); - } - } - }); - - serialize.put(BIOME_ORE_SETTINGS_KEY, biomeOreSettingsList); - } - - return serialize; - } - -} diff --git a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/LazyWorldOreConfigCache.java b/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/LazyWorldOreConfigCache.java deleted file mode 100644 index ac0f906d..00000000 --- a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/LazyWorldOreConfigCache.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.dao; - -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.impl.WorldOreConfigYamlImpl; -import de.derfrzocker.spigot.utils.Config; -import de.derfrzocker.spigot.utils.ReloadAble; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.io.IOException; - -public class LazyWorldOreConfigCache implements ReloadAble { - - private final Object look = new Object(); - @NotNull - private final File file; - - @Nullable - private WorldOreConfig worldOreConfig; - - public LazyWorldOreConfigCache(@NotNull final File file) { - Validate.notNull(file, "File cannot be null"); - Validate.isTrue(file.getName().endsWith(".yml"), "File " + file + " has not valid extension, must be '.yml'"); - - if (file.exists()) { - Validate.isTrue(file.isFile(), "File " + file + " is not a File?"); - } - - this.file = file; - } - - /** - * @param worldOreConfig to set - * @throws IllegalArgumentException if worldOreConfig is null - * @throws RuntimeException if the file name and the worldOreConfig name does't match - */ - public void setWorldConfig(@NotNull final WorldOreConfig worldOreConfig) { - Validate.notNull(worldOreConfig, "worldOreConfig cannot be null"); - - if (!worldOreConfig.getName().equals(file.getName().substring(0, file.getName().length() - 4))) { - throw new RuntimeException("File name " + file.getName() + " and WorldConfig name " + worldOreConfig.getName() + " does not match"); - } - - this.worldOreConfig = worldOreConfig; - } - - /** - * When this LazyWorldOreConfigCache has a WorldOreConfig loaded, it will save it to disk. - * Nothing will happen, if this LazyWorldOreConfigCache does not holds a WorldOreConfig - */ - public void save() { - if (worldOreConfig == null) { - return; - } - - final WorldOreConfig worldOreConfig; - - if (!(this.worldOreConfig instanceof ConfigurationSerializable)) { - worldOreConfig = new WorldOreConfigYamlImpl(this.worldOreConfig.getName(), this.worldOreConfig.getConfigType(), this.worldOreConfig.getOreSettings(), this.worldOreConfig.getBiomeOreSettings()); - } else { - worldOreConfig = this.worldOreConfig; - } - - final Config config = new Config(file); - - config.set("value", worldOreConfig); - - try { - config.options().header("This file is machine generated, please use the in game commands and gui to change values. \nModifying this file per hand on your own risk.").copyHeader(true); - config.save(file); - } catch (final IOException e) { - throw new RuntimeException("Unexpected error while saving WorldOreConfig " + worldOreConfig.getName() + " to disk!", e); - } - } - - /** - * When this LazyWorldOreConfigCache has a WorldOreConfig loaded, it will return it. - * If not, then it will try to load if from a file and set it to the cache. - * - * @return the cached or fresh loaded WorldOreConfig - * @throws RuntimeException if no WorldOreConfig is Cached and the file does not exists - * @throws RuntimeException if no WorldOreConfig is Cached and the file does not contains a WorldOreConfig under the key "value" - * @throws RuntimeException if no WorldOreConfig is Cached and the file name and WorldOreConfig name does not match - */ - @NotNull - public WorldOreConfig getWorldOreConfig() { - if (worldOreConfig != null) { - return worldOreConfig; - } - - synchronized (look) { - if (worldOreConfig != null) { - return worldOreConfig; - } - - if (!file.exists()) - throw new RuntimeException("File " + file + " does not exists, cannot load WorldOreConfig from none existing file"); - - final Config config = new Config(file); - - final Object object = config.get("value"); - - if (!(object instanceof WorldOreConfig)) { - throw new RuntimeException("File " + file + " does not have a WorldOreConfig under the key 'value'"); - } - - final WorldOreConfig worldOreConfig = (WorldOreConfig) object; - - if (!worldOreConfig.getName().equals(file.getName().substring(0, file.getName().length() - 4))) { - throw new RuntimeException("File name " + file.getName() + " and WorldOreConfig name " + worldOreConfig.getName() + " does not match"); - } - - this.worldOreConfig = worldOreConfig; - } - - return worldOreConfig; - } - - @Override - public void reload() { - worldOreConfig = null; - } - -} diff --git a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao.java b/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao.java deleted file mode 100644 index 2022d2f2..00000000 --- a/impl/yaml/src/main/java/de/derfrzocker/ore/control/impl/dao/WorldOreConfigYamlDao.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl.dao; - -import de.derfrzocker.ore.control.api.ConfigType; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.api.dao.WorldOreConfigDao; -import de.derfrzocker.ore.control.impl.WorldOreConfigYamlImpl; -import de.derfrzocker.spigot.utils.Config; -import de.derfrzocker.spigot.utils.ReloadAble; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.io.File; -import java.io.IOException; -import java.util.*; - -public class WorldOreConfigYamlDao implements WorldOreConfigDao, ReloadAble { - - private final static String GLOBAL_NAME = "__global__"; - - private final Map lazyWorldOreConfigCacheMap = new HashMap<>(); - private LazyWorldOreConfigCache global; - @NotNull - private final File directory; - @NotNull - private final File globalDirectory; - @NotNull - private final File globalFile; - - public WorldOreConfigYamlDao(@NotNull final File directory) { - Validate.notNull(directory, "Directory cannot be null"); - if (directory.exists()) { - Validate.isTrue(directory.isDirectory(), "Directory is not a directory?"); - } - - this.directory = directory; - this.globalDirectory = new File(directory, GLOBAL_NAME); - - if (globalDirectory.exists()) { - Validate.isTrue(globalDirectory.isDirectory(), "Global directory is not a directory?"); - } - - this.globalFile = new File(globalDirectory, GLOBAL_NAME + ".yml"); - - if (globalFile.exists()) { - Validate.isTrue(globalFile.isFile(), "Global file is not a file?"); - } - - RELOAD_ABLES.add(this); - } - - @Override - public Optional get(@NotNull final String key) { - Validate.notNull(key, "Key cannot be null"); - Validate.notEmpty(key, "Key cannot be empty"); - - final LazyWorldOreConfigCache lazyWorldOreConfigCache = lazyWorldOreConfigCacheMap.get(key); - - if (lazyWorldOreConfigCache != null) { - return Optional.of(lazyWorldOreConfigCache.getWorldOreConfig()); - } - - final File file = new File(directory, key + ".yml"); - - if (!file.exists() || !file.isFile()) { - if (key.equals(GLOBAL_NAME)) { - return Optional.of(global.getWorldOreConfig()); - } - return Optional.empty(); - } - - final LazyWorldOreConfigCache lazyWorldConfigCache1 = new LazyWorldOreConfigCache(file); - - lazyWorldOreConfigCacheMap.put(key, lazyWorldConfigCache1); - - return Optional.of(lazyWorldConfigCache1.getWorldOreConfig()); - } - - @Override - public void remove(@NotNull final WorldOreConfig value) { - Validate.notNull(value, "WorldOreConfig cannot be null"); - - if (value.getConfigType() == ConfigType.GLOBAL) { - global.setWorldConfig(new WorldOreConfigYamlImpl(GLOBAL_NAME, ConfigType.GLOBAL)); - global.save(); - return; - } - - lazyWorldOreConfigCacheMap.remove(value.getName()); - new File(directory, value.getName() + ".yml").delete(); - } - - @Override - public void save(@NotNull final WorldOreConfig value) { - Validate.notNull(value, "WorldOreConfig cannot be null"); - - if (value.getConfigType() == ConfigType.GLOBAL) { - global.setWorldConfig(value); - global.save(); - return; - } - - LazyWorldOreConfigCache lazyWorldOreConfigCache = lazyWorldOreConfigCacheMap.get(value.getName()); - - if (lazyWorldOreConfigCache == null) { - lazyWorldOreConfigCache = new LazyWorldOreConfigCache(new File(directory, value.getName() + ".yml")); - lazyWorldOreConfigCacheMap.put(value.getName(), lazyWorldOreConfigCache); - } - - lazyWorldOreConfigCache.setWorldConfig(value); - lazyWorldOreConfigCache.save(); - } - - @Override - public Set getAll() { - final Set worldConfigs = new LinkedHashSet<>(); - - lazyWorldOreConfigCacheMap.forEach((name, lazyWorldConfigCache) -> worldConfigs.add(lazyWorldConfigCache.getWorldOreConfig())); - - worldConfigs.add(global.getWorldOreConfig()); - - return worldConfigs; - } - - @Override - public void reload() { - lazyWorldOreConfigCacheMap.clear(); - - final File[] files = directory.listFiles(); - - if (files != null) { - for (final File file : files) { - if (!file.isFile()) { - continue; - } - - if (!file.getName().endsWith(".yml")) { - continue; - } - - if (file.getName().equals("Default.yml") && !globalFile.exists()) { - try { - globalDirectory.mkdirs(); - globalFile.createNewFile(); - - Config config = new Config(file); - WorldOreConfig worldOreConfig = (WorldOreConfig) config.get("value"); - - Config globalConfig = new Config(globalFile); - WorldOreConfig globalWorldOreConfig = worldOreConfig.clone(GLOBAL_NAME); - globalWorldOreConfig.setConfigType(ConfigType.GLOBAL); - globalConfig.set("value", globalWorldOreConfig); - globalConfig.save(globalFile); - - file.delete(); - continue; - } catch (IOException e) { - throw new RuntimeException("Error while moving file", e); - } - } - - lazyWorldOreConfigCacheMap.put(file.getName().substring(0, file.getName().length() - 4), new LazyWorldOreConfigCache(file)); - } - } - - if (!globalFile.exists()) { - try { - globalDirectory.mkdirs(); - globalFile.createNewFile(); - - Config config = new Config(globalFile); - config.set("value", new WorldOreConfigYamlImpl(GLOBAL_NAME, ConfigType.GLOBAL)); - config.save(globalFile); - } catch (IOException e) { - throw new RuntimeException("Error while setting up global", e); - } - } - - global = new LazyWorldOreConfigCache(globalFile); - } - - @NotNull - @Override - public WorldOreConfig getGlobalWorldOreConfig() { - return global.getWorldOreConfig(); - } - -} diff --git a/impl/yaml/src/test/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImplTest.java b/impl/yaml/src/test/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImplTest.java deleted file mode 100644 index 74841a0f..00000000 --- a/impl/yaml/src/test/java/de/derfrzocker/ore/control/impl/OreSettingsYamlImplTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.impl; - -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.*; - -import static org.junit.jupiter.api.Assertions.*; - -@Ignore // TODO -public class OreSettingsYamlImplTest { - - //Test OreSettingsYamlImpl Constructor begin - @Test - public void When_OreSettingsIsInitialedWithANullValue_Expect_ThrowIllegalArgumentException() { - assertThrows(IllegalArgumentException.class, () -> new OreSettingsYamlImpl(null)); - assertThrows(IllegalArgumentException.class, () -> new OreSettingsYamlImpl(null, new HashMap<>())); - assertThrows(IllegalArgumentException.class, () -> new OreSettingsYamlImpl(Ore.EMERALD, null)); - assertThrows(IllegalArgumentException.class, () -> new OreSettingsYamlImpl(null, null)); - } - - //Test OreSettingsYamlImpl#getOre() begin - - @Test - public void GetOre_When_OreSettingsIsInitialedWithAnOre_Expect_ReturnTheOreThatWasInitialed() { //Todo rename the method, currently i found no better name - final List oreSettingsYamls = new LinkedList<>(); - - for (Ore ore : Ore.values()) - oreSettingsYamls.add(new OreSettingsYamlImpl(ore)); - - final Iterator oreSettingsIterator = oreSettingsYamls.iterator(); - - for (Ore ore : Ore.values()) - assertSame(ore, oreSettingsIterator.next().getOre()); - } - - @Test - public void GetOre_When_OreSettingsIsInitialedWithAnOreAndMap_Expect_ReturnTheOreThatWasInitialed() { //Todo rename the method - for (Ore ore : Ore.values()) - assertSame(ore, new OreSettingsYamlImpl(ore).getOre()); - - for (Ore ore : Ore.values()) - assertSame(ore, new OreSettingsYamlImpl(ore, new HashMap<>()).getOre()); - } - - //Test OreSettingsYamlImpl#getOre() end - - //Test OreSettingsYamlImpl#getValue(Setting) begin - - @Test - public void GetValue_When_SettingIsNull_Expect_ThrowIllegalArgumentException() { - assertThrows(IllegalArgumentException.class, () -> new OreSettingsYamlImpl(Ore.EMERALD).getValue(null)); - } - - @Test - public void GetValue_When_SettingIsNotPresent_Expect_ReturnEmptyOptional() { - for (Ore ore : Ore.values()) { - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(ore); - for (Setting setting : Setting.values()) - assertFalse(oreSettingsYaml.getValue(setting).isPresent()); - } - - for (Ore ore : Ore.values()) { - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(ore, new HashMap<>()); - for (Setting setting : Setting.values()) - assertFalse(oreSettingsYaml.getValue(setting).isPresent()); - } - } - - //Test OreSettingsYamlImpl#getValue(Setting) end - - //Test OreSettingsYamlImpl#serialize() begin - - @Test - public void Serialize_When_OreSettingHasNoValuesAndIsActivated_Expect_ReturnMapWithOneEntry() { - for (final Ore ore : Ore.values()) { - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(ore); - - final Map map = oreSettingsYaml.serialize(); - - assertSame(1, map.size()); - assertTrue(map.containsKey("ore")); - assertEquals(ore.toString(), map.get("ore")); - } - } - - @Test - public void Serialize_When_OreSettingHasNoValuesAndIsNotActivated_Expect_ReturnMapWithTwoEntry() { - for (final Ore ore : Ore.values()) { - final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(ore); - - oreSettingsYaml.setActivated(false); - - final Map map = oreSettingsYaml.serialize(); - - assertSame(2, map.size()); - assertTrue(map.containsKey("ore")); - assertEquals(ore.toString(), map.get("ore")); - assertTrue(map.containsKey("status")); - assertFalse((Boolean) map.get("status")); - } - } - - //Test OreSettingsYamlImpl#serialize() end - -} diff --git a/metrics/pom.xml b/metrics/pom.xml deleted file mode 100644 index 99dd6e5c..00000000 --- a/metrics/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - - ore-control-parent - de.derfrzocker - ${revision} - - - ore-control-metrics - - - - org.bstats - bstats-bukkit - ${bstats.version} - provided - true - - - de.derfrzocker - ore-control-api - ${project.version} - provided - - - - \ No newline at end of file diff --git a/metrics/src/main/java/de/derfrzocker/ore/control/OreControlMetrics.java b/metrics/src/main/java/de/derfrzocker/ore/control/OreControlMetrics.java deleted file mode 100644 index e3258ef5..00000000 --- a/metrics/src/main/java/de/derfrzocker/ore/control/OreControlMetrics.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.ore.control.api.*; -import org.apache.commons.lang.Validate; -import org.bstats.bukkit.Metrics; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.function.Supplier; - -public abstract class OreControlMetrics { - - private final static int B_STATS_PLUGIN_ID = 4244; - - public OreControlMetrics(@NotNull final Plugin plugin, @NotNull final Supplier serviceSupplier) { - Validate.notNull(plugin, "Plugin cannot be null"); - Validate.notNull(serviceSupplier, "Service supplier cannot be null"); - - final Metrics metrics = new Metrics(plugin, B_STATS_PLUGIN_ID); - - // Config values - metrics.addCustomChart(new Metrics.SimplePie("used_language", this::getLanguage)); - metrics.addCustomChart(new Metrics.SimplePie("use_safe_mode", this::getUseSafeMode)); - metrics.addCustomChart(new Metrics.SimplePie("use_translate_tab_compilation", this::getUseTranslateTabCompilation)); - metrics.addCustomChart(new Metrics.SimplePie("use_verify_copy_action", this::getUseVerifyCopyAction)); - metrics.addCustomChart(new Metrics.SimplePie("use_verify_reset_action", this::getUseVerifyResetAction)); - - metrics.addCustomChart(new Metrics.SingleLineChart("created_templates", () -> Math.toIntExact(serviceSupplier.get().getAllWorldOreConfigs().stream().filter(WorldOreConfig::isTemplate).count()))); - metrics.addCustomChart(new Metrics.SingleLineChart("used_in_worlds", () -> Math.toIntExact(serviceSupplier.get().getAllWorldOreConfigs().stream().filter(worldOreConfig -> !worldOreConfig.isTemplate()).count()))); - - metrics.addCustomChart(new Metrics.DrilldownPie("changed_ores", () -> { - final Map> result = new LinkedHashMap<>(); - - for (final WorldOreConfig worldOreConfig : serviceSupplier.get().getAllWorldOreConfigs()) { - for (final OreSettings oreSettings : worldOreConfig.getOreSettings().values()) { - final Map settingsMap = result.computeIfAbsent(oreSettings.getOre().toString(), ore -> new LinkedHashMap<>()); - - if (oreSettings.isActivated()) { - settingsMap.put("ACTIVATED", settingsMap.getOrDefault("ACTIVATED", 0) + 1); - } else { - settingsMap.put("DEACTIVATED", settingsMap.getOrDefault("DEACTIVATED", 0) + 1); - } - - for (final Setting setting : oreSettings.getSettings().keySet()) { - settingsMap.put(setting.toString(), settingsMap.getOrDefault(setting.toString(), 0) + 1); - } - } - } - - return result; - })); - - metrics.addCustomChart(new Metrics.DrilldownPie("changed_ores_in_biomes", () -> { - final Map> result = new LinkedHashMap<>(); - - for (final WorldOreConfig worldOreConfig : serviceSupplier.get().getAllWorldOreConfigs()) { - for (final BiomeOreSettings biomeOreSettings : worldOreConfig.getBiomeOreSettings().values()) { - for (final OreSettings oreSettings : biomeOreSettings.getOreSettings().values()) { - final Map settingsMap = result.computeIfAbsent(oreSettings.getOre().toString(), ore -> new LinkedHashMap<>()); - - if (oreSettings.isActivated()) { - settingsMap.put("ACTIVATED", settingsMap.getOrDefault("ACTIVATED", 0) + 1); - } else { - settingsMap.put("DEACTIVATED", settingsMap.getOrDefault("DEACTIVATED", 0) + 1); - } - - for (final Setting setting : oreSettings.getSettings().keySet()) { - settingsMap.put(setting.toString(), settingsMap.getOrDefault(setting.toString(), 0) + 1); - } - } - } - } - - return result; - })); - - metrics.addCustomChart(new Metrics.DrilldownPie("changed_biomes", () -> { - final Map> result = new LinkedHashMap<>(); - - for (final WorldOreConfig worldOreConfig : serviceSupplier.get().getAllWorldOreConfigs()) { - for (final BiomeOreSettings biomeOreSettings : worldOreConfig.getBiomeOreSettings().values()) { - final Map oreSettingsMap = result.computeIfAbsent(biomeOreSettings.getBiome().toString(), biome -> new LinkedHashMap<>()); - for (final Ore ore : biomeOreSettings.getOreSettings().keySet()) { - oreSettingsMap.put(ore.toString(), oreSettingsMap.getOrDefault(ore.toString(), 0) + 1); - } - } - } - return result; - })); - - if (!metrics.isEnabled()) { - plugin.getLogger().warning("meh"); - } - - } - - protected abstract String getLanguage(); - - protected abstract String getUseSafeMode(); - - protected abstract String getUseTranslateTabCompilation(); - - protected abstract String getUseVerifyCopyAction(); - - protected abstract String getUseVerifyResetAction(); - -} diff --git a/ore-control-lite/pom.xml b/ore-control-lite/pom.xml deleted file mode 100644 index a87b6c19..00000000 --- a/ore-control-lite/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 4.0.0 - - - ore-control-parent - de.derfrzocker - ${revision} - - - ore-control-lite - - - - org.bstats - bstats-bukkit - ${bstats.version} - compile - - - de.derfrzocker - spigot-utils - ${spigot-utils.version} - compile - - - de.derfrzocker - ore-control-api - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-yaml - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-v1_17_R1 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-service - ${project.version} - compile - - - de.derfrzocker - ore-control-metrics - ${project.version} - compile - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.0.0 - - - package - - shade - - - - - false - false - true - - - org.bstats - de.derfrzocker.ore.control.utils - - - de.derfrzocker.spigot.utils - de.derfrzocker.ore.control.utils - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - - - - - src/main/resources - true - - - - - - \ No newline at end of file diff --git a/ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlLite.java b/ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlLite.java deleted file mode 100644 index c371b56c..00000000 --- a/ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlLite.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.impl.*; -import de.derfrzocker.ore.control.impl.dao.WorldOreConfigYamlDao; -import de.derfrzocker.ore.control.impl.dao.WorldOreConfigYamlDao_Old; -import de.derfrzocker.ore.control.impl.generationhandler.*; -import de.derfrzocker.ore.control.impl.v1_17_R1.NMSUtil_v1_17_R1; -import de.derfrzocker.spigot.utils.Config; -import de.derfrzocker.spigot.utils.Version; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.configuration.serialization.ConfigurationSerialization; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.world.WorldLoadEvent; -import org.bukkit.plugin.ServicePriority; -import org.bukkit.plugin.java.JavaPlugin; -import org.jetbrains.annotations.NotNull; - -import java.io.File; - -public class OreControlLite extends JavaPlugin implements Listener { - - // register the ConfigurationSerializable's in a static block, that we can easy use them in Test cases - static { - ConfigurationSerialization.registerClass(WorldOreConfigYamlImpl.class); - ConfigurationSerialization.registerClass(OreSettingsYamlImpl.class); - ConfigurationSerialization.registerClass(BiomeOreSettingsYamlImpl.class); - } - - private NMSServiceImpl nmsService = null; - private Settings settings; - private OreControlServiceSupplier oreControlServiceSupplier; - - @Override - public void onLoad() { - this.oreControlServiceSupplier = new OreControlServiceSupplier(this); - nmsService = new NMSServiceImpl(new NMSUtil_v1_17_R1(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - - // register GenerationHandlers - final GenerationHandler normalOreGenerationHandler = new NormalOreGenerationHandler(nmsService.getNMSUtil()); - final GenerationHandler netherNormalOreGenerationHandler = new NetherNormalOreGenerationHandler(nmsService.getNMSUtil()); - nmsService.registerGenerationHandler(Ore.DIAMOND, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.COAL, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GOLD, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GOLD_BADLANDS, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.IRON, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.REDSTONE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.DIRT, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GRAVEL, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GRANITE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.DIORITE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.ANDESITE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.NETHER_QUARTZ, netherNormalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.INFESTED_STONE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.EMERALD, new EmeraldGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.LAPIS, new LapisGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.MAGMA, new MagmaGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.NETHER_GOLD, netherNormalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.ANCIENT_DEBRIS, netherNormalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.ANCIENT_DEBRIS_2, new NetherAncientDebrisGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.COPPER, new LapisGenerationHandler(nmsService.getNMSUtil())); - } - - @Override - public void onEnable() { - this.oreControlServiceSupplier.registerEvents(); - - final WorldOreConfigYamlDao worldOreConfigYamlDao = new WorldOreConfigYamlDao(new File(getDataFolder(), "data/world-ore-configs")); - - // Register the OreControl Service, this need for checkFile and Settings, since some Files have Objects that need this Service to deserialize - Bukkit.getServicesManager().register(OreControlService.class, - new OreControlServiceImpl( - nmsService, - worldOreConfigYamlDao) { - @NotNull - @Override - protected OreSettings getDefaultOreSetting(@NotNull final Ore ore) { - return settings.getDefaultSettings(ore); - } - - @NotNull - @Override - protected OreSettings getDefaultOreSetting(@NotNull Biome biome, @NotNull Ore ore) { - return settings.getDefaultSettings(biome, ore); - } - - @NotNull - @Override - protected OreSettings getNewOreSetting(@NotNull final Ore ore) { - return new OreSettingsYamlImpl(ore); - } - - @NotNull - @Override - protected WorldOreConfig getNewWorldOreConfig(@NotNull final String name, final boolean template) { - return new WorldOreConfigYamlImpl(name, template ? ConfigType.TEMPLATE : ConfigType.UNKNOWN); - } - - @NotNull - @Override - protected BiomeOreSettings getNewBiomeOreSettings(@NotNull final Biome biome) { - return new BiomeOreSettingsYamlImpl(biome); - } - }, - this, ServicePriority.Normal); - - checkFile("data/settings.yml"); - - // load the Settings - settings = new Settings(() -> Config.getConfig(this, "data/settings.yml"), Version.getServerVersion(getServer()), getLogger()); - - checkOldStorageType(); - worldOreConfigYamlDao.reload(); - - // start the Metric of this Plugin (https://bstats.org/plugin/bukkit/Ore-Control) - setUpMetric(); - - // hook in the WorldGenerator, we try this before we register the commands and events, that if something goes wrong here - // the player see that no command function, and looks in to the log to see if a error happen - nmsService.replaceNMS(); - - // register the Listener for the WorldLoad event - Bukkit.getPluginManager().registerEvents(this, this); - } - - private void setUpMetric() { - // create a new Metrics - new OreControlMetrics(this, this.oreControlServiceSupplier) { - @Override - protected String getLanguage() { - return "N/A"; - } - - @Override - protected String getUseSafeMode() { - return "N/A"; - } - - @Override - protected String getUseTranslateTabCompilation() { - return "N/A"; - } - - @Override - protected String getUseVerifyCopyAction() { - return "N/A"; - } - - @Override - protected String getUseVerifyResetAction() { - return "N/A"; - } - }; - } - - private void checkFile(@NotNull final String name) { - final File file = new File(getDataFolder(), name); - - if (!file.exists()) { - return; - } - - final YamlConfiguration configuration = new Config(file); - - final YamlConfiguration configuration2 = new Config(getResource(name)); - - if (configuration.getInt("version") == configuration2.getInt("version")) - return; - - getLogger().warning("File " + name + " has an outdated / new version, replacing it!"); - - if (!file.delete()) { - throw new RuntimeException("can't delete file " + name + " stop plugin start!"); - } - - saveResource(name, true); - } - - @EventHandler //TODO maybe extra class - public void onWorldLoad(@NotNull final WorldLoadEvent event) { - Bukkit.getScheduler().runTaskAsynchronously(this, () -> - this.oreControlServiceSupplier.get().getWorldOreConfig(event.getWorld().getName()).ifPresent(value -> { - if (value.getConfigType() == ConfigType.TEMPLATE) { - value.setConfigType(getConfigType(event.getWorld())); - this.oreControlServiceSupplier.get().saveWorldOreConfig(value); - } - if (value.getConfigType() == ConfigType.GLOBAL) { - WorldOreConfig worldOreConfig = value.clone(value.getName()); - worldOreConfig.setConfigType(getConfigType(event.getWorld())); - this.oreControlServiceSupplier.get().saveWorldOreConfig(worldOreConfig); - } - }) - ); - } - - private ConfigType getConfigType(World world) { - Dimension dimension = this.oreControlServiceSupplier.get().getNMSService().getNMSUtil().getDimension(world); - - switch (dimension) { - case OVERWORLD: - return ConfigType.OVERWORLD; - case NETHER: - return ConfigType.NETHER; - case THE_END: - case CUSTOM: - return ConfigType.UNKNOWN; - } - - return ConfigType.UNKNOWN; - } - - @Deprecated - private void checkOldStorageType() { - final File file = new File(getDataFolder(), "data/world_ore_configs.yml"); - - if (!file.exists()) { - return; - } - - if (file.isDirectory()) { - getLogger().info("WTF?? why??"); - return; - } - - getLogger().info("Found old storage type, convert to new one"); - - final WorldOreConfigYamlDao_Old worldConfigYamlDao = new WorldOreConfigYamlDao_Old(file); - worldConfigYamlDao.init(); - - final OreControlService service = this.oreControlServiceSupplier.get(); - - worldConfigYamlDao.getAll().forEach(service::saveWorldOreConfig); - - if (!file.delete()) { - throw new RuntimeException("cannot delete File " + file); - } - - getLogger().info("Finish converting old storage format to new one"); - } - -} diff --git a/ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java b/ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java deleted file mode 100644 index e6f4d189..00000000 --- a/ore-control-lite/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.ore.control.api.OreControlService; -import org.apache.commons.lang.Validate; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.server.ServiceRegisterEvent; -import org.bukkit.event.server.ServiceUnregisterEvent; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Supplier; - -public class OreControlServiceSupplier implements Supplier, Listener { - - @NotNull - private final Plugin plugin; - @Nullable - private OreControlService oreControlService; - private boolean registered = false; - - public OreControlServiceSupplier(@NotNull final Plugin plugin) { - Validate.notNull(plugin, "Plugin cannot be null"); - - this.plugin = plugin; - } - - public void registerEvents() { - if (this.registered) { - throw new IllegalStateException("Events already registered"); - } - - this.plugin.getServer().getPluginManager().registerEvents(this, this.plugin); - - this.registered = true; - } - - @Override - public OreControlService get() { - if (this.oreControlService == null) { - updateProvider(); - - if (this.oreControlService == null) { - throw new RuntimeException("The Bukkit Service has no OreControlService and no OreControlService is cached!"); - } - } - - return this.oreControlService; - } - - @EventHandler - public void onServiceRegister(ServiceRegisterEvent event) { - if (event.getProvider().getProvider() instanceof OreControlService) { - updateProvider(); - } - } - - @EventHandler - public void onServiceUnregister(ServiceUnregisterEvent event) { - if (event.getProvider().getProvider() instanceof OreControlService) { - updateProvider(); - } - } - - private void updateProvider() { - final OreControlService service = this.plugin.getServer().getServicesManager().load(OreControlService.class); - - if (service != null) { - this.oreControlService = service; - } - - } - -} diff --git a/ore-control-lite/src/main/java/de/derfrzocker/ore/control/Settings.java b/ore-control-lite/src/main/java/de/derfrzocker/ore/control/Settings.java deleted file mode 100644 index 3b6ca451..00000000 --- a/ore-control-lite/src/main/java/de/derfrzocker/ore/control/Settings.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.BiomeOreSettings; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreSettings; -import de.derfrzocker.spigot.utils.ReloadAble; -import de.derfrzocker.spigot.utils.Version; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.file.YamlConfiguration; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.logging.Logger; - -public class Settings implements ReloadAble { - - @NotNull - private final Supplier yamlSupplier; - @NotNull - private final Version version; - @NotNull - private final Logger logger; - @NotNull - private Map oreSettings = new HashMap<>(); - @NotNull - private Map biomeOreSettingsStorage = new HashMap<>(); - - public Settings(@NotNull final Supplier yamlSupplier, @NotNull final Version version, @NotNull final Logger logger) { - Validate.notNull(yamlSupplier, "YamlSupplier cannot be null"); - Validate.notNull(version, "Version cannot be null"); - Validate.notNull(logger, "Logger cannot be null"); - - this.yamlSupplier = yamlSupplier; - this.version = version; - this.logger = logger; - RELOAD_ABLES.add(this); - - reload(); - } - - @NotNull - public OreSettings getDefaultSettings(@NotNull final Ore ore) { - Validate.notNull(ore, "Ore cannot be null"); - - final OreSettings oreSettings = this.oreSettings.get(ore); - - if (oreSettings == null) { - throw new NoSuchDefaultOreSettingsException(ore, "There is no default OreSetting for the Ore '" + ore + "'"); - } - - return oreSettings; - } - - @NotNull - public OreSettings getDefaultSettings(@NotNull Biome biome, @NotNull final Ore ore) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - - final BiomeOreSettingsStorage biomeOreSettingsStorage = this.biomeOreSettingsStorage.get(biome); - - if (biomeOreSettingsStorage == null) { - return getDefaultSettings(ore); - } - - final OreSettings oreSettings = biomeOreSettingsStorage.getDefaultSettings(ore); - - if (oreSettings == null) { - return getDefaultSettings(ore); - } - - return oreSettings; - } - - @Override - public void reload() { - final YamlConfiguration yaml = yamlSupplier.get(); - final List oreSettings = yaml.getList("defaults.ore-settings"); - - final Map oreSettingsMap = new HashMap<>(); - final Map biomeOreSettingsStorageMap = new HashMap<>(); - - if (oreSettings == null) { - throw new IllegalArgumentException("The YamlConfiguration don't have a list under 'defaults.ore-settings'"); - } - - for (final Object oreSettingObject : oreSettings) { - if (!(oreSettingObject instanceof OreSettings)) { - throw new IllegalArgumentException("The object '" + oreSettingObject + "' is not an instance of OreSettings"); - } - - final OreSettings oreSetting = (OreSettings) oreSettingObject; - final Ore ore = oreSetting.getOre(); - - // ignoring ore-settings from ores which are not present in the version the server is running - if (version.isOlderThan(ore.getSince())) { - continue; - } - - final OreSettings otherOreSetting = oreSettingsMap.put(ore, oreSetting); - - if (otherOreSetting != null) { - logger.info("There are multiple OreSettings for the ore '" + ore + "' in the default Ore-Settings YamlConfiguration"); - logger.info("Old OreSetting: " + otherOreSetting); - logger.info("New OreSetting: " + oreSetting); - } - } - - final List biomeOreSettings = yaml.getList("defaults.biome-ore-settings"); - - if (biomeOreSettings == null) { - throw new IllegalArgumentException("The YamlConfiguration don't have a list under 'defaults.biome-ore-settings'"); - } - - for (final Object biomeOreSettingsObject : biomeOreSettings) { - if (!(biomeOreSettingsObject instanceof BiomeOreSettings)) { - throw new IllegalArgumentException("The object '" + biomeOreSettings + "' is not an instance of BiomeOreSettings"); - } - - final BiomeOreSettings biomeOreSetting = (BiomeOreSettings) biomeOreSettingsObject; - final Biome biome = biomeOreSetting.getBiome(); - - // ignoring biome-ore-settings from biomes which are not present in the version the server is running - if (version.isOlderThan(biome.getSince())) { - continue; - } - - if (biome.getUntil() != null && version.isNewerThan(biome.getUntil())) { - continue; - } - - final BiomeOreSettingsStorage biomeOreSettingsStorage = new BiomeOreSettingsStorage(biomeOreSetting.getOreSettings()); - final BiomeOreSettingsStorage otherBiomeOreSetting = biomeOreSettingsStorageMap.put(biome, biomeOreSettingsStorage); - - if (otherBiomeOreSetting != null) { - logger.info("There are multiple BiomeOreSettings for the biome '" + biome + "' in the default Biome-Ore-Settings YamlConfiguration"); - logger.info("Old BiomeOreSettings: " + otherBiomeOreSetting); - logger.info("New BiomeOreSettings: " + biomeOreSettingsStorage); - } - } - - this.oreSettings = oreSettingsMap; - this.biomeOreSettingsStorage = biomeOreSettingsStorageMap; - } - - private static final class BiomeOreSettingsStorage { - - private final Map oreSettings = new HashMap<>(); - - private BiomeOreSettingsStorage(@NotNull final Map oreSettingsMap) { - this.oreSettings.putAll(oreSettingsMap); - } - - @Nullable - private OreSettings getDefaultSettings(@NotNull final Ore ore) { - return this.oreSettings.get(ore); - } - - @Override - public String toString() { - return "BiomeOreSettingsStorage{" + - "oreSettings=" + oreSettings + - '}'; - } - - } - - public static final class NoSuchDefaultOreSettingsException extends RuntimeException { - - @NotNull - private final Ore ore; - - private NoSuchDefaultOreSettingsException(@NotNull Ore ore, final String message) { - super(message); - - this.ore = ore; - } - - @NotNull - public Ore getOre() { - return ore; - } - - } - -} diff --git a/ore-control-lite/src/main/resources/data/settings.yml b/ore-control-lite/src/main/resources/data/settings.yml deleted file mode 100644 index 087e09f0..00000000 --- a/ore-control-lite/src/main/resources/data/settings.yml +++ /dev/null @@ -1,195 +0,0 @@ -# Do not edit this file -defaults: - ore-settings: - - ==: OreControl#OreSettings - ore: DIAMOND - settings: - VEIN_SIZE: 8 - VEINS_PER_CHUNK: 1 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 16 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: REDSTONE - settings: - VEIN_SIZE: 8 - VEINS_PER_CHUNK: 8 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 16 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: COAL - settings: - VEIN_SIZE: 17 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: IRON - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 64 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GOLD - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 2 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 32 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GOLD_BADLANDS - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 32 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 32 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: EMERALD - settings: - ORES_PER_CHUNK_RANGE: 6 - MINIMUM_ORES_PER_CHUNK: 3 - MINIMUM_HEIGHT: 4 - HEIGHT_RANGE: 28 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: LAPIS - settings: - VEIN_SIZE: 7 - VEINS_PER_CHUNK: 1 - HEIGHT_RANGE: 16 - HEIGHT_CENTER: 16 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: DIRT - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 256 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GRAVEL - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 8 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 256 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GRANITE - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: DIORITE - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: ANDESITE - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: NETHER_QUARTZ - settings: - VEIN_SIZE: 14 - VEINS_PER_CHUNK: 16 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: INFESTED_STONE - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 7 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 64 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: MAGMA - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 4 - HEIGHT_RANGE: 10 - SEA_LEVEL_DIVIDER: 2 - SEA_LEVEL_ADDER: -4 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: NETHER_GOLD - settings: - VEIN_SIZE: 10 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: ANCIENT_DEBRIS - settings: - VEIN_SIZE: 2 - VEINS_PER_CHUNK: 1 - MINIMUM_HEIGHT: 8 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 16 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: ANCIENT_DEBRIS_2 - settings: - VEIN_SIZE: 3 - VEINS_PER_CHUNK: 1 - HEIGHT_RANGE: 8 - HEIGHT_CENTER: 16 - VEINS_PER_BIOME: 0 - biome-ore-settings: - - ==: OreControl#BiomeOreSettings - biome: BASALT_DELTAS - ore-settings: - - ==: OreControl#OreSettings - ore: NETHER_GOLD - settings: - VEIN_SIZE: 10 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: NETHER_QUARTZ - settings: - VEIN_SIZE: 10 - VEINS_PER_CHUNK: 32 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - -version: 7 \ No newline at end of file diff --git a/ore-control-lite/src/main/resources/plugin.yml b/ore-control-lite/src/main/resources/plugin.yml deleted file mode 100644 index 6cf35712..00000000 --- a/ore-control-lite/src/main/resources/plugin.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: ${parent.name} -version: ${project.version}-lite -description: ${project.description} -author: ${project.author} -# @formatter:off # IntelliJ formats this part in a way, that maven don't recognize it -authors: [${project.authors}] -# @formatter:on -main: de.derfrzocker.ore.control.OreControlLite -api-version: "1.13" -load: STARTUP \ No newline at end of file diff --git a/ore-control/pom.xml b/ore-control/pom.xml index d4ffd544..ed37570c 100644 --- a/ore-control/pom.xml +++ b/ore-control/pom.xml @@ -32,12 +32,14 @@ bstats-bukkit ${bstats.version} compile + true net.wesjd anvilgui 1.5.2-SNAPSHOT compile + true de.derfrzocker @@ -53,69 +55,16 @@ de.derfrzocker - ore-control-impl-v1_13_R1 + ore-control-common ${project.version} compile de.derfrzocker - ore-control-impl-v1_13_R2 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-yaml - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-v1_14_R1 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-v1_15_R1 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-v1_16_R1 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-v1_16_R2 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-v1_16_R3 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-v1_17_R1 - ${project.version} - compile - - - de.derfrzocker - ore-control-impl-service - ${project.version} - compile - - - de.derfrzocker - ore-control-metrics + ore-control-impl-v1_18_R1 ${project.version} compile + true diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/ConfigValues.java b/ore-control/src/main/java/de/derfrzocker/ore/control/ConfigValues.java deleted file mode 100644 index 675be0c0..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/ConfigValues.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.spigot.utils.Config; -import de.derfrzocker.spigot.utils.Language; -import de.derfrzocker.spigot.utils.ReloadAble; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.file.YamlConfiguration; -import org.jetbrains.annotations.NotNull; - -import java.io.File; -import java.io.IOException; - -public class ConfigValues implements ReloadAble { - - public final Set SET = new Set(); - public final Default DEFAULT = new Default(); - @NotNull - private final File file; - private volatile YamlConfiguration yaml; - - public ConfigValues(@NotNull final File file) { - Validate.notNull(file, "File cannot be null"); - - this.file = file; - - reload(); - RELOAD_ABLES.add(this); - } - - public boolean isSafeMode() { - return yaml.getBoolean("safe-mode", true); - } - - public Language getLanguage() { - return Language.getLanguage(yaml.getString("language", "english")); - } - - public boolean isTranslateTabCompilation() { - return yaml.getBoolean("translate-tab-compilation", true); - } - - public boolean verifyCopyAction() { - return yaml.getBoolean("verify.copy-action", true); - } - - public boolean verifyResetAction() { - return yaml.getBoolean("verify.reset-action", true); - } - - public boolean showWelcomeMessage() { - return yaml.getBoolean("show-welcome-message", true); - } - - @Override - public void reload() { - yaml = Config.getConfig(OreControl.getInstance(), file.getName()); - } - - public class Set { - - private Set() { - - } - - public void setLanguage(@NotNull final Language language) { - Validate.notNull(language, "Language cannot be null"); - - yaml.set("language", language.toString()); - - try { - yaml.save(file); - } catch (final IOException e) { - throw new RuntimeException("Error while save config.yml, while set language to: " + language, e); - } - } - - public void setSafeMode(final boolean bool) { - yaml.set("safe-mode", bool); - - try { - yaml.save(file); - } catch (final IOException e) { - throw new RuntimeException("Error while save config.yml, while set safe_mode to: " + bool, e); - } - } - - public void setTranslateTabCompilation(final boolean bool) { - yaml.set("translate-tab-compilation", bool); - - try { - yaml.save(file); - } catch (final IOException e) { - throw new RuntimeException("Error while save config.yml, while set translate_tab_compilation to: " + bool, e); - } - } - - public void setVerifyCopyAction(final boolean bool) { - yaml.set("verify.copy-action", bool); - - try { - yaml.save(file); - } catch (final IOException e) { - throw new RuntimeException("Error while save config.yml, while set verify.copy_action to: " + bool, e); - } - } - - public void setVerifyResetAction(final boolean bool) { - yaml.set("verify.reset-action", bool); - - try { - yaml.save(file); - } catch (final IOException e) { - throw new RuntimeException("Error while save config.yml, while set verify.reset_action to: " + bool, e); - } - } - - public void setShowWelcomeMessage(final boolean bool) { - yaml.set("show-welcome-message", bool); - - try { - yaml.save(file); - } catch (final IOException e) { - throw new RuntimeException("Error while save config.yml, while set verify.reset_action to: " + bool, e); - } - } - - } - - public class Default { - - private Default() { - - } - - public Language defaultLanguage() { - return Language.getLanguage(yaml.getDefaultSection().getString("language")); - } - - public boolean defaultSafeMode() { - return yaml.getDefaultSection().getBoolean("safe-mode", true); - } - - public boolean defaultTranslateTabCompilation() { - return yaml.getDefaultSection().getBoolean("translate-tab-compilation", true); - } - - public boolean defaultVerifyCopyAction() { - return yaml.getDefaultSection().getBoolean("verify.copy-action", true); - } - - public boolean defaultVerifyResetAction() { - return yaml.getDefaultSection().getBoolean("verify.reset-action", true); - } - - public boolean defaultShowWelcomeMessage() { - return yaml.getDefaultSection().getBoolean("show-welcome-message", true); - } - - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/OreControl.java b/ore-control/src/main/java/de/derfrzocker/ore/control/OreControl.java index d63de1cd..e0075b07 100644 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/OreControl.java +++ b/ore-control/src/main/java/de/derfrzocker/ore/control/OreControl.java @@ -25,423 +25,27 @@ package de.derfrzocker.ore.control; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.command.NoCommandsAvailableCommand; -import de.derfrzocker.ore.control.command.OreControlCommand; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.impl.*; -import de.derfrzocker.ore.control.impl.dao.WorldOreConfigYamlDao; -import de.derfrzocker.ore.control.impl.dao.WorldOreConfigYamlDao_Old; -import de.derfrzocker.ore.control.impl.generationhandler.*; -import de.derfrzocker.ore.control.impl.v1_13_R1.NMSUtil_v1_13_R1; -import de.derfrzocker.ore.control.impl.v1_13_R2.NMSUtil_v1_13_R2; -import de.derfrzocker.ore.control.impl.v1_14_R1.NMSUtil_v1_14_R1; -import de.derfrzocker.ore.control.impl.v1_15_R1.NMSUtil_v1_15_R1; -import de.derfrzocker.ore.control.impl.v1_16_R1.NMSUtil_v1_16_R1; -import de.derfrzocker.ore.control.impl.v1_16_R2.NMSUtil_v1_16_R2; -import de.derfrzocker.ore.control.impl.v1_16_R3.NMSUtil_v1_16_R3; -import de.derfrzocker.ore.control.impl.v1_17_R1.NMSUtil_v1_17_R1; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.Config; -import de.derfrzocker.spigot.utils.Language; -import de.derfrzocker.spigot.utils.Version; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.configuration.serialization.ConfigurationSerialization; -import org.bukkit.event.EventHandler; +import de.derfrzocker.ore.control.api.OreControlRegistries; +import de.derfrzocker.ore.control.api.dao.ConfigDao; +import de.derfrzocker.ore.control.impl.v1_18_R1.NMSReplacer_v1_18_R1; import org.bukkit.event.Listener; -import org.bukkit.event.world.WorldLoadEvent; -import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; public class OreControl extends JavaPlugin implements Listener { - private static OreControl instance; - - // register the ConfigurationSerializable's in a static block, that we can easy use them in Test cases - static { - ConfigurationSerialization.registerClass(WorldOreConfigYamlImpl.class); - ConfigurationSerialization.registerClass(OreSettingsYamlImpl.class); - ConfigurationSerialization.registerClass(BiomeOreSettingsYamlImpl.class); - } - - private ConfigValues configValues; // The Config values of this plugin - private Settings settings; // The Settings of this Plugin, other than the ConfigValues, this Values should not be modified - private NMSServiceImpl nmsService = null; // The NMSService, we use this Variable, that we can easy set the variable in the onLoad method and use it in the onEnable method - private OreControlCommand oreControlCommand; // The OreControlCommand handler - private OreControlMessages oreControlMessages; - private Permissions permissions; - private OreControlServiceSupplier oreControlServiceSupplier; - - public static OreControl getInstance() { - return instance; - } - - public static void setInstance(final OreControl instance) { - OreControl.instance = instance; - } - - public ConfigValues getConfigValues() { - return this.configValues; - } - - @Override - public void onLoad() { - // initial instance variable - instance = this; - this.oreControlServiceSupplier = new OreControlServiceSupplier(this); - - Version version = Version.getServerVersion(getServer()); - - if (version == Version.v1_13_R1) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_13_R1(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } else if (version == Version.v1_13_R2) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_13_R2(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } else if (version == Version.v1_14_R1) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_14_R1(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } else if (version == Version.v1_15_R1) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_15_R1(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } else if (version == Version.v1_16_R1) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_16_R1(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } else if (version == Version.v1_16_R2) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_16_R2(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } else if (version == Version.v1_16_R3) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_16_R3(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } else if (version == Version.v1_17_R1) { - nmsService = new NMSServiceImpl(new NMSUtil_v1_17_R1(this.oreControlServiceSupplier), this.oreControlServiceSupplier); - } - - // if no suitable version was found, log and return - if (nmsService == null) { - getLogger().warning("The Server version which you are running is unsupported, you are running version '" + version + "'"); - getLogger().warning("The plugin supports following version " + combineVersions(Version.v1_13_R1, Version.v1_13_R2, Version.v1_14_R1, Version.v1_15_R1, Version.v1_16_R1, Version.v1_16_R2, Version.v1_16_R3, Version.v1_17_R1)); - getLogger().warning("(Spigot / Paper version 1.13.1 - 1.17), if you are running such a Minecraft version, than your bukkit implementation is unsupported, in this case please contact the developer, so he can resolve this Issue"); - - if (version == Version.UNKNOWN) { - getLogger().warning("The Version '" + version + "' can indicate, that you are using a newer Minecraft version than currently supported."); - getLogger().warning("In this case please update to the newest version of this plugin. If this is the newest Version, than please be patient. It can take some weeks until the plugin is updated"); - } - - return; - } - - // register GenerationHandlers - final GenerationHandler normalOreGenerationHandler = new NormalOreGenerationHandler(nmsService.getNMSUtil()); - final GenerationHandler netherNormalOreGenerationHandler = new NetherNormalOreGenerationHandler(nmsService.getNMSUtil()); - nmsService.registerGenerationHandler(Ore.DIAMOND, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.COAL, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GOLD, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GOLD_BADLANDS, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.IRON, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.REDSTONE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.DIRT, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GRAVEL, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.GRANITE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.DIORITE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.ANDESITE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.NETHER_QUARTZ, netherNormalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.INFESTED_STONE, normalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.EMERALD, new EmeraldGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.LAPIS, new LapisGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.MAGMA, new MagmaGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.NETHER_GOLD, netherNormalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.ANCIENT_DEBRIS, netherNormalOreGenerationHandler); - nmsService.registerGenerationHandler(Ore.ANCIENT_DEBRIS_2, new NetherAncientDebrisGenerationHandler(nmsService.getNMSUtil())); - nmsService.registerGenerationHandler(Ore.COPPER, new LapisGenerationHandler(nmsService.getNMSUtil())); - - // load the config values of this plugin - configValues = new ConfigValues(new File(getDataFolder(), "config.yml")); - - // Set default language - Language.setDefaultLanguage(() -> getConfigValues().getLanguage()); - } - @Override public void onEnable() { - // return if no suitable NMSService was found in onLoad - if (nmsService == null) { - getServer().getPluginManager().disablePlugin(this); - return; - } - - oreControlMessages = new OreControlMessages(this); - permissions = new Permissions(this); - Version version = Version.getServerVersion(getServer()); - oreControlServiceSupplier.registerEvents(); - - final WorldOreConfigYamlDao worldOreConfigYamlDao = new WorldOreConfigYamlDao(new File(getDataFolder(), "data/world-ore-configs")); - - // Register the OreControl Service, this need for checkFile and Settings, since some Files have Objects that need this Service to deserialize - Bukkit.getServicesManager().register(OreControlService.class, - new OreControlServiceImpl( - nmsService, - worldOreConfigYamlDao) { - @NotNull - @Override - protected OreSettings getDefaultOreSetting(@NotNull final Ore ore) { - return settings.getDefaultSettings(ore); - } - - @NotNull - @Override - protected OreSettings getDefaultOreSetting(@NotNull Biome biome, @NotNull Ore ore) { - return settings.getDefaultSettings(biome, ore); - } - - @NotNull - @Override - protected OreSettings getNewOreSetting(@NotNull final Ore ore) { - return new OreSettingsYamlImpl(ore); - } - - @NotNull - @Override - protected WorldOreConfig getNewWorldOreConfig(@NotNull final String name, final boolean template) { - return new WorldOreConfigYamlImpl(name, template ? ConfigType.TEMPLATE : ConfigType.UNKNOWN); - } - - @NotNull - @Override - protected BiomeOreSettings getNewBiomeOreSettings(@NotNull final Biome biome) { - return new BiomeOreSettingsYamlImpl(biome); - } - }, - this, ServicePriority.Normal); - - checkFile("data/settings.yml"); - - // load the Settings - settings = new Settings(() -> Config.getConfig(this, "data/settings.yml"), version, getLogger()); - - checkOldStorageType(); - checkLanguage(); - worldOreConfigYamlDao.reload(); - - // start the Metric of this Plugin (https://bstats.org/plugin/bukkit/Ore-Control) - setUpMetric(); - - // hook in the WorldGenerator, we try this before we register the commands and events, that if something goes wrong here - // the player see that no command function, and looks in to the log to see if a error happen - nmsService.replaceNMS(); - - // register the Listener for the WorldLoad event - Bukkit.getPluginManager().registerEvents(this, this); - - // checking if the server jar contains the bungee chat api - // for example normal CraftBukkit does not contains it - // if it does not contains it, print a message that no commands are available - // but the plugin should run anyway - try { - Class.forName("net.md_5.bungee.api.ChatColor"); - } catch (final ClassNotFoundException e) { - getLogger().warning("It seems your are running a server jar, which does not contains the package 'net.md_5.bungee.api'"); - getLogger().warning("This plugin requires this package for the commands and gui"); - getLogger().warning("If no other error appears, than the plugin should work anyway (beside commands and gui)"); - getLogger().warning("If you want to use the commands and gui, please use a server jar which contains the package 'net.md_5.bungee.api', such as Spigot (not CraftBukkit)"); - getLogger().warning("After you have set the values, you can use the other server jar again"); - - getCommand("orecontrol").setExecutor(new NoCommandsAvailableCommand()); - - return; - } - - if (configValues.showWelcomeMessage()) { - final WelcomeMessage welcomeMessage = new WelcomeMessage(this, oreControlMessages); - final PlayerJoinListener playerJoinListener = new PlayerJoinListener(permissions.getBasePermission(), welcomeMessage); - - registerCommands(playerJoinListener, welcomeMessage); - getServer().getPluginManager().registerEvents(playerJoinListener, this); - } else { - registerCommands(null, null); + OreControlRegistries registries = new OreControlRegistries(); + ConfigDao configDao = new ConfigDao(registries, new File(getDataFolder(), "data/configs")); + NMSReplacer_v1_18_R1 nmsReplacer = new NMSReplacer_v1_18_R1(registries, configDao); + nmsReplacer.register(); + File defaults = new File(getDataFolder(), "data/default"); + if (!defaults.exists()) { + nmsReplacer.saveDefaultValues(defaults); } + nmsReplacer.hookIntoBiomes(); } - - private void checkLanguage() { - for (Language language : Language.values()) { - File file = new File(getDataFolder(), language.getFileLocation()); - if (!file.exists()) { - continue; - } - - Config diskConfig = new Config(file); - Config jarConfig = new Config(getResource(language.getFileLocation())); - int diskVersion = diskConfig.getInt("version", 0); - int jarVersion = jarConfig.getInt("version", 0); - - if (diskVersion != jarVersion) { - getLogger().warning("The language file " + language.getFileLocation() + " has an outdated / new version, replacing it!"); - - File newLocation = new File(getDataFolder(), language.getFileLocation() + "_old_" + diskVersion); - - int i = 1; - while (newLocation.exists()) { - newLocation = new File(getDataFolder(), language.getFileLocation() + "_old_" + diskVersion + "_" + i); - i++; - } - - try { - newLocation.createNewFile(); - Files.move(file.toPath(), newLocation.toPath(), StandardCopyOption.REPLACE_EXISTING); - } catch (IOException e) { - throw new RuntimeException("Error while creating and moving file", e); - } - - getLogger().warning("You find the old version under: " + newLocation.toPath()); - } - - } - } - - private void setUpMetric() { - // create a new Metrics - new OreControlMetrics(this, this.oreControlServiceSupplier) { - @Override - protected String getLanguage() { - return configValues.getLanguage().getNames()[0]; - } - - @Override - protected String getUseSafeMode() { - return String.valueOf(configValues.isSafeMode()); - } - - @Override - protected String getUseTranslateTabCompilation() { - return String.valueOf(configValues.isTranslateTabCompilation()); - } - - @Override - protected String getUseVerifyCopyAction() { - return String.valueOf(configValues.verifyCopyAction()); - } - - @Override - protected String getUseVerifyResetAction() { - return String.valueOf(configValues.verifyResetAction()); - } - }; - } - - private void registerCommands(@Nullable final PlayerJoinListener playerJoinListener, @Nullable final WelcomeMessage welcomeMessage) { - getCommand("orecontrol").setExecutor(oreControlCommand = new OreControlCommand( - new OreControlValues(this.oreControlServiceSupplier, this, configValues, oreControlMessages, permissions, Version.getServerVersion(getServer())), - new GuiSettings(this, "data/gui", Version.getServerVersion(getServer())) - , playerJoinListener, welcomeMessage)); - } - - private void checkFile(@NotNull final String name) { - final File file = new File(getDataFolder(), name); - - if (!file.exists()) { - return; - } - - final YamlConfiguration configuration = new Config(file); - - final YamlConfiguration configuration2 = new Config(getResource(name)); - - if (configuration.getInt("version") == configuration2.getInt("version")) { - return; - } - - getLogger().warning("File " + name + " has an outdated / new version, replacing it!"); - - if (!file.delete()) { - throw new RuntimeException("can't delete file " + name + " stop plugin start!"); - } - - saveResource(name, true); - } - - @EventHandler //TODO maybe extra class - public void onWorldLoad(@NotNull final WorldLoadEvent event) { - Bukkit.getScheduler().runTaskAsynchronously(this, () -> - this.oreControlServiceSupplier.get().getWorldOreConfig(event.getWorld().getName()).ifPresent(value -> { - if (value.getConfigType() == ConfigType.TEMPLATE) { - value.setConfigType(getConfigType(event.getWorld())); - this.oreControlServiceSupplier.get().saveWorldOreConfig(value); - } - if (value.getConfigType() == ConfigType.GLOBAL) { - WorldOreConfig worldOreConfig = value.clone(value.getName()); - worldOreConfig.setConfigType(getConfigType(event.getWorld())); - this.oreControlServiceSupplier.get().saveWorldOreConfig(worldOreConfig); - } - }) - ); - } - - private ConfigType getConfigType(World world) { - Dimension dimension = this.oreControlServiceSupplier.get().getNMSService().getNMSUtil().getDimension(world); - - switch (dimension) { - case OVERWORLD: - return ConfigType.OVERWORLD; - case NETHER: - return ConfigType.NETHER; - case THE_END: - case CUSTOM: - return ConfigType.UNKNOWN; - } - - return ConfigType.UNKNOWN; - } - - @Deprecated - private void checkOldStorageType() { - final File file = new File(getDataFolder(), "data/world_ore_configs.yml"); - - if (!file.exists()) { - return; - } - - if (file.isDirectory()) { - getLogger().info("WTF?? why??"); - return; - } - - getLogger().info("Found old storage type, convert to new one"); - - final WorldOreConfigYamlDao_Old worldConfigYamlDao = new WorldOreConfigYamlDao_Old(file); - worldConfigYamlDao.init(); - - final OreControlService service = this.oreControlServiceSupplier.get(); - - worldConfigYamlDao.getAll().forEach(service::saveWorldOreConfig); - - if (!file.delete()) { - throw new RuntimeException("cannot delete File " + file); - } - - getLogger().info("Finish converting old storage format to new one"); - } - - private String combineVersions(Version... versions) { - StringBuilder stringBuilder = new StringBuilder(); - - boolean first = true; - - for (Version version : versions) { - if (first) { - first = false; - } else { - stringBuilder.append(" "); - } - - stringBuilder.append("'"); - stringBuilder.append(version); - stringBuilder.append("'"); - } - - return stringBuilder.toString(); - } - } diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/OreControlMessages.java b/ore-control/src/main/java/de/derfrzocker/ore/control/OreControlMessages.java deleted file mode 100644 index bad0e0b8..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/OreControlMessages.java +++ /dev/null @@ -1,514 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.spigot.utils.command.HelpConfig; -import de.derfrzocker.spigot.utils.message.MessageKey; -import org.apache.commons.lang.Validate; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -public class OreControlMessages implements HelpConfig { - - @NotNull - private final MessageKey worldConfigNotFound; - @NotNull - private final MessageKey worldConfigAlreadyExists; - @NotNull - private final MessageKey oreNotFound; - @NotNull - private final MessageKey settingNotFound; - @NotNull - private final MessageKey biomeNotFound; - @NotNull - private final MessageKey oreNotValid; - @NotNull - private final MessageKey settingNotValid; - @NotNull - private final MessageKey numberNotValid; - @NotNull - private final MessageKey numberNotSafe; - @NotNull - private final MessageKey numberNotSafeWarning; - @NotNull - private final MessageKey numberNotSafeSeeAlso; - - // gui - @NotNull - private final MessageKey guiCopySuccess; - @NotNull - private final MessageKey guiResetSuccess; - @NotNull - private final MessageKey guiAnvilTitle; - - //command messages - @NotNull - private final MessageKey commandPlayerOnly; - - // set value messages - @NotNull - private final MessageKey commandSetValueUsage; - @NotNull - private final MessageKey commandSetValueDescription; - @NotNull - private final MessageKey commandSetValueNotEnoughArgs; - @NotNull - private final MessageKey commandSetValueSuccess; - - //set biome messages - @NotNull - private final MessageKey commandSetBiomeUsage; - @NotNull - private final MessageKey commandSetBiomeDescription; - @NotNull - private final MessageKey commandSetBiomeNotEnoughArgs; - @NotNull - private final MessageKey commandSetBiomeSuccess; - - //create messages - @NotNull - private final MessageKey commandCreateUsage; - @NotNull - private final MessageKey commandCreateDescription; - @NotNull - private final MessageKey commandCreateNotEnoughArgs; - @NotNull - private final MessageKey commandCreateSuccess; - - // reload messages - @NotNull - private final MessageKey commandReloadUsage; - @NotNull - private final MessageKey commandReloadDescription; - @NotNull - private final MessageKey commandReloadBegin; - @NotNull - private final MessageKey commandReloadEnd; - - // help format - @NotNull - private final MessageKey commandHelpSeparatorFormat; - @NotNull - private final MessageKey commandHelpHeaderFormat; - @NotNull - private final MessageKey commandHelpFooterFormat; - @NotNull - private final MessageKey commandHelpPermissionFormat; - @NotNull - private final MessageKey commandHelpUsageFormat; - @NotNull - private final MessageKey commandHelpDescriptionFormat; - @NotNull - private final MessageKey commandHelpShortFormat; - - // help messages - @NotNull - private final MessageKey commandHelpUsage; - @NotNull - private final MessageKey commandHelpDescription; - - // info messages - @NotNull - private final MessageKey commandInfoUsage; - @NotNull - private final MessageKey commandInfoDescription; - - // Welcome message - @NotNull - private final MessageKey buttonOpenString; - @NotNull - private final MessageKey buttonCloseString; - @NotNull - private final MessageKey welcomeHeader; - @NotNull - private final MessageKey foundBug; - @NotNull - private final MessageKey featureRequest; - @NotNull - private final MessageKey support; - @NotNull - private final MessageKey supportMyWork; - @NotNull - private final MessageKey notShowAgain; - @NotNull - private final MessageKey notShowAgainSuccess; - @NotNull - private final MessageKey clickMe; - @NotNull - private final MessageKey rating; - @NotNull - private final MessageKey donation; - - public OreControlMessages(@NotNull final Plugin plugin) { - Validate.notNull(plugin, "Plugin can not be null"); - - worldConfigNotFound = new MessageKey(plugin, "world-config.not-found"); - worldConfigAlreadyExists = new MessageKey(plugin, "world-config.already-exists"); - oreNotFound = new MessageKey(plugin, "ore.not-found"); - settingNotFound = new MessageKey(plugin, "setting.not-found"); - biomeNotFound = new MessageKey(plugin, "biome.not-found"); - oreNotValid = new MessageKey(plugin, "ore.not-valid"); - settingNotValid = new MessageKey(plugin, "setting.not-valid"); - numberNotValid = new MessageKey(plugin, "number.not-valid"); - numberNotSafe = new MessageKey(plugin, "number.not-safe"); - numberNotSafeWarning = new MessageKey(plugin, "number.not-safe-warning"); - guiCopySuccess = new MessageKey(plugin, "gui.copy.success"); - guiResetSuccess = new MessageKey(plugin, "gui.reset.success"); - guiAnvilTitle = new MessageKey(plugin, "gui.anvil.title"); - commandPlayerOnly = new MessageKey(plugin, "command.player-only"); - commandSetValueUsage = new MessageKey(plugin, "command.set.value.usage"); - commandSetValueDescription = new MessageKey(plugin, "command.set.value.description"); - commandSetValueNotEnoughArgs = new MessageKey(plugin, "command.set.value.not-enough-args"); - commandSetValueSuccess = new MessageKey(plugin, "command.set.value.success"); - commandSetBiomeUsage = new MessageKey(plugin, "command.set.biome.usage"); - commandSetBiomeDescription = new MessageKey(plugin, "command.set.biome.description"); - commandSetBiomeNotEnoughArgs = new MessageKey(plugin, "command.set.biome.not-enough-args"); - commandSetBiomeSuccess = new MessageKey(plugin, "command.set.biome.success"); - commandCreateUsage = new MessageKey(plugin, "command.create.usage"); - commandCreateDescription = new MessageKey(plugin, "command.create.description"); - commandCreateNotEnoughArgs = new MessageKey(plugin, "command.create.not-enough-args"); - commandCreateSuccess = new MessageKey(plugin, "command.create.success"); - commandReloadUsage = new MessageKey(plugin, "command.reload.usage"); - commandReloadDescription = new MessageKey(plugin, "command.reload.description"); - commandReloadBegin = new MessageKey(plugin, "command.reload.begin"); - commandReloadEnd = new MessageKey(plugin, "command.reload.end"); - commandHelpSeparatorFormat = new MessageKey(plugin, "command.help.separator-format"); - commandHelpHeaderFormat = new MessageKey(plugin, "command.help.header-format"); - commandHelpFooterFormat = new MessageKey(plugin, "command.help.footer-format"); - commandHelpPermissionFormat = new MessageKey(plugin, "command.help.permission-format"); - commandHelpUsageFormat = new MessageKey(plugin, "command.help.usage-format"); - commandHelpDescriptionFormat = new MessageKey(plugin, "command.help.description-format"); - commandHelpShortFormat = new MessageKey(plugin, "command.help.short-format"); - commandHelpUsage = new MessageKey(plugin, "command.help.usage"); - commandHelpDescription = new MessageKey(plugin, "command.help.description"); - commandInfoUsage = new MessageKey(plugin, "command.info.usage"); - commandInfoDescription = new MessageKey(plugin, "command.info.description"); - buttonOpenString = new MessageKey(plugin, "welcome.button-open-string"); - buttonCloseString = new MessageKey(plugin, "welcome.button-close-string"); - welcomeHeader = new MessageKey(plugin, "welcome.header"); - foundBug = new MessageKey(plugin, "welcome.found-bug"); - featureRequest = new MessageKey(plugin, "welcome.feature-request"); - support = new MessageKey(plugin, "welcome.support"); - supportMyWork = new MessageKey(plugin, "welcome.support-my-work"); - notShowAgain = new MessageKey(plugin, "welcome.not-show-again"); - notShowAgainSuccess = new MessageKey(plugin, "welcome.not-show-again-success"); - clickMe = new MessageKey(plugin, "welcome.click-me"); - rating = new MessageKey(plugin, "welcome.rating"); - donation = new MessageKey(plugin, "welcome.donation"); - numberNotSafeSeeAlso = new MessageKey(plugin, "number.not-safe-see-also"); - } - - @NotNull - public MessageKey getWorldConfigNotFoundMessage() { - return worldConfigNotFound; - } - - @NotNull - public MessageKey getWorldConfigAlreadyExistsMessage() { - return worldConfigAlreadyExists; - } - - @NotNull - public MessageKey getOreNotFoundMessage() { - return oreNotFound; - } - - @NotNull - public MessageKey getSettingNotFoundMessage() { - return settingNotFound; - } - - @NotNull - public MessageKey getBiomeNotFoundMessage() { - return biomeNotFound; - } - - @NotNull - public MessageKey getOreNotValidMessage() { - return oreNotValid; - } - - @NotNull - public MessageKey getSettingNotValidMessage() { - return settingNotValid; - } - - @NotNull - public MessageKey getNumberNotValidMessage() { - return numberNotValid; - } - - @NotNull - public MessageKey getNumberNotSafeMessage() { - return numberNotSafe; - } - - @NotNull - public MessageKey getNumberNotSafeWarningMessage() { - return numberNotSafeWarning; - } - - @NotNull - public MessageKey getNumberNotSafeSeeAlso() { - return numberNotSafeSeeAlso; - } - - //gui - @NotNull - public MessageKey getGuiCopySuccessMessage() { - return guiCopySuccess; - } - - @NotNull - public MessageKey getGuiResetSuccessMessage() { - return guiResetSuccess; - } - - @NotNull - public MessageKey getGuiAnvilTitleMessage() { - return guiAnvilTitle; - } - - - // command messages - @NotNull - public MessageKey getCommandPlayerOnlyMessage() { - return commandPlayerOnly; - } - - - // set value messages - @NotNull - public MessageKey getCommandSetValueUsageMessage() { - return commandSetValueUsage; - } - - @NotNull - public MessageKey getCommandSetValueDescriptionMessage() { - return commandSetValueDescription; - } - - @NotNull - public MessageKey getCommandSetValueNotEnoughArgsMessage() { - return commandSetValueNotEnoughArgs; - } - - @NotNull - public MessageKey getCommandSetValueSuccessMessage() { - return commandSetValueSuccess; - } - - - // set biome messages - @NotNull - public MessageKey getCommandSetBiomeUsageMessage() { - return commandSetBiomeUsage; - } - - @NotNull - public MessageKey getCommandSetBiomeDescriptionMessage() { - return commandSetBiomeDescription; - } - - @NotNull - public MessageKey getCommandSetBiomeNotEnoughArgsMessage() { - return commandSetBiomeNotEnoughArgs; - } - - @NotNull - public MessageKey getCommandSetBiomeSuccessMessage() { - return commandSetBiomeSuccess; - } - - // create messages - @NotNull - public MessageKey getCommandCreateUsageMessage() { - return commandCreateUsage; - } - - @NotNull - public MessageKey getCommandCreateDescriptionMessage() { - return commandCreateDescription; - } - - @NotNull - public MessageKey getCommandCreateNotEnoughArgsMessage() { - return commandCreateNotEnoughArgs; - } - - @NotNull - public MessageKey getCommandCreateSuccessMessage() { - return commandCreateSuccess; - } - - // reload messages - @NotNull - public MessageKey getCommandReloadUsageMessage() { - return commandReloadUsage; - } - - @NotNull - public MessageKey getCommandReloadDescriptionMessage() { - return commandReloadDescription; - } - - @NotNull - public MessageKey getCommandReloadBeginMessage() { - return commandReloadBegin; - } - - @NotNull - public MessageKey getCommandReloadEndMessage() { - return commandReloadEnd; - } - - // help format - @NotNull - @Override - public MessageKey getSeparatorMessageFormat() { - return commandHelpSeparatorFormat; - } - - @NotNull - @Override - public MessageKey getHeaderMessageFormat() { - return commandHelpHeaderFormat; - } - - @NotNull - @Override - public MessageKey getFooterMessageFormat() { - return commandHelpFooterFormat; - } - - @NotNull - @Override - public MessageKey getPermissionMessageFormat() { - return commandHelpPermissionFormat; - } - - @NotNull - @Override - public MessageKey getUsageMessageFormat() { - return commandHelpUsageFormat; - } - - @NotNull - @Override - public MessageKey getDescriptionMessageFormat() { - return commandHelpDescriptionFormat; - } - - @NotNull - @Override - public MessageKey getShortHelpMessageFormat() { - return commandHelpShortFormat; - } - - // help messages - @NotNull - public MessageKey getCommandHelpUsageMessage() { - return commandHelpUsage; - } - - @NotNull - public MessageKey getCommandHelpDescriptionMessage() { - return commandHelpDescription; - } - - // info messages - @NotNull - public MessageKey getCommandInfoUsageMessage() { - return commandInfoUsage; - } - - @NotNull - public MessageKey getCommandInfoDescriptionMessage() { - return commandInfoDescription; - } - - // Welcome message - @NotNull - public MessageKey getButtonCloseString() { - return buttonCloseString; - } - - @NotNull - public MessageKey getButtonOpenString() { - return buttonOpenString; - } - - @NotNull - public MessageKey getWelcomeHeader() { - return welcomeHeader; - } - - @NotNull - public MessageKey getNotShowAgain() { - return notShowAgain; - } - - @NotNull - public MessageKey getSupportMyWork() { - return supportMyWork; - } - - @NotNull - public MessageKey getSupport() { - return support; - } - - @NotNull - public MessageKey getFeatureRequest() { - return featureRequest; - } - - @NotNull - public MessageKey getFoundBug() { - return foundBug; - } - - @NotNull - public MessageKey getClickMe() { - return clickMe; - } - - @NotNull - public MessageKey getRating() { - return rating; - } - - @NotNull - public MessageKey getDonation() { - return donation; - } - - @NotNull - public MessageKey getNotShowAgainSuccess() { - return notShowAgainSuccess; - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java b/ore-control/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java deleted file mode 100644 index e6f4d189..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/OreControlServiceSupplier.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.ore.control.api.OreControlService; -import org.apache.commons.lang.Validate; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.server.ServiceRegisterEvent; -import org.bukkit.event.server.ServiceUnregisterEvent; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Supplier; - -public class OreControlServiceSupplier implements Supplier, Listener { - - @NotNull - private final Plugin plugin; - @Nullable - private OreControlService oreControlService; - private boolean registered = false; - - public OreControlServiceSupplier(@NotNull final Plugin plugin) { - Validate.notNull(plugin, "Plugin cannot be null"); - - this.plugin = plugin; - } - - public void registerEvents() { - if (this.registered) { - throw new IllegalStateException("Events already registered"); - } - - this.plugin.getServer().getPluginManager().registerEvents(this, this.plugin); - - this.registered = true; - } - - @Override - public OreControlService get() { - if (this.oreControlService == null) { - updateProvider(); - - if (this.oreControlService == null) { - throw new RuntimeException("The Bukkit Service has no OreControlService and no OreControlService is cached!"); - } - } - - return this.oreControlService; - } - - @EventHandler - public void onServiceRegister(ServiceRegisterEvent event) { - if (event.getProvider().getProvider() instanceof OreControlService) { - updateProvider(); - } - } - - @EventHandler - public void onServiceUnregister(ServiceUnregisterEvent event) { - if (event.getProvider().getProvider() instanceof OreControlService) { - updateProvider(); - } - } - - private void updateProvider() { - final OreControlService service = this.plugin.getServer().getServicesManager().load(OreControlService.class); - - if (service != null) { - this.oreControlService = service; - } - - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/Permissions.java b/ore-control/src/main/java/de/derfrzocker/ore/control/Permissions.java deleted file mode 100644 index c694533a..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/Permissions.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - - -import de.derfrzocker.spigot.utils.Permission; -import org.apache.commons.lang.Validate; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - - -public class Permissions { - - @NotNull - private final Permission base; - @NotNull - private final Permission reload; - @NotNull - private final Permission set; - @NotNull - private final Permission setValue; - @NotNull - private final Permission setBiome; - @NotNull - private final Permission gui; - @NotNull - private final Permission template; - @NotNull - private final Permission templateCreate; - @NotNull - private final Permission templateDelete; - @NotNull - private final Permission value; - @NotNull - private final Permission valueReset; - @NotNull - private final Permission valueCopy; - @NotNull - private final Permission configEdit; - - public Permissions(@NotNull final Plugin plugin) { - Validate.notNull(plugin, "Plugin cannot be null"); - - base = new Permission(null, "ore.control", plugin, false); - reload = new Permission(base, "reload", plugin, true); - set = new Permission(base, "set", plugin, true); - setValue = new Permission(set, "value", plugin, true); - setBiome = new Permission(set, "biome", plugin, true); - gui = new Permission(base, "gui", plugin, false); - template = new Permission(base, "template", plugin, false); - templateCreate = new Permission(template, "create", plugin, false); - templateDelete = new Permission(template, "delete", plugin, false); - value = new Permission(base, "value", plugin, false); - valueReset = new Permission(value, "reset", plugin, false); - valueCopy = new Permission(value, "copy", plugin, false); - configEdit = new Permission(base, "config.edit", plugin, false); - } - - @NotNull - public Permission getBasePermission() { - return base; - } - - @NotNull - public Permission getReloadPermission() { - return reload; - } - - @NotNull - public Permission getSetPermission() { - return set; - } - - @NotNull - public Permission getSetValuePermission() { - return setValue; - } - - @NotNull - public Permission getSetBiomePermission() { - return setBiome; - } - - @NotNull - public Permission getGuiPermission() { - return gui; - } - - @NotNull - public Permission getTemplatePermission() { - return template; - } - - @NotNull - public Permission getTemplateCreatePermission() { - return templateCreate; - } - - @NotNull - public Permission getTemplateDeletePermission() { - return templateDelete; - } - - @NotNull - public Permission getValuePermission() { - return value; - } - - @NotNull - public Permission getValueResetPermission() { - return valueReset; - } - - @NotNull - public Permission getValueCopyPermission() { - return valueCopy; - } - - @NotNull - public Permission getConfigEditPermission() { - return configEdit; - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/PlayerJoinListener.java b/ore-control/src/main/java/de/derfrzocker/ore/control/PlayerJoinListener.java deleted file mode 100644 index 81241611..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/PlayerJoinListener.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.spigot.utils.Permission; -import org.apache.commons.lang.Validate; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.jetbrains.annotations.NotNull; - -public class PlayerJoinListener implements Listener { - - @NotNull - private final Permission permission; - @NotNull - private final WelcomeMessage welcomeMessage; - - public PlayerJoinListener(@NotNull final Permission permission, @NotNull final WelcomeMessage welcomeMessage) { - Validate.notNull(permission, "Permission cannot be null"); - Validate.notNull(welcomeMessage, "WelcomeMessage cannot be null"); - - this.permission = permission; - this.welcomeMessage = welcomeMessage; - } - - @EventHandler(priority = EventPriority.MONITOR) - public void onPlayerJoin(PlayerJoinEvent playerJoinEvent) { - if (permission.hasPermission(playerJoinEvent.getPlayer())) { - welcomeMessage.sendDelayMessage(playerJoinEvent.getPlayer()); - } - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/Settings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/Settings.java deleted file mode 100644 index 3b6ca451..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/Settings.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.BiomeOreSettings; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreSettings; -import de.derfrzocker.spigot.utils.ReloadAble; -import de.derfrzocker.spigot.utils.Version; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.file.YamlConfiguration; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.logging.Logger; - -public class Settings implements ReloadAble { - - @NotNull - private final Supplier yamlSupplier; - @NotNull - private final Version version; - @NotNull - private final Logger logger; - @NotNull - private Map oreSettings = new HashMap<>(); - @NotNull - private Map biomeOreSettingsStorage = new HashMap<>(); - - public Settings(@NotNull final Supplier yamlSupplier, @NotNull final Version version, @NotNull final Logger logger) { - Validate.notNull(yamlSupplier, "YamlSupplier cannot be null"); - Validate.notNull(version, "Version cannot be null"); - Validate.notNull(logger, "Logger cannot be null"); - - this.yamlSupplier = yamlSupplier; - this.version = version; - this.logger = logger; - RELOAD_ABLES.add(this); - - reload(); - } - - @NotNull - public OreSettings getDefaultSettings(@NotNull final Ore ore) { - Validate.notNull(ore, "Ore cannot be null"); - - final OreSettings oreSettings = this.oreSettings.get(ore); - - if (oreSettings == null) { - throw new NoSuchDefaultOreSettingsException(ore, "There is no default OreSetting for the Ore '" + ore + "'"); - } - - return oreSettings; - } - - @NotNull - public OreSettings getDefaultSettings(@NotNull Biome biome, @NotNull final Ore ore) { - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - - final BiomeOreSettingsStorage biomeOreSettingsStorage = this.biomeOreSettingsStorage.get(biome); - - if (biomeOreSettingsStorage == null) { - return getDefaultSettings(ore); - } - - final OreSettings oreSettings = biomeOreSettingsStorage.getDefaultSettings(ore); - - if (oreSettings == null) { - return getDefaultSettings(ore); - } - - return oreSettings; - } - - @Override - public void reload() { - final YamlConfiguration yaml = yamlSupplier.get(); - final List oreSettings = yaml.getList("defaults.ore-settings"); - - final Map oreSettingsMap = new HashMap<>(); - final Map biomeOreSettingsStorageMap = new HashMap<>(); - - if (oreSettings == null) { - throw new IllegalArgumentException("The YamlConfiguration don't have a list under 'defaults.ore-settings'"); - } - - for (final Object oreSettingObject : oreSettings) { - if (!(oreSettingObject instanceof OreSettings)) { - throw new IllegalArgumentException("The object '" + oreSettingObject + "' is not an instance of OreSettings"); - } - - final OreSettings oreSetting = (OreSettings) oreSettingObject; - final Ore ore = oreSetting.getOre(); - - // ignoring ore-settings from ores which are not present in the version the server is running - if (version.isOlderThan(ore.getSince())) { - continue; - } - - final OreSettings otherOreSetting = oreSettingsMap.put(ore, oreSetting); - - if (otherOreSetting != null) { - logger.info("There are multiple OreSettings for the ore '" + ore + "' in the default Ore-Settings YamlConfiguration"); - logger.info("Old OreSetting: " + otherOreSetting); - logger.info("New OreSetting: " + oreSetting); - } - } - - final List biomeOreSettings = yaml.getList("defaults.biome-ore-settings"); - - if (biomeOreSettings == null) { - throw new IllegalArgumentException("The YamlConfiguration don't have a list under 'defaults.biome-ore-settings'"); - } - - for (final Object biomeOreSettingsObject : biomeOreSettings) { - if (!(biomeOreSettingsObject instanceof BiomeOreSettings)) { - throw new IllegalArgumentException("The object '" + biomeOreSettings + "' is not an instance of BiomeOreSettings"); - } - - final BiomeOreSettings biomeOreSetting = (BiomeOreSettings) biomeOreSettingsObject; - final Biome biome = biomeOreSetting.getBiome(); - - // ignoring biome-ore-settings from biomes which are not present in the version the server is running - if (version.isOlderThan(biome.getSince())) { - continue; - } - - if (biome.getUntil() != null && version.isNewerThan(biome.getUntil())) { - continue; - } - - final BiomeOreSettingsStorage biomeOreSettingsStorage = new BiomeOreSettingsStorage(biomeOreSetting.getOreSettings()); - final BiomeOreSettingsStorage otherBiomeOreSetting = biomeOreSettingsStorageMap.put(biome, biomeOreSettingsStorage); - - if (otherBiomeOreSetting != null) { - logger.info("There are multiple BiomeOreSettings for the biome '" + biome + "' in the default Biome-Ore-Settings YamlConfiguration"); - logger.info("Old BiomeOreSettings: " + otherBiomeOreSetting); - logger.info("New BiomeOreSettings: " + biomeOreSettingsStorage); - } - } - - this.oreSettings = oreSettingsMap; - this.biomeOreSettingsStorage = biomeOreSettingsStorageMap; - } - - private static final class BiomeOreSettingsStorage { - - private final Map oreSettings = new HashMap<>(); - - private BiomeOreSettingsStorage(@NotNull final Map oreSettingsMap) { - this.oreSettings.putAll(oreSettingsMap); - } - - @Nullable - private OreSettings getDefaultSettings(@NotNull final Ore ore) { - return this.oreSettings.get(ore); - } - - @Override - public String toString() { - return "BiomeOreSettingsStorage{" + - "oreSettings=" + oreSettings + - '}'; - } - - } - - public static final class NoSuchDefaultOreSettingsException extends RuntimeException { - - @NotNull - private final Ore ore; - - private NoSuchDefaultOreSettingsException(@NotNull Ore ore, final String message) { - super(message); - - this.ore = ore; - } - - @NotNull - public Ore getOre() { - return ore; - } - - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/WelcomeMessage.java b/ore-control/src/main/java/de/derfrzocker/ore/control/WelcomeMessage.java deleted file mode 100644 index 32d1b0c6..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/WelcomeMessage.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control; - -import de.derfrzocker.ore.control.utils.BaseComponentUtil; -import de.derfrzocker.spigot.utils.Language; -import de.derfrzocker.spigot.utils.Pair; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; -import org.apache.commons.lang.Validate; -import org.bukkit.command.CommandSender; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class WelcomeMessage { - - private final BaseComponent space = new TextComponent(" "); - @NotNull - private final Plugin plugin; - @NotNull - private final OreControlMessages messages; - - public WelcomeMessage(@NotNull final Plugin plugin, @NotNull final OreControlMessages messages) { - Validate.notNull(plugin, "Plugin cannot be null"); - Validate.notNull(messages, "OreControlMessages cannot be null"); - - this.plugin = plugin; - this.messages = messages; - } - - public void sendDelayMessage(@NotNull final CommandSender sender) { - sender.getServer().getScheduler().runTaskLater(plugin, () -> sendMessage(sender), 21); - } - - //TODO add link to a video tutorial - public void sendMessage(@NotNull final CommandSender sender) { - final BaseComponent[] welcome = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', messages.getWelcomeHeader().getRawMessage())); - final BaseComponent[] language = buildLanguageButtons(); - final BaseComponent[] foundBug = BaseComponentUtil.buildLineWithUrlButton(messages.getFoundBug().getRawMessage(), "GitHub", "https://github.com/DerFrZocker/Ore-Control/issues", messages); - final BaseComponent[] featureRequest = BaseComponentUtil.buildLineWithUrlButton(messages.getFeatureRequest().getRawMessage(), "GitHub", "https://github.com/DerFrZocker/Ore-Control/issues", messages); - final BaseComponent[] support = BaseComponentUtil.buildLineWithUrlButton(messages.getSupport().getRawMessage(), "Discord", "http://discord.derfrzocker.de", messages); - - final Map> buttonValues = new HashMap<>(); - buttonValues.put("rating", new Pair<>(messages.getRating().getRawMessage(), "https://www.spigotmc.org/resources/63621")); - buttonValues.put("donation", new Pair<>(messages.getDonation().getRawMessage(), "https://www.paypal.me/DerFrZocker")); - final BaseComponent[] supportMyWork = buildLineWithMultipleUrlButton(messages.getSupportMyWork().getRawMessage(), buttonValues); - - final BaseComponent[] notShowAgain = buildCommandButton(messages.getNotShowAgain().getRawMessage(), "/orecontrol welcome notShowAgain"); - - sender.spigot().sendMessage(welcome); - sender.spigot().sendMessage(language); - sender.spigot().sendMessage(foundBug); - sender.spigot().sendMessage(featureRequest); - sender.spigot().sendMessage(support); - sender.spigot().sendMessage(supportMyWork); - sender.spigot().sendMessage(notShowAgain); - } - - private BaseComponent[] buildLanguageButtons() { - - BaseComponent[] result = null; - - for (final Language language : Language.values()) { - final BaseComponent[] button = buildCommandButton(language.getNames()[0], "/orecontrol welcome language " + language.toString()); - - if (result == null) { - result = button; - } else { - result = BaseComponentUtil.combineBaseComponent(result, space); - result = BaseComponentUtil.combineBaseComponent(result, button); - } - } - - return result; - } - - // %%button:[rating]% - private BaseComponent[] buildLineWithMultipleUrlButton(String lineText, Map> buttonValues) { - - BaseComponent[] result = null; - - final Pattern pattern = Pattern.compile("%%button:(.*?)]%"); - final Matcher matcher = pattern.matcher(lineText); - int last = 0; - - final StringBuilder stringBuilder = new StringBuilder(lineText); - - while (matcher.find()) { - String key = stringBuilder.substring(matcher.start() + 10, matcher.end() - 2); - - Pair buttonValue = buttonValues.get(key); - - if (buttonValue == null) { - buttonValue = new Pair<>("not Found", "not Found"); - } - - final BaseComponent[] button = BaseComponentUtil.buildUrlButton(buttonValue.getFirst(), buttonValue.getSecond(), messages); - - if (matcher.start() == 0) { - result = button; - } else { - String textBefore = stringBuilder.substring(last, matcher.start()); - - final BaseComponent[] before = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', textBefore)); - - if (result == null) { - result = BaseComponentUtil.combineBaseComponent(before, button); - } else { - result = BaseComponentUtil.combineBaseComponent(result, before); - result = BaseComponentUtil.combineBaseComponent(result, button); - } - - } - - last = matcher.end(); - } - - if (stringBuilder.length() != last) { - final BaseComponent[] end = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', stringBuilder.substring(last))); - if (result == null) { - result = end; - } else { - result = BaseComponentUtil.combineBaseComponent(result, end); - } - } - - return result; - } - - private BaseComponent[] buildCommandButton(String text, String command) { - final BaseComponent[] begin = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', messages.getButtonOpenString().getRawMessage())); - final BaseComponent[] end = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', messages.getButtonCloseString().getRawMessage())); - - final BaseComponent[] buttons = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', text)); - final BaseComponent[] hoverEventMessage = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', messages.getClickMe().getRawMessage())); - final HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverEventMessage); - final ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, command); - - for (final BaseComponent button : buttons) { - button.setHoverEvent(hoverEvent); - button.setClickEvent(clickEvent); - } - - final BaseComponent[] first = BaseComponentUtil.combineBaseComponent(begin, buttons); - - return BaseComponentUtil.combineBaseComponent(first, end); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/CreateCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/CreateCommand.java deleted file mode 100644 index 2cb916be..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/CreateCommand.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command; - -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.command.CommandUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -public class CreateCommand implements TabExecutor { - - @NotNull - private final OreControlValues oreControlValues; - - public CreateCommand(@NotNull final OreControlValues oreControlValues) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - - this.oreControlValues = oreControlValues; - } - - @Override - public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) { - if (args.length != 1) { - oreControlValues.getOreControlMessages().getCommandCreateNotEnoughArgsMessage().sendMessage(sender); - return true; - } - - CommandUtil.runAsynchronously(sender, oreControlValues.getPlugin(), () -> { - final String configName = args[0]; - - final OreControlService service = oreControlValues.getService(); - - final World world = Bukkit.getWorld(configName); - - final Optional optionalWorldOreConfig = service.getWorldOreConfig(configName); - - if (optionalWorldOreConfig.isPresent() || world != null) { - oreControlValues.getOreControlMessages().getWorldConfigAlreadyExistsMessage().sendMessage(sender, new MessageValue("world-config", configName)); - return; - } - - service.createWorldOreConfigTemplate(configName); - - oreControlValues.getOreControlMessages().getCommandCreateSuccessMessage().sendMessage(sender, new MessageValue("world-config", configName)); - - }); - - return true; - } - - @Nullable - @Override - public List onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String alias, @NotNull final String[] args) { - return new ArrayList<>(); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/GuiCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/GuiCommand.java deleted file mode 100644 index bd2b7de7..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/GuiCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command; - -import de.derfrzocker.ore.control.gui.WorldGui; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import org.apache.commons.lang.Validate; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; - -public class GuiCommand implements TabExecutor { - - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final GuiSettings guiSettings; - - public GuiCommand(@NotNull final OreControlValues oreControlValues, @NotNull final GuiSettings guiSettings) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - Validate.notNull(guiSettings, "GuiSettings cannot be null"); - - this.oreControlValues = oreControlValues; - this.guiSettings = guiSettings; - } - - @Override - public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) { - if (!(sender instanceof Player)) { - oreControlValues.getOreControlMessages().getCommandPlayerOnlyMessage().sendMessage(sender); - return true; - } - - new WorldGui(guiSettings, oreControlValues, sender).openSync((Player) sender); - - return true; - } - - @Nullable - @Override - public List onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String alias, @NotNull final String[] args) { - return new ArrayList<>(); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/InfoCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/InfoCommand.java deleted file mode 100644 index a2179b2f..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/InfoCommand.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command; - -import de.derfrzocker.ore.control.utils.BaseComponentUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.command.CommandUtil; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.TextComponent; -import org.apache.commons.lang.Validate; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; - -public class InfoCommand implements TabExecutor { - - private final BaseComponent[] space = new BaseComponent[]{new TextComponent(" ")}; - - @NotNull - private final OreControlValues oreControlValues; - - public InfoCommand(@NotNull final OreControlValues oreControlValues) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - - this.oreControlValues = oreControlValues; - } - - @Override - public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) { - CommandUtil.runAsynchronously(sender, oreControlValues.getPlugin(), () -> { - - final BaseComponent[] source = BaseComponentUtil.buildUrlButton("Source", "https://github.com/DerFrZocker/Ore-Control", oreControlValues.getOreControlMessages()); - final BaseComponent[] discord = BaseComponentUtil.buildUrlButton("Discord", "http://discord.derfrzocker.de", oreControlValues.getOreControlMessages()); - final BaseComponent[] patreon = BaseComponentUtil.buildUrlButton("Patreon", "https://www.patreon.com/woollydevelopment", oreControlValues.getOreControlMessages()); - - final BaseComponent[] spaceSource = BaseComponentUtil.combineBaseComponent(space, source); - final BaseComponent[] spaceSourceSpace = BaseComponentUtil.combineBaseComponent(spaceSource, space); - final BaseComponent[] spaceSourceSpaceDiscord = BaseComponentUtil.combineBaseComponent(spaceSourceSpace, discord); - final BaseComponent[] spaceSourceSpaceDiscordSpace = BaseComponentUtil.combineBaseComponent(spaceSourceSpaceDiscord, space); - final BaseComponent[] spaceSourceSpaceDiscordSpacePatreon = BaseComponentUtil.combineBaseComponent(spaceSourceSpaceDiscordSpace, patreon); - - sender.sendMessage("------- " + ChatColor.BLUE + "Ore-Control" + ChatColor.RESET + " -------"); - sender.spigot().sendMessage(spaceSourceSpaceDiscordSpacePatreon); - sender.sendMessage(" "); - sender.sendMessage(" Version: " + ChatColor.BLUE + oreControlValues.getPlugin().getDescription().getVersion()); - sender.sendMessage(" Author: " + ChatColor.BLUE + oreControlValues.getPlugin().getDescription().getAuthors().iterator().next()); - sender.sendMessage(" "); - sender.sendMessage("------- " + ChatColor.BLUE + "Ore-Control" + ChatColor.RESET + " -------"); - }); - - return true; - } - - @Nullable - @Override - public List onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String alias, @NotNull final String[] args) { - return new ArrayList<>(); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/NoCommandsAvailableCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/NoCommandsAvailableCommand.java deleted file mode 100644 index d8abe7cd..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/NoCommandsAvailableCommand.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; - -public class NoCommandsAvailableCommand implements TabExecutor { - - @Override - public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) { - sender.sendMessage("It seems your are running a server jar, which does not contains the package 'net.md_5.bungee.api'"); - sender.sendMessage("This plugin requires this package for the commands and gui"); - sender.sendMessage("If no other error appears, than the plugin should work anyway (beside commands and gui)"); - sender.sendMessage("If you want to use the commands and gui, please use a server jar which contains the package 'net.md_5.bungee.api', such as Spigot (not CraftBukkit)"); - sender.sendMessage("After you have set the values, you can use the other server jar again"); - return true; - } - - @Nullable - @Override - public List onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String alias, @NotNull final String[] args) { - return new ArrayList<>(); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/OreControlCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/OreControlCommand.java deleted file mode 100644 index b749dc7c..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/OreControlCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command; - -import de.derfrzocker.ore.control.OreControlMessages; -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.PlayerJoinListener; -import de.derfrzocker.ore.control.WelcomeMessage; -import de.derfrzocker.ore.control.command.set.SetCommand; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.command.CommandSeparator; -import de.derfrzocker.spigot.utils.command.HelpCommand; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class OreControlCommand extends CommandSeparator { - - public OreControlCommand(@NotNull final OreControlValues oreControlValues, @NotNull final GuiSettings guiSettings, @Nullable final PlayerJoinListener playerJoinListener, @Nullable final WelcomeMessage welcomeMessage) { - super(oreControlValues.getPlugin()); - - final OreControlMessages oreControlMessages = oreControlValues.getOreControlMessages(); - final Permissions permissions = oreControlValues.getPermissions(); - - registerExecutor(new SetCommand(oreControlValues), "set", permissions.getSetPermission(), null, null); - registerExecutor(new CreateCommand(oreControlValues), "create", permissions.getTemplateCreatePermission(), oreControlMessages.getCommandCreateUsageMessage(), oreControlMessages.getCommandCreateDescriptionMessage()); - registerExecutor(new GuiCommand(oreControlValues, guiSettings), "", permissions.getGuiPermission(), null, null); - registerExecutor(new ReloadCommand(oreControlValues), "reload", permissions.getReloadPermission(), oreControlMessages.getCommandReloadUsageMessage(), oreControlMessages.getCommandReloadDescriptionMessage()); - - final HelpCommand helpCommand = new HelpCommand(this, oreControlMessages); - registerExecutor(helpCommand, "help", null, oreControlMessages.getCommandHelpUsageMessage(), oreControlMessages.getCommandHelpDescriptionMessage()); - registerExecutor(new InfoCommand(oreControlValues), "info", null, oreControlMessages.getCommandInfoUsageMessage(), oreControlMessages.getCommandInfoDescriptionMessage()); - - if (playerJoinListener == null || welcomeMessage == null) { - registerExecutor(helpCommand, null, null, oreControlMessages.getCommandHelpUsageMessage(), oreControlMessages.getCommandHelpDescriptionMessage()); - } else { - registerExecutor(new WelcomeCommand(helpCommand, oreControlValues, welcomeMessage, playerJoinListener), null, null, oreControlMessages.getCommandHelpUsageMessage(), oreControlMessages.getCommandHelpDescriptionMessage()); - } - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/ReloadCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/ReloadCommand.java deleted file mode 100644 index b920e749..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/ReloadCommand.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command; - -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.ReloadAble; -import de.derfrzocker.spigot.utils.command.CommandUtil; -import org.apache.commons.lang.Validate; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; - -public class ReloadCommand implements TabExecutor { - - @NotNull - private final OreControlValues oreControlValues; - - public ReloadCommand(@NotNull final OreControlValues oreControlValues) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - - this.oreControlValues = oreControlValues; - } - - @Override - public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) { - CommandUtil.runAsynchronously(sender, oreControlValues.getPlugin(), () -> { - oreControlValues.getOreControlMessages().getCommandReloadBeginMessage().sendMessage(sender); - - ReloadAble.RELOAD_ABLES.forEach(ReloadAble::reload); - - oreControlValues.getOreControlMessages().getCommandReloadEndMessage().sendMessage(sender); - }); - - return true; - } - - @Nullable - @Override - public List onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String alias, @NotNull final String[] args) { - return new ArrayList<>(); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/WelcomeCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/WelcomeCommand.java deleted file mode 100644 index 469460a7..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/WelcomeCommand.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command; - -import de.derfrzocker.ore.control.PlayerJoinListener; -import de.derfrzocker.ore.control.WelcomeMessage; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.Language; -import org.apache.commons.lang.Validate; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.bukkit.event.player.PlayerJoinEvent; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -public class WelcomeCommand implements TabExecutor { - - @NotNull - private final TabExecutor tabExecutor; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final WelcomeMessage welcomeMessage; - @NotNull - private final PlayerJoinListener playerJoinListener; - - public WelcomeCommand(@NotNull final TabExecutor tabExecutor, @NotNull final OreControlValues oreControlValues, @NotNull final WelcomeMessage welcomeMessage, @NotNull final PlayerJoinListener playerJoinListener) { - Validate.notNull(tabExecutor, "TabExecutor cannot be null"); - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - Validate.notNull(welcomeMessage, "WelcomeMessage cannot be null"); - Validate.notNull(playerJoinListener, "PlayerJoinListener cannot be null"); - - this.tabExecutor = tabExecutor; - this.oreControlValues = oreControlValues; - this.welcomeMessage = welcomeMessage; - this.playerJoinListener = playerJoinListener; - } - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (args.length < 2 || args.length > 3) { - return tabExecutor.onCommand(sender, command, label, args); - } - - if (!args[0].equals("welcome")) { - return tabExecutor.onCommand(sender, command, label, args); - } - - final String argTwo = args[1]; - - if (argTwo.equals("language")) { - if (args.length != 3) { - return tabExecutor.onCommand(sender, command, label, args); - } - try { - - final Language language = Language.valueOf(args[2]); - oreControlValues.getConfigValues().SET.setLanguage(language); - - //send 12 empty lines for a better visual appearance - for (int i = 0; i < 12; i++) { - sender.sendMessage(" "); - } - - welcomeMessage.sendMessage(sender); - - return true; - } catch (final IllegalArgumentException e) { - return tabExecutor.onCommand(sender, command, label, args); - } - } - - if (argTwo.equals("notShowAgain")) { - if (args.length != 2) { - return tabExecutor.onCommand(sender, command, label, args); - } - - oreControlValues.getConfigValues().SET.setShowWelcomeMessage(false); - PlayerJoinEvent.getHandlerList().unregister(playerJoinListener); - - oreControlValues.getOreControlMessages().getNotShowAgainSuccess().sendMessage(sender); - return false; - } - - return tabExecutor.onCommand(sender, command, label, args); - } - - @Nullable - @Override - public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) { - return tabExecutor.onTabComplete(sender, command, alias, args); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetBiomeCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetBiomeCommand.java deleted file mode 100644 index 5169cf80..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetBiomeCommand.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command.set; - -import de.derfrzocker.ore.control.OreControlMessages; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.utils.OreControlUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.command.CommandUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Stream; - -public class SetBiomeCommand implements TabExecutor { //TODO "merge" set and setbiome command - - @NotNull - private final OreControlValues oreControlValues; - - public SetBiomeCommand(@NotNull final OreControlValues oreControlValues) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - - this.oreControlValues = oreControlValues; - } - - @Override - public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) { - if (args.length != 5) { - oreControlValues.getOreControlMessages().getCommandSetBiomeNotEnoughArgsMessage().sendMessage(sender); - return true; - } - - CommandUtil.runAsynchronously(sender, oreControlValues.getPlugin(), () -> { - final String biomeName = args[0]; - final String oreName = args[1]; - final String settingName = args[2]; - final String configName = args[3]; - String amount = args[4]; - final boolean translated = oreControlValues.getConfigValues().isTranslateTabCompilation(); - final OreControlMessages messages = oreControlValues.getOreControlMessages(); - - final Optional optionalBiome = OreControlUtil.getBiome(biomeName, translated, oreControlValues.getVersion()); - - if (!optionalBiome.isPresent()) { - messages.getBiomeNotFoundMessage().sendMessage(sender, new MessageValue("biome", biomeName)); - return; - } - - final Biome biome = optionalBiome.get(); - - final Optional optionalOre = OreControlUtil.getOre(oreName, translated); - - if (!optionalOre.isPresent()) { - messages.getOreNotFoundMessage().sendMessage(sender, new MessageValue("ore", oreName)); - return; - } - - final Ore ore = optionalOre.get(); - - if (Stream.of(biome.getOres()).noneMatch(value -> value == ore)) { - messages.getOreNotValidMessage().sendMessage(sender, new MessageValue("ore", oreName), new MessageValue("biome", biomeName)); - return; - } - - final Optional optionalSetting = OreControlUtil.getSetting(settingName, translated); - - if (!optionalSetting.isPresent()) { - messages.getSettingNotFoundMessage().sendMessage(sender, new MessageValue("setting", settingName)); - return; - } - - final Setting setting = optionalSetting.get(); - - if (Stream.of(ore.getSettings()).noneMatch(value -> value == setting)) { - messages.getSettingNotValidMessage().sendMessage(sender, new MessageValue("setting", settingName), new MessageValue("ore", oreName)); - return; - } - - final OreControlService service = oreControlValues.getService(); - - final World world = Bukkit.getWorld(configName); - - final Optional optionalWorldOreConfig = service.getWorldOreConfig(configName); - - if (!optionalWorldOreConfig.isPresent() && world == null) { - messages.getWorldConfigNotFoundMessage().sendMessage(sender, new MessageValue("world-config", configName)); - return; - } - - final WorldOreConfig worldOreConfig = optionalWorldOreConfig.orElseGet(() -> service.createWorldOreConfig(world)); - - double value; - boolean percents = false; - - if (amount.endsWith("%")) { - amount = amount.replace("%", ""); - percents = true; - } - - try { - value = Double.parseDouble(amount); - } catch (final NumberFormatException e) { - messages.getNumberNotValidMessage().sendMessage(sender, new MessageValue("value", amount)); - return; - } - - final int value2 = percents ? (int) (service.getDefaultValue(biome, ore, setting) * (value / 100)) : (int) value; - - if (OreControlUtil.isUnSafe(setting, value2)) { - if (oreControlValues.getConfigValues().isSafeMode()) { - messages.getNumberNotSafeMessage().sendMessage(sender, new MessageValue("value", String.valueOf(value2))); - return; - } - messages.getNumberNotSafeWarningMessage().sendMessage(sender, new MessageValue("value", String.valueOf(value2))); - } - - service.setValue(worldOreConfig, biome, ore, setting, value2); - - service.saveWorldOreConfig(worldOreConfig); - messages.getCommandSetBiomeSuccessMessage().sendMessage(sender); - }); - - return true; - } - - @Nullable - @Override - public List onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String alias, @NotNull final String[] args) { - final List list = new ArrayList<>(); - final boolean translated = oreControlValues.getConfigValues().isTranslateTabCompilation(); - - if (args.length == 1) { - final String biomeName = args[0].toUpperCase(); - - if (translated) { - OreControlUtil.getTranslatedBiomes().values().stream().filter(value -> value.startsWith(biomeName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - Stream.of(Biome.values()).map(Enum::toString).filter(value -> value.contains(biomeName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - if (args.length == 2) { - final Optional biome = OreControlUtil.getBiome(args[0], translated, oreControlValues.getVersion()); - - if (!biome.isPresent()) { - return list; - } - - final String oreName = args[1].toUpperCase(); - - if (translated) { - OreControlUtil.getTranslatedOres(biome.get().getOres()).values().stream().filter(value -> value.startsWith(oreName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - Stream.of(biome.get().getOres()).map(Enum::toString).filter(value -> value.startsWith(oreName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - if (args.length == 3) { - final Optional biome = OreControlUtil.getBiome(args[0], translated, oreControlValues.getVersion()); - - if (!biome.isPresent()) { - return list; - } - - final Optional ore = OreControlUtil.getOre(args[1], translated, biome.get().getOres()); - - if (!ore.isPresent()) { - return list; - } - - final String settingName = args[2].toUpperCase(); - - if (translated) { - OreControlUtil.getTranslatedSettings(ore.get().getSettings()).values().stream().filter(value -> value.startsWith(settingName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - Stream.of(ore.get().getSettings()).map(Enum::toString).filter(value -> value.startsWith(settingName)).map(String::toLowerCase).forEach(list::add); - - return list; - } - - if (args.length == 4) { - final Optional biome = OreControlUtil.getBiome(args[0], translated, oreControlValues.getVersion()); - - if (!biome.isPresent()) { - return list; - } - - final Optional ore = OreControlUtil.getOre(args[1], translated, biome.get().getOres()); - - if (!ore.isPresent()) { - return list; - } - - if (!OreControlUtil.getSetting(args[2], translated, ore.get().getSettings()).isPresent()) { - return list; - } - - final String worldName = args[3].toLowerCase(); - - Bukkit.getWorlds().stream().map(World::getName).filter(value -> value.toLowerCase().startsWith(worldName)).forEach(list::add); - oreControlValues.getService().getAllWorldOreConfigs().stream().filter(value -> !list.contains(value.getName())).map(WorldOreConfig::getName).forEach(list::add); - - return list; - } - - if (args.length == 5) { - final Optional biome = OreControlUtil.getBiome(args[0], translated, oreControlValues.getVersion()); - - if (!biome.isPresent()) { - return list; - } - - final Optional ore = OreControlUtil.getOre(args[1], translated, biome.get().getOres()); - - if (!ore.isPresent()) { - return list; - } - - final Optional setting = OreControlUtil.getSetting(args[2], translated, ore.get().getSettings()); - - if (!setting.isPresent()) { - return list; - } - - final World world = Bukkit.getWorld(args[3]); - - final OreControlService service = oreControlValues.getService(); - final Optional worldOreConfig = service.getWorldOreConfig(args[3]); - - if (!worldOreConfig.isPresent() && world == null) { - return list; - } - - if (!worldOreConfig.isPresent()) { - list.add("current: " + service.getDefaultValue(biome.get(), ore.get(), setting.get())); - return list; - } - - list.add("current: " + service.getValue(worldOreConfig.get(), biome.get(), ore.get(), setting.get())); - - return list; - } - - return list; - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetCommand.java deleted file mode 100644 index af1acbec..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetCommand.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command.set; - -import de.derfrzocker.ore.control.OreControlMessages; -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.command.CommandSeparator; -import de.derfrzocker.spigot.utils.command.HelpCommand; -import org.jetbrains.annotations.NotNull; - -public class SetCommand extends CommandSeparator { - - public SetCommand(@NotNull final OreControlValues oreControlValues) { - super(oreControlValues.getPlugin()); - - final OreControlMessages messages = oreControlValues.getOreControlMessages(); - final Permissions permissions = oreControlValues.getPermissions(); - - registerExecutor(new SetValueCommand(oreControlValues), "value", permissions.getSetValuePermission(), messages.getCommandSetValueUsageMessage(), messages.getCommandSetValueDescriptionMessage()); - registerExecutor(new SetBiomeCommand(oreControlValues), "biome", permissions.getSetBiomePermission(), messages.getCommandSetBiomeUsageMessage(), messages.getCommandSetBiomeDescriptionMessage()); - - final HelpCommand helpCommand = new HelpCommand(this, messages); - registerExecutor(helpCommand, "help", null, null, null); - registerExecutor(helpCommand, null, null, null, null); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetValueCommand.java b/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetValueCommand.java deleted file mode 100644 index 6fb31d25..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/command/set/SetValueCommand.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.command.set; - -import de.derfrzocker.ore.control.OreControlMessages; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.utils.BaseComponentUtil; -import de.derfrzocker.ore.control.utils.OreControlUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.command.CommandUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import net.md_5.bungee.api.chat.BaseComponent; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabExecutor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Stream; - -public class SetValueCommand implements TabExecutor { //TODO "merge" set and setbiome command - - @NotNull - private final OreControlValues oreControlValues; - - public SetValueCommand(@NotNull final OreControlValues oreControlValues) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - - this.oreControlValues = oreControlValues; - } - - @Override - public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) { - if (args.length != 4) { - oreControlValues.getOreControlMessages().getCommandSetValueNotEnoughArgsMessage().sendMessage(sender); - return true; - } - - CommandUtil.runAsynchronously(sender, oreControlValues.getPlugin(), () -> { - final String oreName = args[0]; - final String settingName = args[1]; - final String configName = args[2]; - String amount = args[3]; - final boolean translated = oreControlValues.getConfigValues().isTranslateTabCompilation(); - final OreControlMessages messages = oreControlValues.getOreControlMessages(); - - final Optional optionalOre = OreControlUtil.getOre(oreName, translated); - - if (!optionalOre.isPresent()) { - messages.getOreNotFoundMessage().sendMessage(sender, new MessageValue("ore", oreName)); - return; - } - - final Ore ore = optionalOre.get(); - - final Optional optionalSetting = OreControlUtil.getSetting(settingName, translated); - - if (!optionalSetting.isPresent()) { - messages.getSettingNotFoundMessage().sendMessage(sender, new MessageValue("setting", settingName)); - return; - } - - final Setting setting = optionalSetting.get(); - - if (Stream.of(ore.getSettings()).noneMatch(value -> value == setting)) { - messages.getSettingNotValidMessage().sendMessage(sender, new MessageValue("setting", settingName), new MessageValue("ore", oreName)); - return; - } - - final OreControlService service = oreControlValues.getService(); - - final World world = Bukkit.getWorld(configName); - - final Optional optionalWorldOreConfig = service.getWorldOreConfig(configName); - - if (!optionalWorldOreConfig.isPresent() && world == null) { - messages.getWorldConfigNotFoundMessage().sendMessage(sender, new MessageValue("world-config", configName)); - return; - } - - final WorldOreConfig worldOreConfig = optionalWorldOreConfig.orElseGet(() -> service.createWorldOreConfig(world)); - - double value; - boolean percents = false; - - if (amount.endsWith("%")) { - amount = amount.replace("%", ""); - percents = true; - } - - try { - value = Double.parseDouble(amount); - } catch (final NumberFormatException e) { - messages.getNumberNotValidMessage().sendMessage(sender, new MessageValue("value", amount)); - return; - } - - final double value2 = percents ? (service.getDefaultValue(ore, setting) * (value / 100)) : value; - - if (OreControlUtil.isUnSafe(setting, value2) || (setting == Setting.VEIN_SIZE && value2 <= 2.001)) { - if (oreControlValues.getConfigValues().isSafeMode()) { - messages.getNumberNotSafeMessage().sendMessage(sender, new MessageValue("value", String.valueOf(value2))); - if ((setting == Setting.VEIN_SIZE && value2 <= 2.001)) { - sendSeeAlso(sender); - } - return; - } - messages.getNumberNotSafeWarningMessage().sendMessage(sender, new MessageValue("value", String.valueOf(value2))); - if ((setting == Setting.VEIN_SIZE && value2 <= 2.001)) { - sendSeeAlso(sender); - } - } - - service.setValue(worldOreConfig, ore, setting, value2); - - service.saveWorldOreConfig(worldOreConfig); - messages.getCommandSetValueSuccessMessage().sendMessage(sender); - }); - - return true; - } - - @Nullable - @Override - public List onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String alias, @NotNull final String[] args) { - final List list = new ArrayList<>(); - final boolean translated = oreControlValues.getConfigValues().isTranslateTabCompilation(); - - if (args.length == 1) { - final String oreName = args[0].toUpperCase(); - - if (translated) { - OreControlUtil.getTranslatedOres().values().stream().filter(value -> value.startsWith(oreName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - Stream.of(Ore.values()).map(Enum::toString).filter(value -> value.startsWith(oreName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - if (args.length == 2) { - final Optional ore = OreControlUtil.getOre(args[0], translated); - - if (!ore.isPresent()) { - return list; - } - - final String settingName = args[1].toUpperCase(); - - if (translated) { - OreControlUtil.getTranslatedSettings(ore.get().getSettings()).values().stream().filter(value -> value.startsWith(settingName)).map(String::toLowerCase).forEach(list::add); - return list; - } - - Stream.of(ore.get().getSettings()).map(Enum::toString).filter(value -> value.startsWith(settingName)).map(String::toLowerCase).forEach(list::add); - - return list; - } - - if (args.length == 3) { - final Optional ore = OreControlUtil.getOre(args[0], translated); - - if (!ore.isPresent()) { - return list; - } - - if (!OreControlUtil.getSetting(args[1], translated, ore.get().getSettings()).isPresent()) - return list; - - final String configName = args[2].toLowerCase(); - - Bukkit.getWorlds().stream().map(World::getName).filter(value -> value.toLowerCase().startsWith(configName)).forEach(list::add); - oreControlValues.getService().getAllWorldOreConfigs().stream().filter(value -> !list.contains(value.getName())).map(WorldOreConfig::getName).forEach(list::add); - - return list; - } - - if (args.length == 4) { - final Optional ore = OreControlUtil.getOre(args[0], translated); - - if (!ore.isPresent()) { - return list; - } - - final Optional setting = OreControlUtil.getSetting(args[1], translated, ore.get().getSettings()); - - if (!setting.isPresent()) { - return list; - } - - final World world = Bukkit.getWorld(args[2]); - - final OreControlService service = oreControlValues.getService(); - final Optional worldOreConfig = service.getWorldOreConfig(args[2]); - - if (!worldOreConfig.isPresent() && world == null) { - return list; - } - - if (!worldOreConfig.isPresent()) { - list.add("current: " + service.getDefaultValue(ore.get(), setting.get())); - return list; - } - - list.add("current: " + service.getValue(worldOreConfig.get(), ore.get(), setting.get())); - - return list; - } - - return list; - } - - private void sendSeeAlso(CommandSender commandSender) { - BaseComponent[] message = BaseComponentUtil.buildLineWithUrlButton(oreControlValues.getOreControlMessages().getNumberNotSafeSeeAlso().getRawMessage(), "GitHub", "https://github.com/DerFrZocker/Ore-Control/wiki/Vein-Size", oreControlValues.getOreControlMessages()); - commandSender.spigot().sendMessage(message); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGroupGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGroupGui.java deleted file mode 100644 index 8f9be9bc..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGroupGui.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Dimension; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.gui.settings.BiomeGuiSettings; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.OreControlUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.Config; -import de.derfrzocker.spigot.utils.ReloadAble; -import de.derfrzocker.spigot.utils.gui.PageGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class BiomeGroupGui extends PageGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final WorldOreConfig worldOreConfig; - @Nullable - private final Dimension dimension; - @NotNull - private final BiomeGroups biomeGroups; - - BiomeGroupGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Dimension dimension) { - super(oreControlValues.getPlugin(), guiSettings.getBiomeGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.dimension = dimension; - this.biomeGroups = new BiomeGroups(oreControlValues.getPlugin()); - - final BiomeGuiSettings biomeGuiSettings = guiSettings.getBiomeGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - - addDecorations(); - init(biomeGroups.getGroups(), BiomeGroup[]::new, this::getItemStack, this::handleNormalClick); - - addItem(biomeGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getInfoItemStack(), getMessagesValues())); - addItem(biomeGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getBackItemStack()), event -> new WorldConfigGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension).openSync(event.getWhoClicked())); - addItem(biomeGuiSettings.getBiomeGroupSwitchSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getBiomeItemStack()), event -> new BiomeGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension).openSync(event.getWhoClicked())); - } - - private ItemStack getItemStack(@NotNull final BiomeGroup biomeGroup) { - return MessageUtil.replaceItemStack(getPlugin(), guiSettings.getBiomeGuiSettings().getBiomeItemStack(biomeGroup.getName().toUpperCase()), new MessageValue("reset-copy", "")); - } - - private void handleNormalClick(@NotNull final BiomeGroup biomeGroup, @NotNull final InventoryClickEvent event) { - new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup).openSync(event.getWhoClicked()); - } - - private MessageValue[] getMessagesValues() { - return new MessageValue[]{new MessageValue("world", worldOreConfig.getName())}; - } - - private class BiomeGroups implements ReloadAble { - - private final static String FILE = "data/gui/biome-groups.yml"; - - @NotNull - private final Plugin plugin; - @NotNull - private YamlConfiguration yaml; - - private BiomeGroups(@NotNull final Plugin plugin) { - Validate.notNull(plugin, "Plugin cannot be null"); - - this.plugin = plugin; - - yaml = Config.getConfig(plugin, FILE); - RELOAD_ABLES.add(this); - } - - private BiomeGroup[] getGroups() { - final ConfigurationSection section = yaml.getConfigurationSection("biome-groups"); - - return section.getKeys(false).stream().map(string -> { - final Set biomeSet = new HashSet<>(); - - final List stringList = section.getStringList(string); - - stringList.forEach(biomeName -> OreControlUtil.getBiome(biomeName, false, oreControlValues.getVersion()).ifPresent(biomeSet::add)); - - return new BiomeGroup(string, biomeSet); - }).toArray(BiomeGroup[]::new); - } - - @Override - public void reload() { - yaml = new Config(Objects.requireNonNull(plugin.getResource(FILE), "InputStream cannot be null")); - } - - } - - static final class BiomeGroup { - - @NotNull - private final String name; - @NotNull - private final Set biomes; - - BiomeGroup(@NotNull final String name, @NotNull final Set biomes) { - Validate.notNull(name, "Name cannot be null"); - Validate.notNull(biomes, "Biomes cannot be null"); - - this.name = name; - this.biomes = biomes; - } - - @NotNull - Set getBiomes() { - return biomes; - } - - @NotNull - String getName() { - return name; - } - - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGui.java deleted file mode 100644 index 9f39932f..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/BiomeGui.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui; - -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Dimension; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.gui.copy.CopyAction; -import de.derfrzocker.ore.control.gui.copy.CopyBiomesAction; -import de.derfrzocker.ore.control.gui.settings.BiomeGuiSettings; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.ore.control.utils.ResetUtil; -import de.derfrzocker.spigot.utils.gui.PageGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.apache.commons.lang.Validate; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.LinkedHashSet; -import java.util.Set; - -public class BiomeGui extends PageGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final WorldOreConfig worldOreConfig; - @Nullable - private final Dimension dimension; - @Nullable - private final CopyAction copyAction; - - BiomeGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Dimension dimension) { - super(oreControlValues.getPlugin(), guiSettings.getBiomeGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.dimension = dimension; - this.copyAction = null; - - final BiomeGuiSettings biomeGuiSettings = guiSettings.getBiomeGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Permissions permissions = oreControlValues.getPermissions(); - final Set biomes = new LinkedHashSet<>(); - - for (final Biome biome : Biome.values()) { - if (oreControlValues.getVersion().isOlderThan(biome.getSince())) { - continue; - } - - if (biome.getUntil() != null && oreControlValues.getVersion().isNewerThan(biome.getUntil())) { - continue; - } - - if (dimension != null && biome.getDimension() != dimension) { - continue; - } - - biomes.add(biome); - } - - addDecorations(); - init(biomes.toArray(new Biome[0]), Biome[]::new, this::getItemStack, this::handleNormalClick); - - addItem(biomeGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getInfoItemStack(), getMessagesValues())); - addItem(biomeGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getBackItemStack()), event -> new WorldConfigGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension).openSync(event.getWhoClicked())); - - if (dimension == null || dimension == Dimension.OVERWORLD) { //TODO check biome groups for place able - addItem(biomeGuiSettings.getBiomeGroupSwitchSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getBiomeGroupItemStack()), event -> new BiomeGroupGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension).openSync(event.getWhoClicked())); - } - - if (permissions.getValueResetPermission().hasPermission(permissible)) { - addItem(biomeGuiSettings.getResetValueSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getResetValueItemStack()), this::handleResetValues); - } - - if (permissions.getValueCopyPermission().hasPermission(permissible)) { - addItem(biomeGuiSettings.getCopyValueSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getCopyValueItemStack()), - event -> new WorldGui(guiSettings, oreControlValues, new CopyBiomesAction(oreControlValues, - () -> new BiomeGui(guiSettings, oreControlValues, permissible, worldOreConfig, dimension), worldOreConfig, Biome.values())). - openSync(event.getWhoClicked())); - } - } - - public BiomeGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @NotNull CopyAction copyAction) { - super(oreControlValues.getPlugin(), guiSettings.getBiomeGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(copyAction, "CopyAction cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.dimension = null; - this.copyAction = copyAction; - - final BiomeGuiSettings biomeGuiSettings = guiSettings.getBiomeGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Set biomes = new LinkedHashSet<>(); - - for (final Biome biome : Biome.values()) { - if (oreControlValues.getVersion().isOlderThan(biome.getSince())) { - continue; - } - - if (biome.getUntil() != null && oreControlValues.getVersion().isNewerThan(biome.getUntil())) { - continue; - } - - if (copyAction.shouldSet(biome)) { - biomes.add(biome); - } - } - - addDecorations(); - init(biomes.toArray(new Biome[0]), Biome[]::new, this::getItemStack, this::handleCopyAction); - - addItem(biomeGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getBackItemStack()), event -> copyAction.back(event.getWhoClicked())); - addItem(biomeGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biomeGuiSettings.getInfoItemStack(), getMessagesValues())); - addItem(biomeGuiSettings.getAbortSlot(), MessageUtil.replaceItemStack(getPlugin(), biomeGuiSettings.getAbortItemStack()), (event) -> copyAction.abort(event.getWhoClicked())); - } - - private ItemStack getItemStack(@NotNull final Biome biome) { - return MessageUtil.replaceItemStack(getPlugin(), guiSettings.getBiomeGuiSettings().getBiomeItemStack(biome.toString()), new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - } - - private void handleNormalClick(@NotNull final Biome biome, @NotNull final InventoryClickEvent event) { - new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome).openSync(event.getWhoClicked()); - } - - private void handleCopyAction(@NotNull final Biome biome, @NotNull final InventoryClickEvent event) { - copyAction.setBiomeTarget(biome); - copyAction.next(event.getWhoClicked(), () -> new BiomeGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, copyAction)); - } - - private void handleResetValues(@NotNull final InventoryClickEvent event) { - if (oreControlValues.getConfigValues().verifyResetAction()) { - VerifyGui verifyGui = new VerifyGui(getPlugin(), clickEvent -> { - for (Biome biome : Biome.values()) { - ResetUtil.reset(this.worldOreConfig, biome); - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - }, clickEvent1 -> openSync(event.getWhoClicked())); - - verifyGui.addDecorations(); - - verifyGui.openSync(event.getWhoClicked()); - return; - } - - for (final Biome biome : Biome.values()) { - ResetUtil.reset(this.worldOreConfig, biome); - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - } - - private MessageValue[] getMessagesValues() { - return new MessageValue[]{new MessageValue("world", worldOreConfig.getName())}; - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreGui.java deleted file mode 100644 index 60041754..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreGui.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui; - -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.gui.copy.CopyAction; -import de.derfrzocker.ore.control.gui.copy.CopyOresAction; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.gui.settings.OreGuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.ore.control.utils.ResetUtil; -import de.derfrzocker.spigot.utils.gui.PageGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import de.derfrzocker.spigot.utils.message.MessageKey; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.apache.commons.lang.Validate; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Stream; - -public class OreGui extends PageGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final WorldOreConfig worldOreConfig; - @Nullable - private final Biome biome; - @Nullable - private final BiomeGroupGui.BiomeGroup biomeGroup; - @Nullable - private final Dimension dimension; - @Nullable - private final CopyAction copyAction; - - OreGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Dimension dimension, @Nullable final Biome biome) { - super(oreControlValues.getPlugin(), guiSettings.getOreGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.biome = biome; - this.biomeGroup = null; - this.dimension = dimension; - this.copyAction = null; - - addDecorations(); - - final OreGuiSettings oreGuiSettings = guiSettings.getOreGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Permissions permissions = oreControlValues.getPermissions(); - final Set ores = new LinkedHashSet<>(); - - for (final Ore ore : biome == null ? Ore.values() : biome.getOres()) { - if (dimension != null && ore.getDimension() != dimension) { - continue; - } - - if (oreControlValues.getVersion().isOlderThan(ore.getSince())) { - continue; - } - - ores.add(ore); - } - - init(ores.toArray(new Ore[0]), Ore[]::new, this::getOreItemStack, (ore, event) -> { - new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome, ore).openSync(event.getWhoClicked()); - }); - - addItem(oreGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, oreGuiSettings.getBackItemStack()), - event -> (biome == null ? new WorldConfigGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension) : new BiomeGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension)).openSync(event.getWhoClicked())); - - addItem(oreGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biome == null ? oreGuiSettings.getInfoItemStack() : oreGuiSettings.getInfoBiomeItemStack(), getMessagesValues())); - - if (permissions.getValueResetPermission().hasPermission(permissible)) { - addItem(oreGuiSettings.getResetValueSlot(), MessageUtil.replaceItemStack(plugin, oreGuiSettings.getResetValueItemStack()), this::handleResetValues); - } - - if (permissions.getValueCopyPermission().hasPermission(permissible)) { - addItem(oreGuiSettings.getCopyValueSlot(), MessageUtil.replaceItemStack(plugin, oreGuiSettings.getCopyValueItemStack()), - event -> new WorldGui(guiSettings, oreControlValues, new CopyOresAction(guiSettings, oreControlValues, - () -> new OreGui(guiSettings, oreControlValues, permissible, worldOreConfig, dimension, biome), worldOreConfig, biome, biome == null ? Ore.values() : biome.getOres())). - openSync(event.getWhoClicked())); - } - - } - - public OreGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Biome biome, @NotNull final CopyAction copyAction) { - super(oreControlValues.getPlugin(), guiSettings.getOreGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(copyAction, "CopyAction cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.biome = biome; - this.biomeGroup = null; - this.dimension = null; - this.copyAction = copyAction; - - addDecorations(); - - final OreGuiSettings oreGuiSettings = guiSettings.getOreGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Set ores = new LinkedHashSet<>(); - - for (final Ore ore : biome == null ? Ore.values() : biome.getOres()) { - if (oreControlValues.getVersion().isOlderThan(ore.getSince())) { - continue; - } - - if (biome == null) { - if (copyAction.shouldSet(ore)) { - ores.add(ore); - } - } else if (copyAction.shouldSet(ore, biome)) { - ores.add(ore); - } - } - - final Ore[] oresArray = ores.toArray(new Ore[0]); - - init(oresArray, Ore[]::new, this::getOreItemStack, (ore, event) -> { - copyAction.setOreTarget(ore); - - copyAction.next(event.getWhoClicked(), () -> new OreGui(guiSettings, oreControlValues, permissible, worldOreConfig, biome, copyAction)); - }); - - addItem(oreGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, oreGuiSettings.getBackItemStack()), event -> copyAction.back(event.getWhoClicked())); - addItem(oreGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biome == null ? oreGuiSettings.getInfoItemStack() : oreGuiSettings.getInfoBiomeItemStack(), getMessagesValues())); - addItem(oreGuiSettings.getAbortSlot(), MessageUtil.replaceItemStack(getPlugin(), oreGuiSettings.getAbortItemStack()), (event) -> copyAction.abort(event.getWhoClicked())); - } - - OreGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Dimension dimension, @NotNull final BiomeGroupGui.BiomeGroup biomeGroup) { - super(oreControlValues.getPlugin(), guiSettings.getOreGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(biomeGroup, "BiomeGroup cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.biome = null; - this.biomeGroup = biomeGroup; - this.dimension = dimension; - this.copyAction = null; - - addDecorations(); - - final OreGuiSettings oreGuiSettings = guiSettings.getOreGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Set ores = new LinkedHashSet<>(); - - biomeGroup.getBiomes().stream().map(Biome::getOres).flatMap(Stream::of).distinct().filter(ore -> dimension == null || ore.getDimension() == dimension).filter(ore -> !oreControlValues.getVersion().isOlderThan(ore.getSince())).forEach(ores::add); - - final Ore[] oresArray = ores.toArray(new Ore[0]); - - init(oresArray, Ore[]::new, this::getOreItemStack, (ore, event) -> { - new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup, ore).openSync(event.getWhoClicked()); - }); - - - addItem(oreGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, oreGuiSettings.getInfoBiomeItemStack(), getMessagesValues())); - addItem(oreGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, oreGuiSettings.getBackItemStack()), - event -> new BiomeGroupGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension).openSync(event.getWhoClicked())); - } - - private MessageValue[] getMessagesValues() { - return new MessageValue[]{new MessageValue("world", worldOreConfig.getName()), - new MessageValue("biome", biome == null ? biomeGroup == null ? "" : biomeGroup.getName() : biome.toString())}; - } - - private void handleResetValues(@NotNull final InventoryClickEvent event) { - if (oreControlValues.getConfigValues().verifyResetAction()) { - VerifyGui verifyGui = new VerifyGui(getPlugin(), clickEvent -> { - if (biome != null) { - for (Ore ore : biome.getOres()) { - ResetUtil.reset(worldOreConfig, ore, biome); - } - } else { - for (Ore ore : Ore.values()) { - ResetUtil.reset(worldOreConfig, ore); - } - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - - if (biomeGroup == null) { - new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome).openSync(event.getWhoClicked()); - } else { - new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup).openSync(event.getWhoClicked()); - } - }, clickEvent1 -> openSync(event.getWhoClicked())); - - verifyGui.addDecorations(); - - verifyGui.openSync(event.getWhoClicked()); - return; - } - if (biome != null) { - for (final Ore ore : biome.getOres()) { - ResetUtil.reset(worldOreConfig, ore, biome); - } - } else { - for (final Ore ore : Ore.values()) { - ResetUtil.reset(worldOreConfig, ore); - } - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - - if (biomeGroup == null) { - new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome).openSync(event.getWhoClicked()); - } else { - new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup).openSync(event.getWhoClicked()); - } - } - - private ItemStack getOreItemStack(@NotNull final Ore ore) { - OreControlService service = oreControlValues.getService(); - ItemStack itemStack = guiSettings.getOreGuiSettings().getDefaultOreItemStack(); - - itemStack.setType(ore.getMaterial()); - - ItemMeta itemMeta = itemStack.getItemMeta(); - - if (itemMeta != null) { - if (itemMeta.hasLore()) { - List oldLore = itemMeta.getLore(); - List newLore = new ArrayList<>(); - for (String line : oldLore) { - if (line.contains("%%settings%")) { - - for (Setting setting : ore.getSettings()) { - String settingName = new MessageKey(getPlugin(), "setting." + setting.toString()).getMessage(); - String value; - if (biome == null) { - if (biomeGroup == null) { - value = String.valueOf(service.getValue(worldOreConfig, ore, setting)); - } else { - value = "N/A"; - } - } else { - value = String.valueOf(service.getValue(worldOreConfig, biome, ore, setting)); - } - newLore.add(line. - replace("%%settings%", guiSettings.getOreGuiSettings().getDefaultOreItemStackSettingsFormat()). - replace("%setting%", settingName). - replace("%value%", value) - ); - } - } else { - newLore.add(line); - } - - } - itemMeta.setLore(newLore); - } - itemStack.setItemMeta(itemMeta); - } - - String status; - if (biome == null) { - status = String.valueOf(service.isActivated(worldOreConfig, ore)); - } else { - status = String.valueOf(service.isActivated(worldOreConfig, biome, ore)); - } - - itemStack = MessageUtil.replaceItemStack(getPlugin(), itemStack, - new MessageValue("ore", ore.toString()), - new MessageValue("status", status), - new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - - return itemStack; - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreSettingsGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreSettingsGui.java deleted file mode 100644 index bd238ac5..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/OreSettingsGui.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui; - -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.gui.copy.CopyAction; -import de.derfrzocker.ore.control.gui.copy.CopyOreAction; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.gui.settings.OreSettingsGuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.ore.control.utils.ResetUtil; -import de.derfrzocker.spigot.utils.gui.PageGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.apache.commons.lang.Validate; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.LinkedHashSet; -import java.util.Set; - -public class OreSettingsGui extends PageGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final WorldOreConfig worldOreConfig; - @Nullable - private final Dimension dimension; - @Nullable - private final Biome biome; - @Nullable - private final BiomeGroupGui.BiomeGroup biomeGroup; - @NotNull - private final Ore ore; - @Nullable - private final CopyAction copyAction; - private final int statusSlot; - private boolean activated; - - - OreSettingsGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Dimension dimension, @Nullable final Biome biome, @NotNull final Ore ore) { - super(oreControlValues.getPlugin(), guiSettings.getOreSettingsGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.dimension = dimension; - this.biome = biome; - this.biomeGroup = null; - this.ore = ore; - this.copyAction = null; - this.statusSlot = guiSettings.getOreSettingsGuiSettings().getStatusSlot(); - this.activated = biome == null ? oreControlValues.getService().isActivated(worldOreConfig, ore) : oreControlValues.getService().isActivated(worldOreConfig, biome, ore); - - addDecorations(); - - final OreSettingsGuiSettings oreSettingsGuiSettings = guiSettings.getOreSettingsGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Permissions permissions = oreControlValues.getPermissions(); - final Setting[] settings = ore.getSettings(); - - init(settings, Setting[]::new, this::getSettingItemStack, (setting, event) -> { - new SettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome, ore, setting).openSync(event.getWhoClicked()); - }); - - addItem(oreSettingsGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, oreSettingsGuiSettings.getBackItemStack()), - event -> new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome).openSync(event.getWhoClicked())); - - addItem(oreSettingsGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biome == null ? oreSettingsGuiSettings.getInfoItemStack() : oreSettingsGuiSettings.getInfoBiomeItemStack(), getMessagesValues())); - - addItem(statusSlot, MessageUtil.replaceItemStack(plugin, activated ? oreSettingsGuiSettings.getDeactivateItemStack() : oreSettingsGuiSettings.getActivateItemStack()), event -> handleStatusUpdate()); - - if (permissions.getValueResetPermission().hasPermission(permissible)) { - addItem(oreSettingsGuiSettings.getResetValueSlot(), MessageUtil.replaceItemStack(plugin, oreSettingsGuiSettings.getResetValueItemStack()), this::handleResetValues); - } - - if (permissions.getValueCopyPermission().hasPermission(permissible)) { - addItem(oreSettingsGuiSettings.getCopyValueSlot(), MessageUtil.replaceItemStack(plugin, oreSettingsGuiSettings.getCopyValueItemStack()), - event -> new WorldGui(guiSettings, oreControlValues, new CopyOreAction(guiSettings, oreControlValues, () -> new OreSettingsGui(guiSettings, oreControlValues, permissible, worldOreConfig, dimension, biome, ore), worldOreConfig, biome, ore)). - openSync(event.getWhoClicked())); - } - } - - public OreSettingsGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Biome biome, @NotNull final Ore ore, @NotNull final CopyAction copyAction) { - super(oreControlValues.getPlugin(), guiSettings.getOreSettingsGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(copyAction, "CopyAction cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.dimension = null; - this.biome = biome; - this.biomeGroup = null; - this.ore = ore; - this.copyAction = copyAction; - this.statusSlot = -1; - - addDecorations(); - - final OreSettingsGuiSettings oreSettingsGuiSettings = guiSettings.getOreSettingsGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Set settingSet = new LinkedHashSet<>(); - - for (final Setting setting : ore.getSettings()) { - if (copyAction.shouldSet(setting)) { - settingSet.add(setting); - } - } - - final Setting[] settings = settingSet.toArray(new Setting[0]); - - init(settings, Setting[]::new, this::getSettingItemStack, (setting, event) -> { - copyAction.setSettingTarget(setting); - - copyAction.next(event.getWhoClicked(), () -> new OreSettingsGui(guiSettings, oreControlValues, permissible, worldOreConfig, biome, ore, copyAction)); - }); - - addItem(oreSettingsGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, oreSettingsGuiSettings.getBackItemStack()), event -> copyAction.back(event.getWhoClicked())); - addItem(oreSettingsGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biome == null ? oreSettingsGuiSettings.getInfoItemStack() : oreSettingsGuiSettings.getInfoBiomeItemStack(), getMessagesValues())); - addItem(oreSettingsGuiSettings.getAbortSlot(), MessageUtil.replaceItemStack(getPlugin(), oreSettingsGuiSettings.getAbortItemStack()), (event) -> copyAction.abort(event.getWhoClicked())); - } - - OreSettingsGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Dimension dimension, @NotNull final BiomeGroupGui.BiomeGroup biomeGroup, @NotNull final Ore ore) { - super(oreControlValues.getPlugin(), guiSettings.getOreSettingsGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(biomeGroup, "BiomeGroup cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.dimension = dimension; - this.biome = null; - this.biomeGroup = biomeGroup; - this.ore = ore; - this.copyAction = null; - this.statusSlot = guiSettings.getOreSettingsGuiSettings().getStatusSlot(); - this.activated = true; - - addDecorations(); - - final OreSettingsGuiSettings oreSettingsGuiSettings = guiSettings.getOreSettingsGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Setting[] settings = ore.getSettings(); - - init(settings, Setting[]::new, this::getSettingItemStack, (setting, event) -> { - new SettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup, ore, setting).openSync(event.getWhoClicked()); - }); - - addItem(oreSettingsGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, oreSettingsGuiSettings.getInfoBiomeItemStack(), getMessagesValues())); - - addItem(statusSlot, MessageUtil.replaceItemStack(plugin, oreSettingsGuiSettings.getDeactivateItemStack()), event -> handleBiomeGroupStatusUpdate()); - addItem(oreSettingsGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, oreSettingsGuiSettings.getBackItemStack()), - event -> new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup).openSync(event.getWhoClicked())); - } - - private ItemStack getSettingItemStack(@NotNull final Setting setting) { - Validate.notNull(setting, "Setting cannot be null"); - - final OreControlService service = oreControlValues.getService(); - final ItemStack itemStack; - - if (biome == null) { - if (biomeGroup == null) { - itemStack = MessageUtil.replaceItemStack(getPlugin(), this.guiSettings.getOreSettingsGuiSettings().getSettingsItemStack(setting), - new MessageValue("amount", service.getValue(worldOreConfig, ore, setting)), - new MessageValue("default", service.getDefaultValue(ore, setting)), - new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - } else { - itemStack = MessageUtil.replaceItemStack(getPlugin(), this.guiSettings.getOreSettingsGuiSettings().getSettingsItemStack(setting), - new MessageValue("amount", "N/A"), - new MessageValue("default", "N/A"), - new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - } - } else { - itemStack = MessageUtil.replaceItemStack(getPlugin(), this.guiSettings.getOreSettingsGuiSettings().getSettingsItemStack(setting), - new MessageValue("amount", service.getValue(worldOreConfig, biome, ore, setting)), - new MessageValue("default", service.getDefaultValue(biome, ore, setting)), - new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - } - - return itemStack; - } - - private MessageValue[] getMessagesValues() { - return new MessageValue[]{new MessageValue("world", worldOreConfig.getName()), - new MessageValue("biome", biome == null ? biomeGroup == null ? "" : biomeGroup.getName() : biome.toString()), - new MessageValue("ore", ore.toString())}; - } - - private void handleStatusUpdate() { - final OreControlService service = oreControlValues.getService(); - - activated = !activated; - - if (biome == null) { - service.setActivated(worldOreConfig, ore, activated); - } else { - service.setActivated(worldOreConfig, biome, ore, activated); - } - - addItem(statusSlot, MessageUtil.replaceItemStack(getPlugin(), activated ? this.guiSettings.getOreSettingsGuiSettings().getDeactivateItemStack() : this.guiSettings.getOreSettingsGuiSettings().getActivateItemStack())); - - service.saveWorldOreConfig(worldOreConfig); - } - - private void handleBiomeGroupStatusUpdate() { - final OreControlService service = oreControlValues.getService(); - - activated = !activated; - - biomeGroup.getBiomes().forEach(biome -> service.setActivated(worldOreConfig, biome, ore, activated)); - - addItem(statusSlot, MessageUtil.replaceItemStack(getPlugin(), activated ? this.guiSettings.getOreSettingsGuiSettings().getDeactivateItemStack() : this.guiSettings.getOreSettingsGuiSettings().getActivateItemStack())); - - service.saveWorldOreConfig(worldOreConfig); - } - - private void handleResetValues(@NotNull final InventoryClickEvent event) { - Validate.notNull(event, "InventoryClickEvent cannot be null"); - - final OreControlService service = oreControlValues.getService(); - - if (oreControlValues.getConfigValues().verifyResetAction()) { - VerifyGui verifyGui = new VerifyGui(getPlugin(), clickEvent -> { - if (biome != null) { - ResetUtil.reset(worldOreConfig, ore, biome); - } else { - ResetUtil.reset(worldOreConfig, ore); - } - - service.saveWorldOreConfig(worldOreConfig); - activated = biome == null ? service.isActivated(worldOreConfig, ore) : service.isActivated(worldOreConfig, biome, ore); - addItem(statusSlot, MessageUtil.replaceItemStack(getPlugin(), activated ? this.guiSettings.getOreSettingsGuiSettings().getDeactivateItemStack() : this.guiSettings.getOreSettingsGuiSettings().getActivateItemStack())); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - - if (biomeGroup == null) { - new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome, ore).openSync(event.getWhoClicked()); - } else { - new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup, ore).openSync(event.getWhoClicked()); - } - }, clickEvent1 -> openSync(event.getWhoClicked())); - - verifyGui.addDecorations(); - - verifyGui.openSync(event.getWhoClicked()); - return; - } - if (biome != null) { - ResetUtil.reset(worldOreConfig, ore, biome); - } else { - ResetUtil.reset(worldOreConfig, ore); - } - - service.saveWorldOreConfig(worldOreConfig); - activated = biome == null ? service.isActivated(worldOreConfig, ore) : service.isActivated(worldOreConfig, biome, ore); - addItem(statusSlot, MessageUtil.replaceItemStack(getPlugin(), activated ? this.guiSettings.getOreSettingsGuiSettings().getDeactivateItemStack() : this.guiSettings.getOreSettingsGuiSettings().getActivateItemStack())); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - - if (biomeGroup == null) { - new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome, ore).openSync(event.getWhoClicked()); - } else { - new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup, ore).openSync(event.getWhoClicked()); - } - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/SettingsGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/SettingsGui.java deleted file mode 100644 index a623100a..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/SettingsGui.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui; - -import com.google.common.collect.Sets; -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.api.*; -import de.derfrzocker.ore.control.gui.copy.CopySettingAction; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.gui.settings.SettingsGuiSettings; -import de.derfrzocker.ore.control.utils.BaseComponentUtil; -import de.derfrzocker.ore.control.utils.OreControlUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.ore.control.utils.ResetUtil; -import de.derfrzocker.spigot.utils.gui.BasicGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import net.md_5.bungee.api.chat.BaseComponent; -import org.apache.commons.lang.Validate; -import org.bukkit.command.CommandSender; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Locale; -import java.util.function.Consumer; - -public class SettingsGui extends BasicGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final WorldOreConfig worldOreConfig; - @Nullable - private final Biome biome; - @Nullable - private final BiomeGroupGui.BiomeGroup biomeGroup; - @NotNull - private final Ore ore; - @NotNull - private final Setting setting; - private final int oreSlot; - - private double current = 0; - - SettingsGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable Dimension dimension, @Nullable final Biome biome, @NotNull final Ore ore, @NotNull final Setting setting) { - super(oreControlValues.getPlugin(), guiSettings.getSettingsGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.biome = biome; - this.biomeGroup = null; - this.ore = ore; - this.setting = setting; - this.oreSlot = guiSettings.getSettingsGuiSettings().getOreSlot(); - - addDecorations(); - - final SettingsGuiSettings settingsGuiSettings = guiSettings.getSettingsGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Permissions permissions = oreControlValues.getPermissions(); - - settingsGuiSettings.getItemStackValues().forEach(value -> addItem(value.getSlot(), MessageUtil.replaceItemStack(plugin, value.getItemStack(), getMessagesValues(true, value.getValue())), new SettingConsumer(value.getValue()))); - - addItem(settingsGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, settingsGuiSettings.getBackItemStack()), - event -> new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biome, ore).openSync(event.getWhoClicked())); - - addItem(settingsGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, biome == null ? settingsGuiSettings.getInfoItemStack() : settingsGuiSettings.getInfoBiomeItemStack(), getMessagesValues(false))); - - updateItemStack(); - - if (permissions.getValueResetPermission().hasPermission(permissible)) { - addItem(settingsGuiSettings.getResetValueSlot(), MessageUtil.replaceItemStack(plugin, settingsGuiSettings.getResetValueItemStack()), this::handleResetValues); - } - - if (permissions.getValueCopyPermission().hasPermission(permissible)) { - addItem(settingsGuiSettings.getCopyValueSlot(), MessageUtil.replaceItemStack(plugin, settingsGuiSettings.getCopyValueItemStack()), - event -> new WorldGui(guiSettings, oreControlValues, new CopySettingAction(guiSettings, oreControlValues, - () -> new SettingsGui(guiSettings, oreControlValues, permissible, worldOreConfig, dimension, biome, ore, setting), worldOreConfig, biome, ore, setting)). - openSync(event.getWhoClicked())); - } - } - - SettingsGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable Dimension dimension, @NotNull final BiomeGroupGui.BiomeGroup biomeGroup, @NotNull final Ore ore, @NotNull final Setting setting) { - super(oreControlValues.getPlugin(), guiSettings.getSettingsGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.biome = null; - this.biomeGroup = biomeGroup; - this.ore = ore; - this.setting = setting; - this.oreSlot = guiSettings.getSettingsGuiSettings().getOreSlot(); - - addDecorations(); - - final SettingsGuiSettings settingsGuiSettings = guiSettings.getSettingsGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - - settingsGuiSettings.getItemStackValues().forEach(value -> addItem(value.getSlot(), MessageUtil.replaceItemStack(plugin, value.getItemStack(), getMessagesValues(true, value.getValue())), new SettingBiomeGroupConsumer(value.getValue()))); - - addItem(settingsGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, settingsGuiSettings.getInfoBiomeItemStack(), getMessagesValues(true))); - addItem(settingsGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, settingsGuiSettings.getBackItemStack()), - event -> new OreSettingsGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, biomeGroup, ore).openSync(event.getWhoClicked())); - - updateBiomeGroupItemStack(true); - } - - private MessageValue[] getMessagesValues(final boolean firstUpdate) { - return new MessageValue[]{new MessageValue("world", worldOreConfig.getName()), - new MessageValue("biome", biome == null ? biomeGroup == null ? "" : biomeGroup.getName() : biome.toString()), - new MessageValue("ore", ore.toString()), - new MessageValue("setting", setting.toString()), - new MessageValue("amount", String.valueOf(biome == null ? biomeGroup == null ? oreControlValues.getService().getValue(worldOreConfig, ore, setting) : firstUpdate ? "N/A" : current : oreControlValues.getService().getValue(worldOreConfig, biome, ore, setting))), - new MessageValue("default", String.valueOf(biome == null ? biomeGroup == null ? oreControlValues.getService().getDefaultValue(ore, setting) : "N/A" : oreControlValues.getService().getDefaultValue(biome, ore, setting))) - }; - } - - private MessageValue[] getMessagesValues(final boolean firstUpdate, double changeValue) { - return new MessageValue[]{new MessageValue("world", worldOreConfig.getName()), - new MessageValue("biome", biome == null ? biomeGroup == null ? "" : biomeGroup.getName() : biome.toString()), - new MessageValue("ore", ore.toString()), - new MessageValue("setting", setting.toString()), - new MessageValue("amount", String.valueOf(biome == null ? biomeGroup == null ? oreControlValues.getService().getValue(worldOreConfig, ore, setting) : firstUpdate ? "N/A" : current : oreControlValues.getService().getValue(worldOreConfig, biome, ore, setting))), - new MessageValue("default", String.valueOf(biome == null ? biomeGroup == null ? oreControlValues.getService().getDefaultValue(ore, setting) : "N/A" : oreControlValues.getService().getDefaultValue(biome, ore, setting))), - new MessageValue("change-value", Math.abs(changeValue)) - }; - } - - private void updateItemStack() { - ItemStack itemStack = biome == null ? guiSettings.getSettingsGuiSettings().getDefaultOreItemStack() : guiSettings.getSettingsGuiSettings().getDefaultBiomeOreItemStack(); - itemStack.setType(ore.getMaterial()); - itemStack = MessageUtil.replaceItemStack(getPlugin(), itemStack, getMessagesValues(false)); - addItem(oreSlot, itemStack); - - guiSettings.getSettingsGuiSettings().getItemStackValues().forEach(value -> addItem(value.getSlot(), MessageUtil.replaceItemStack(getPlugin(), value.getItemStack(), getMessagesValues(false, value.getValue())))); - } - - private void updateBiomeGroupItemStack(final boolean firstUpdate) { - ItemStack itemStack = guiSettings.getSettingsGuiSettings().getDefaultBiomeOreItemStack(); - itemStack.setType(ore.getMaterial()); - itemStack = MessageUtil.replaceItemStack(getPlugin(), itemStack, getMessagesValues(firstUpdate)); - addItem(oreSlot, itemStack); - - guiSettings.getSettingsGuiSettings().getItemStackValues().forEach(value -> addItem(value.getSlot(), MessageUtil.replaceItemStack(getPlugin(), value.getItemStack(), getMessagesValues(false, value.getValue())))); - } - - private void handleResetValues(@NotNull final InventoryClickEvent event) { - if (oreControlValues.getConfigValues().verifyResetAction()) { - VerifyGui verifyGui = new VerifyGui(getPlugin(), clickEvent -> { - if (biome != null) { - ResetUtil.reset(worldOreConfig, ore, biome, setting); - } else { - ResetUtil.reset(worldOreConfig, ore, setting); - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - - if (biomeGroup == null) { - updateItemStack(); - } else { - updateBiomeGroupItemStack(false); - } - }, clickEvent1 -> openSync(event.getWhoClicked())); - - verifyGui.addDecorations(); - - verifyGui.openSync(event.getWhoClicked()); - return; - } - if (biome != null) { - ResetUtil.reset(worldOreConfig, ore, biome, setting); - } else { - ResetUtil.reset(worldOreConfig, ore, setting); - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - if (biomeGroup == null) { - updateItemStack(); - } else { - updateBiomeGroupItemStack(false); - } - } - - private final class SettingConsumer implements Consumer { - - private final double value; - - private SettingConsumer(final double value) { - this.value = value; - } - - @Override - public void accept(@NotNull final InventoryClickEvent event) { - if (event.getClick() != ClickType.LEFT) { - return; - } - - final OreControlService service = oreControlValues.getService(); - double current = biome == null ? service.getValue(worldOreConfig, ore, setting) : service.getValue(worldOreConfig, biome, ore, setting); - - double newValue = Double.parseDouble(String.format(Locale.ENGLISH, "%1.2f", current + value)); - - if (OreControlUtil.isUnSafe(setting, newValue) || (setting == Setting.VEIN_SIZE && newValue <= 2.001)) { - if (oreControlValues.getConfigValues().isSafeMode()) { - oreControlValues.getOreControlMessages().getNumberNotSafeMessage().sendMessage(event.getWhoClicked(), new MessageValue("value", String.valueOf(newValue))); - if ((setting == Setting.VEIN_SIZE && newValue <= 2.001)) { - sendSeeAlso(event.getWhoClicked()); - } - return; - } - oreControlValues.getOreControlMessages().getNumberNotSafeWarningMessage().sendMessage(event.getWhoClicked(), new MessageValue("value", String.valueOf(newValue))); - if ((setting == Setting.VEIN_SIZE && newValue <= 2.001)) { - sendSeeAlso(event.getWhoClicked()); - } - } - - if (biome == null) { - service.setValue(worldOreConfig, ore, setting, newValue); - } else { - service.setValue(worldOreConfig, biome, ore, setting, newValue); - } - - service.saveWorldOreConfig(worldOreConfig); - - updateItemStack(); - } - - } - - private final class SettingBiomeGroupConsumer implements Consumer { - - private final double value; - - private SettingBiomeGroupConsumer(double value) { - this.value = value; - } - - @Override - public void accept(@NotNull final InventoryClickEvent event) { - if (event.getClick() != ClickType.LEFT) { - return; - } - - final OreControlService service = oreControlValues.getService(); - double newValue = Double.parseDouble(String.format(Locale.ENGLISH, "%1.2f", current + value)); - - if (OreControlUtil.isUnSafe(setting, newValue) || (setting == Setting.VEIN_SIZE && newValue <= 2.001)) { - if (oreControlValues.getConfigValues().isSafeMode()) { - oreControlValues.getOreControlMessages().getNumberNotSafeMessage().sendMessage(event.getWhoClicked(), new MessageValue("value", String.valueOf(newValue))); - if ((setting == Setting.VEIN_SIZE && newValue <= 2.001)) { - sendSeeAlso(event.getWhoClicked()); - } - return; - } - oreControlValues.getOreControlMessages().getNumberNotSafeWarningMessage().sendMessage(event.getWhoClicked(), new MessageValue("value", String.valueOf(newValue))); - if ((setting == Setting.VEIN_SIZE && newValue <= 2.001)) { - sendSeeAlso(event.getWhoClicked()); - } - } - - current = newValue; - - biomeGroup.getBiomes().stream().filter(biome -> Sets.newHashSet(biome.getOres()).contains(ore)).forEach(biome -> service.setValue(worldOreConfig, biome, ore, setting, current)); - - service.saveWorldOreConfig(worldOreConfig); - - updateBiomeGroupItemStack(false); - } - - } - - private void sendSeeAlso(CommandSender commandSender) { - BaseComponent[] message = BaseComponentUtil.buildLineWithUrlButton(oreControlValues.getOreControlMessages().getNumberNotSafeSeeAlso().getRawMessage(), "GitHub", "https://github.com/DerFrZocker/Ore-Control/wiki/Vein-Size", oreControlValues.getOreControlMessages()); - commandSender.spigot().sendMessage(message); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldConfigGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldConfigGui.java deleted file mode 100644 index 7fa21011..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldConfigGui.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui; - -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Dimension; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.gui.copy.CopyAction; -import de.derfrzocker.ore.control.gui.copy.CopyWorldOreConfigAction; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.gui.settings.WorldConfigGuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.ore.control.utils.ResetUtil; -import de.derfrzocker.spigot.utils.gui.BasicGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.apache.commons.lang.Validate; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class WorldConfigGui extends BasicGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final WorldOreConfig worldOreConfig; - @Nullable - private final CopyAction copyAction; - - WorldConfigGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @Nullable final Dimension dimension) { - super(oreControlValues.getPlugin(), guiSettings.getWorldConfigGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.copyAction = null; - - final WorldConfigGuiSettings worldConfigGuiSettings = guiSettings.getWorldConfigGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Permissions permissions = oreControlValues.getPermissions(); - - addDecorations(); - - if (permissions.getSetValuePermission().hasPermission(permissible)) { - addItem(worldConfigGuiSettings.getOreItemStackSlot(), - MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getOreItemStack(), new MessageValue("reset-copy", "")), - event -> new OreGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension, (Biome) null).openSync(event.getWhoClicked())); - } - - if (permissions.getSetBiomePermission().hasPermission(permissible)) { - addItem(worldConfigGuiSettings.getBiomeItemStackSlot(), - MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getBiomeItemStack(), new MessageValue("reset-copy", "")), - event -> new BiomeGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension).openSync(event.getWhoClicked())); - } - - if (permissions.getValueResetPermission().hasPermission(permissible)) { - addItem(worldConfigGuiSettings.getResetValueSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getResetValueItemStack()), this::handleResetValues); - } - - if (permissions.getValueCopyPermission().hasPermission(permissible)) { - addItem(worldConfigGuiSettings.getCopyValueSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getCopyValueItemStack()), - event -> new WorldGui(guiSettings, oreControlValues, new CopyWorldOreConfigAction(oreControlValues, - () -> new WorldConfigGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, dimension), worldOreConfig)). - openSync(event.getWhoClicked())); - } - - if (permissions.getTemplateDeletePermission().hasPermission(permissible) && !worldOreConfig.getName().equals("Default")) { - addItem(worldConfigGuiSettings.getTemplateDeleteSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getTemplateDeleteItemStack()), this::handleDeleteTemplate); - } - - addItem(worldConfigGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getBackItemStack()), event -> new WorldGui(guiSettings, oreControlValues, event.getWhoClicked()).openSync(event.getWhoClicked())); - addItem(worldConfigGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getInfoItemStack(), getMessagesValues())); - } - - public WorldConfigGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible, @NotNull final WorldOreConfig worldOreConfig, @NotNull CopyAction copyAction) { - super(oreControlValues.getPlugin(), guiSettings.getWorldConfigGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(copyAction, "CopyAction cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfig = worldOreConfig; - this.copyAction = copyAction; - - final WorldConfigGuiSettings worldConfigGuiSettings = guiSettings.getWorldConfigGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - final Permissions permissions = oreControlValues.getPermissions(); - - addDecorations(); - - if (permissions.getSetValuePermission().hasPermission(permissible)) { - boolean bool = false; - - for (Ore ore : Ore.values()) { - if (copyAction.shouldSet(ore)) { - bool = true; - break; - } - } - - if (bool) { - addItem(worldConfigGuiSettings.getOreItemStackSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getOreItemStack(), new MessageValue("reset-copy", "reset-copy.")), this::handleCopyAction); - } - } - - if (permissions.getSetBiomePermission().hasPermission(permissible)) { - boolean bool = false; - - for (final Biome biome : Biome.values()) { - if (copyAction.shouldSet(biome)) { - bool = true; - break; - } - } - - - if (bool) { - addItem(worldConfigGuiSettings.getBiomeItemStackSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getBiomeItemStack(), new MessageValue("reset-copy", "reset-copy.")), this::handleCopyActionBiome); - } - } - - addItem(worldConfigGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getBackItemStack()), event -> copyAction.back(event.getWhoClicked())); - addItem(worldConfigGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, worldConfigGuiSettings.getInfoItemStack(), getMessagesValues())); - addItem(worldConfigGuiSettings.getAbortSlot(), MessageUtil.replaceItemStack(getPlugin(), worldConfigGuiSettings.getAbortItemStack()), (event) -> copyAction.abort(event.getWhoClicked())); - } - - private void handleCopyAction(@NotNull final InventoryClickEvent event) { - copyAction.setChooseBiome(false); - copyAction.next(event.getWhoClicked(), () -> new WorldConfigGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, copyAction)); - } - - private void handleCopyActionBiome(@NotNull final InventoryClickEvent event) { - copyAction.setChooseBiome(true); - copyAction.next(event.getWhoClicked(), () -> new WorldConfigGui(guiSettings, oreControlValues, event.getWhoClicked(), worldOreConfig, copyAction)); - } - - private MessageValue[] getMessagesValues() { - return new MessageValue[]{new MessageValue("world", worldOreConfig.getName())}; - } - - private void handleResetValues(@NotNull final InventoryClickEvent event) { - if (oreControlValues.getConfigValues().verifyResetAction()) { - VerifyGui verifyGui = new VerifyGui(getPlugin(), clickEvent -> { - ResetUtil.reset(this.worldOreConfig); - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - }, clickEvent1 -> openSync(event.getWhoClicked())); - - verifyGui.addDecorations(); - - verifyGui.openSync(event.getWhoClicked()); - return; - } - - ResetUtil.reset(worldOreConfig); - oreControlValues.getService().saveWorldOreConfig(worldOreConfig); - oreControlValues.getOreControlMessages().getGuiResetSuccessMessage().sendMessage(event.getWhoClicked()); - } - - private void handleDeleteTemplate(@NotNull final InventoryClickEvent event) { - VerifyGui verifyGui = new VerifyGui(getPlugin(), clickEvent -> { - oreControlValues.getService().removeWorldOreConfig(worldOreConfig); - new WorldGui(guiSettings, oreControlValues, event.getWhoClicked()).openSync(event.getWhoClicked()); - }, clickEvent1 -> openSync(event.getWhoClicked())); - - verifyGui.addDecorations(); - - verifyGui.openSync(event.getWhoClicked()); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldGui.java deleted file mode 100644 index f4b2dee0..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/WorldGui.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui; - -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.api.ConfigType; -import de.derfrzocker.ore.control.api.Dimension; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.gui.config.ConfigGui; -import de.derfrzocker.ore.control.gui.copy.CopyAction; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.gui.settings.WorldGuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.gui.PageGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import net.wesjd.anvilgui.AnvilGUI; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.Permissible; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.LinkedHashSet; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.ExecutionException; - -public class WorldGui extends PageGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @Nullable - private final CopyAction copyAction; - - public WorldGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final Permissible permissible) { - super(oreControlValues.getPlugin(), guiSettings.getWorldGuiSettings()); - - Validate.notNull(permissible, "Permissible cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.copyAction = null; - - final WorldGuiSettings worldGuiSettings = guiSettings.getWorldGuiSettings(); - - final Permissions permissions = oreControlValues.getPermissions(); - - addDecorations(); - init(getWorldConfigDatas(), WorldConfigData[]::new, this::getItemStack, (configName, event) -> new WorldConfigGui(guiSettings, oreControlValues, event.getWhoClicked(), getWorldOreConfig(configName), getDimension(configName.configType)).openSync(event.getWhoClicked())); - - if (permissions.getTemplateCreatePermission().hasPermission(permissible)) { - addItem(worldGuiSettings.getCreateTemplateSlot(), MessageUtil.replaceItemStack(getPlugin(), worldGuiSettings.getCreateTemplateItemStack()), this::handleCreateTemplate); - } - - if (permissions.getConfigEditPermission().hasPermission(permissible)) { - addItem(worldGuiSettings.getEditConfigSlot(), MessageUtil.replaceItemStack(getPlugin(), worldGuiSettings.getEditConfigItemStack()), event -> new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked())); - } - } - - public WorldGui(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull final CopyAction copyAction) { - super(oreControlValues.getPlugin(), guiSettings.getWorldGuiSettings()); - - Validate.notNull(copyAction, "CopyAction cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.copyAction = copyAction; - - addDecorations(); - init(getWorldConfigDatas(), WorldConfigData[]::new, this::getItemStack, this::handleCopyAction); - - addItem(guiSettings.getWorldGuiSettings().getAbortSlot(), MessageUtil.replaceItemStack(getPlugin(), guiSettings.getWorldGuiSettings().getAbortItemStack()), (event) -> copyAction.abort(event.getWhoClicked())); - } - - private ItemStack getItemStack(@NotNull final WorldConfigData worldConfigData) { - String name = "UNKNOWN"; - - if (worldConfigData.worldOreConfig != null) { - name = worldConfigData.worldOreConfig.getName(); - } else if (worldConfigData.world != null) { - name = worldConfigData.world.getName(); - } - - switch (worldConfigData.configType) { - case OVERWORLD: - case NETHER: - case UNKNOWN: - return MessageUtil.replaceItemStack(getPlugin(), this.guiSettings.getWorldGuiSettings().getWorldItemStack(), - new MessageValue("world", name), - new MessageValue("config-type", worldConfigData.configType), - new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - case TEMPLATE: - return MessageUtil.replaceItemStack(getPlugin(), this.guiSettings.getWorldGuiSettings().getTemplateItemStack(), - new MessageValue("template", name), - new MessageValue("config-type", worldConfigData.configType), - new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - case GLOBAL: - return MessageUtil.replaceItemStack(getPlugin(), this.guiSettings.getWorldGuiSettings().getGlobalItemStack(), - new MessageValue("config-type", worldConfigData.configType), - new MessageValue("reset-copy", copyAction == null ? "" : "reset-copy.")); - } - - throw new RuntimeException("No ConfigType found!"); - } - - private void handleCreateTemplate(@NotNull final InventoryClickEvent event) { - if (event.getWhoClicked() instanceof Player) { - try { - Bukkit.getScheduler().callSyncMethod(getPlugin(), () -> - new AnvilGUI.Builder() - .plugin(getPlugin()) - .onComplete((player, value) -> { - final OreControlService service = oreControlValues.getService(); - - if (Bukkit.getWorld(value) != null || service.getWorldOreConfig(value).isPresent()) - return AnvilGUI.Response.text(MessageUtil.replacePlaceHolder(getPlugin(), oreControlValues.getOreControlMessages().getWorldConfigAlreadyExistsMessage().getMessage(), new MessageValue("world-config", value))); - - service.createWorldOreConfigTemplate(value); - - new WorldGui(this.guiSettings, this.oreControlValues, player).openSync(event.getWhoClicked()); - - return AnvilGUI.Response.text(""); - }) - .text(oreControlValues.getOreControlMessages().getGuiAnvilTitleMessage().getMessage()) - .open((Player) event.getWhoClicked())) - .get(); - } catch (final InterruptedException | ExecutionException e) { - throw new RuntimeException("Unexpected Error while create Template", e); - } - } - } - - private WorldConfigData[] getWorldConfigDatas() { - Set worldConfigDatas = new LinkedHashSet<>(); - OreControlService service = oreControlValues.getService(); - final Set worldOreConfigs = service.getAllWorldOreConfigs(); - - for (World world : Bukkit.getWorlds()) { - Dimension dimension = service.getNMSService().getNMSUtil().getDimension(world); - ConfigType configType; - - if (dimension == Dimension.OVERWORLD) { - configType = ConfigType.OVERWORLD; - } else if (dimension == Dimension.NETHER) { - configType = ConfigType.NETHER; - } else { - continue; - } - - WorldOreConfig worldOreConfig = service.getWorldOreConfig(world).orElse(null); - if (worldOreConfig != null) { - worldOreConfigs.remove(worldOreConfig); - if (worldOreConfig.getConfigType() != configType) { - worldOreConfig.setConfigType(configType); - service.saveWorldOreConfig(worldOreConfig); - } - } - - worldConfigDatas.add(new WorldConfigData(worldOreConfig, world, configType)); - } - - Set overworld = new LinkedHashSet<>(); - Set nether = new LinkedHashSet<>(); - Set unknown = new LinkedHashSet<>(); - Set template = new LinkedHashSet<>(); - Set global = new LinkedHashSet<>(); - - for (WorldOreConfig worldOreConfig : worldOreConfigs) { - switch (worldOreConfig.getConfigType()) { - case OVERWORLD: - overworld.add(new WorldConfigData(worldOreConfig, null, ConfigType.OVERWORLD)); - break; - case NETHER: - nether.add(new WorldConfigData(worldOreConfig, null, ConfigType.NETHER)); - break; - case TEMPLATE: - template.add(new WorldConfigData(worldOreConfig, null, ConfigType.TEMPLATE)); - break; - case GLOBAL: - global.add(new WorldConfigData(worldOreConfig, null, ConfigType.GLOBAL)); - break; - case UNKNOWN: - unknown.add(new WorldConfigData(worldOreConfig, null, ConfigType.UNKNOWN)); - break; - } - } - worldConfigDatas.addAll(overworld); - worldConfigDatas.addAll(nether); - worldConfigDatas.addAll(unknown); - worldConfigDatas.addAll(global); - worldConfigDatas.addAll(template); - - - if (copyAction != null && copyAction.isFilterWorldOreConfig()) { - WorldConfigData worldConfigData = null; - - for (WorldConfigData worldConfigData1 : worldConfigDatas) { - WorldOreConfig current = worldConfigData1.worldOreConfig; - WorldOreConfig source = copyAction.getWorldOreConfigSource(); - if (current != null && source.getName().equals(current.getName()) && current.getConfigType() == source.getConfigType()) { - worldConfigData = worldConfigData1; - } - } - - if (worldConfigData != null) { - worldConfigDatas.remove(worldConfigData); - } - } - - return worldConfigDatas.toArray(new WorldConfigData[0]); - } - - private void handleCopyAction(@NotNull final WorldConfigData worldConfigData, @NotNull final InventoryClickEvent event) { - copyAction.setWorldOreConfigTarget(getWorldOreConfig(worldConfigData)); - - copyAction.next(event.getWhoClicked(), () -> new WorldGui(guiSettings, oreControlValues, copyAction)); - } - - @NotNull - private WorldOreConfig getWorldOreConfig(@NotNull final WorldConfigData worldConfigData) { - if (worldConfigData.worldOreConfig != null) { - return worldConfigData.worldOreConfig; - } - - if (worldConfigData.world != null) { - World world = worldConfigData.world; - OreControlService service = oreControlValues.getService(); - final Optional optionalWorldOreConfig = service.getWorldOreConfig(world.getName()); - - return optionalWorldOreConfig.orElseGet(() -> service.createWorldOreConfig(world)); - } - - throw new RuntimeException("No WorldOreConfig found!"); - } - - @Nullable - private Dimension getDimension(ConfigType configType) { - switch (configType) { - case OVERWORLD: - return Dimension.OVERWORLD; - case NETHER: - return Dimension.NETHER; - case TEMPLATE: - case GLOBAL: - case UNKNOWN: - return null; - } - - return null; - } - - protected final class WorldConfigData { - @Nullable - private final WorldOreConfig worldOreConfig; - @Nullable - private final World world; - @NotNull - private final ConfigType configType; - - private WorldConfigData(@Nullable WorldOreConfig worldOreConfig, @Nullable World world, @NotNull ConfigType configType) { - this.worldOreConfig = worldOreConfig; - this.world = world; - this.configType = configType; - } - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/ConfigGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/ConfigGui.java deleted file mode 100644 index 862aff65..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/ConfigGui.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.config; - -import de.derfrzocker.ore.control.gui.WorldGui; -import de.derfrzocker.ore.control.gui.settings.BooleanGuiSetting; -import de.derfrzocker.ore.control.gui.settings.ConfigGuiSettings; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.ReloadAble; -import de.derfrzocker.spigot.utils.gui.BasicGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -public class ConfigGui extends BasicGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - - public ConfigGui(@NotNull GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues) { - super(oreControlValues.getPlugin(), guiSettings.getConfigGuiSettings()); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - - final ConfigGuiSettings configGuiSettings = guiSettings.getConfigGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - - addDecorations(); - - addItem(configGuiSettings.getReloadSlot(), MessageUtil.replaceItemStack(plugin, configGuiSettings.getReloadItemStack()), event -> { - ReloadAble.RELOAD_ABLES.forEach(ReloadAble::reload); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }); - - addItem(configGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, configGuiSettings.getBackItemStack()), event -> new WorldGui(guiSettings, oreControlValues, event.getWhoClicked()).openSync(event.getWhoClicked())); - - addItem(configGuiSettings.getLanguageSlot(), MessageUtil.replaceItemStack(plugin, configGuiSettings.getLanguageItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().getLanguage().getNames()[0]), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultLanguage().getNames()[0]) - ), event -> new LanguageGui(guiSettings, oreControlValues).openSync(event.getWhoClicked())); - - addItem(configGuiSettings.getsafeModeSlot(), MessageUtil.replaceItemStack(plugin, configGuiSettings.getsafeModeItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().isSafeMode()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultSafeMode()) - ), this::handleSafeMode); - - addItem(configGuiSettings.getTranslateTabCompilationSlot(), MessageUtil.replaceItemStack(plugin, configGuiSettings.getTranslateTabCompilationItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().isTranslateTabCompilation()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultTranslateTabCompilation()) - ), this::handleTranslateTabCompilation); - - addItem(configGuiSettings.getVerifyCopyActionSlot(), MessageUtil.replaceItemStack(plugin, configGuiSettings.getVerifyCopyActionItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().verifyCopyAction()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultVerifyCopyAction()) - ), this::handleVerifyCopyAction); - - addItem(configGuiSettings.getVerifyResetActionSlot(), MessageUtil.replaceItemStack(plugin, configGuiSettings.getVerifyResetActionItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().verifyResetAction()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultVerifyResetAction()) - ), this::handleVerifyResetAction); - } - - private void handleSafeMode(@NotNull final InventoryClickEvent event) { - final BooleanGuiSetting booleanGuiSetting = guiSettings.getBooleanGuiSetting(); - - final VerifyGui verifyGui = new VerifyGui(getPlugin(), event1 -> { - oreControlValues.getConfigValues().SET.setSafeMode(true); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, event1 -> { - oreControlValues.getConfigValues().SET.setSafeMode(false); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, booleanGuiSetting); - - verifyGui.addDecorations(); - - verifyGui.addItem(booleanGuiSetting.getBackSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getBackItemStack()), click -> new ConfigGui(guiSettings, oreControlValues).openSync(click.getWhoClicked())); - - verifyGui.addItem(booleanGuiSetting.getInfoSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getInfoItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().isSafeMode()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultSafeMode()))); - - verifyGui.openSync(event.getWhoClicked()); - } - - private void handleTranslateTabCompilation(@NotNull final InventoryClickEvent event) { - final BooleanGuiSetting booleanGuiSetting = guiSettings.getBooleanGuiSetting(); - - final VerifyGui verifyGui = new VerifyGui(getPlugin(), event1 -> { - oreControlValues.getConfigValues().SET.setTranslateTabCompilation(true); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, event1 -> { - oreControlValues.getConfigValues().SET.setTranslateTabCompilation(false); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, booleanGuiSetting); - - verifyGui.addDecorations(); - - verifyGui.addItem(booleanGuiSetting.getBackSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getBackItemStack()), click -> new ConfigGui(guiSettings, oreControlValues).openSync(click.getWhoClicked())); - - verifyGui.addItem(booleanGuiSetting.getInfoSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getInfoItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().isTranslateTabCompilation()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultTranslateTabCompilation()))); - - verifyGui.openSync(event.getWhoClicked()); - } - - private void handleVerifyCopyAction(@NotNull final InventoryClickEvent event) { - final BooleanGuiSetting booleanGuiSetting = guiSettings.getBooleanGuiSetting(); - - final VerifyGui verifyGui = new VerifyGui(getPlugin(), event1 -> { - oreControlValues.getConfigValues().SET.setVerifyCopyAction(true); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, event1 -> { - oreControlValues.getConfigValues().SET.setVerifyCopyAction(false); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, booleanGuiSetting); - - verifyGui.addDecorations(); - - verifyGui.addItem(booleanGuiSetting.getBackSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getBackItemStack()), click -> new ConfigGui(guiSettings, oreControlValues).openSync(click.getWhoClicked())); - - verifyGui.addItem(booleanGuiSetting.getInfoSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getInfoItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().verifyCopyAction()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultVerifyCopyAction()))); - - verifyGui.openSync(event.getWhoClicked()); - } - - private void handleVerifyResetAction(@NotNull final InventoryClickEvent event) { - final BooleanGuiSetting booleanGuiSetting = guiSettings.getBooleanGuiSetting(); - - final VerifyGui verifyGui = new VerifyGui(getPlugin(), event1 -> { - oreControlValues.getConfigValues().SET.setVerifyResetAction(true); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, event1 -> { - oreControlValues.getConfigValues().SET.setVerifyResetAction(false); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - }, booleanGuiSetting); - - verifyGui.addDecorations(); - - verifyGui.addItem(booleanGuiSetting.getBackSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getBackItemStack()), click -> new ConfigGui(guiSettings, oreControlValues).openSync(click.getWhoClicked())); - - verifyGui.addItem(booleanGuiSetting.getInfoSlot(), MessageUtil.replaceItemStack(getPlugin(), booleanGuiSetting.getInfoItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().verifyResetAction()), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultVerifyResetAction()))); - - verifyGui.openSync(event.getWhoClicked()); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/LanguageGui.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/LanguageGui.java deleted file mode 100644 index 82900b7a..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/config/LanguageGui.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.config; - -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.gui.settings.LanguageGuiSettings; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.Language; -import de.derfrzocker.spigot.utils.gui.BasicGui; -import de.derfrzocker.spigot.utils.message.MessageUtil; -import de.derfrzocker.spigot.utils.message.MessageValue; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Consumer; - - -public class LanguageGui extends BasicGui { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - - LanguageGui(@NotNull GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues) { - super(oreControlValues.getPlugin(), guiSettings.getLanguageGuiSettings()); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - - final LanguageGuiSettings languageGuiSettings = guiSettings.getLanguageGuiSettings(); - final Plugin plugin = oreControlValues.getPlugin(); - - addDecorations(); - - for (Language language : Language.values()) { - addItem(languageGuiSettings.getLanguageSlot(language), MessageUtil.replaceItemStack(plugin, languageGuiSettings.getLanguageItemStack(language)), new LanguageConsumer(language)); - } - - addItem(languageGuiSettings.getBackSlot(), MessageUtil.replaceItemStack(plugin, languageGuiSettings.getBackItemStack()), event -> new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked())); - - addItem(languageGuiSettings.getInfoSlot(), MessageUtil.replaceItemStack(plugin, languageGuiSettings.getInfoItemStack(), - new MessageValue("amount", oreControlValues.getConfigValues().getLanguage().getNames()[0]), - new MessageValue("default", oreControlValues.getConfigValues().DEFAULT.defaultLanguage().getNames()[0]) - )); - } - - private final class LanguageConsumer implements Consumer { - - @NotNull - private final Language language; - - private LanguageConsumer(@NotNull final Language language) { - this.language = language; - } - - @Override - public void accept(@NotNull final InventoryClickEvent event) { - oreControlValues.getConfigValues().SET.setLanguage(language); - new ConfigGui(guiSettings, oreControlValues).openSync(event.getWhoClicked()); - } - - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyAction.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyAction.java deleted file mode 100644 index 42c669dd..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyAction.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.copy; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.spigot.utils.gui.InventoryGui; -import org.bukkit.entity.HumanEntity; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public interface CopyAction { - - void abort(@NotNull HumanEntity humanEntity); - - void back(@NotNull HumanEntity humanEntity); - - @NotNull - WorldOreConfig getWorldOreConfigSource(); - - void setWorldOreConfigTarget(@NotNull WorldOreConfig worldOreConfig); - - void setBiomeTarget(@NotNull Biome biome); - - void setSettingTarget(@NotNull Setting setting); - - void setChooseBiome(boolean bool); - - void setOreTarget(@NotNull Ore ore); - - void next(@NotNull HumanEntity humanEntity, @NotNull Supplier inventoryGui); - - boolean allowBack(); - - boolean isFilterWorldOreConfig(); - - boolean shouldSet(@NotNull Biome biome); - - boolean shouldSet(@NotNull Ore ore); - - boolean shouldSet(@NotNull Ore ore, @NotNull Biome biome); - - boolean shouldSet(@NotNull Setting setting); - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyBiomesAction.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyBiomesAction.java deleted file mode 100644 index 57727b5a..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyBiomesAction.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.copy; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.utils.CopyUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.gui.InventoryGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import org.apache.commons.lang.Validate; -import org.bukkit.entity.HumanEntity; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class CopyBiomesAction implements CopyAction { - - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final Supplier startGui; - @NotNull - private final WorldOreConfig worldOreConfigSource; - @NotNull - private final Biome[] biomes; - private WorldOreConfig worldOreConfigTarget; - - public CopyBiomesAction(@NotNull final OreControlValues oreControlValues, @NotNull Supplier startGui, @NotNull final WorldOreConfig worldOreConfigSource, @NotNull final Biome[] biomes) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - Validate.notNull(startGui, "Start Gui cannot be null"); - Validate.notNull(worldOreConfigSource, "WorldOreConfig cannot be null"); - Validate.notNull(biomes, "Biomes cannot be null"); - - this.oreControlValues = oreControlValues; - this.startGui = startGui; - this.worldOreConfigSource = worldOreConfigSource; - this.biomes = biomes; - } - - @Override - public void abort(@NotNull HumanEntity humanEntity) { - startGui.get().openSync(humanEntity); - } - - @Override - public void back(@NotNull HumanEntity humanEntity) { - throw new UnsupportedOperationException(); - } - - @NotNull - @Override - public WorldOreConfig getWorldOreConfigSource() { - return worldOreConfigSource; - } - - @Override - public void setWorldOreConfigTarget(@NotNull final WorldOreConfig worldOreConfig) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.worldOreConfigTarget = worldOreConfig; - } - - @Override - public void setBiomeTarget(@NotNull final Biome biome) { - throw new UnsupportedOperationException(); - } - - @Override - public void setSettingTarget(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - - @Override - public void setChooseBiome(final boolean bool) { - throw new UnsupportedOperationException(); - } - - @Override - public void setOreTarget(@NotNull final Ore ore) { - throw new UnsupportedOperationException(); - } - - @Override - public void next(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui) { - if (oreControlValues.getConfigValues().verifyCopyAction()) { - VerifyGui verifyGui = new VerifyGui(oreControlValues.getPlugin(), clickEvent -> { - for (Biome biome : biomes) { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, biome, biome); - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfigTarget); - startGui.get().openSync(clickEvent.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }, clickEvent1 -> inventoryGui.get().openSync(humanEntity)); - - verifyGui.addDecorations(); - - verifyGui.openSync(humanEntity); - - return; - } - - for (Biome biome : biomes) { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, biome, biome); - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfigSource); - startGui.get().openSync(humanEntity); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - } - - @Override - public boolean allowBack() { - return false; - } - - @Override - public boolean isFilterWorldOreConfig() { - return true; - } - - @Override - public boolean shouldSet(@NotNull final Biome biome) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean shouldSet(@NotNull final Ore ore) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean shouldSet(@NotNull final Ore ore, @NotNull final Biome biome) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean shouldSet(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOreAction.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOreAction.java deleted file mode 100644 index 1540c07a..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOreAction.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.copy; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.gui.BiomeGui; -import de.derfrzocker.ore.control.gui.OreGui; -import de.derfrzocker.ore.control.gui.WorldConfigGui; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.CopyUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.gui.InventoryGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import org.apache.commons.lang.Validate; -import org.bukkit.entity.HumanEntity; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.function.Consumer; -import java.util.function.Supplier; - -public class CopyOreAction implements CopyAction { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final Supplier startGui; - @NotNull - private final WorldOreConfig worldOreConfigSource; - @Nullable - private final Biome biomeSource; - @NotNull - private final Ore oreSource; - private Biome biomeTarget; - private Ore oreTarget; - private boolean chooseBiome; - private WorldOreConfig worldOreConfigTarget; - private int status = 0; - private final LinkedList> last = new LinkedList<>(); - - public CopyOreAction(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull Supplier startGui, @NotNull final WorldOreConfig worldOreConfigSource, @Nullable final Biome biomeSource, @NotNull final Ore oreSource) { - Validate.notNull(guiSettings, "GuiSettings cannot be null"); - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - Validate.notNull(startGui, "Start Gui cannot be null"); - Validate.notNull(worldOreConfigSource, "WorldOreConfig cannot be null"); - Validate.notNull(oreSource, "Ore cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.startGui = startGui; - this.worldOreConfigSource = worldOreConfigSource; - this.biomeSource = biomeSource; - this.oreSource = oreSource; - } - - @Override - public void abort(@NotNull HumanEntity humanEntity) { - startGui.get().openSync(humanEntity); - } - - @NotNull - @Override - public WorldOreConfig getWorldOreConfigSource() { - return worldOreConfigSource; - } - - @Override - public void setWorldOreConfigTarget(@NotNull final WorldOreConfig worldOreConfig) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.worldOreConfigTarget = worldOreConfig; - } - - @Override - public void setBiomeTarget(@NotNull final Biome biome) { - Validate.notNull(biome, "Biome cannot be null"); - - this.biomeTarget = biome; - } - - @Override - public void setSettingTarget(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - - @Override - public void setChooseBiome(final boolean bool) { - this.chooseBiome = bool; - } - - @Override - public void setOreTarget(@NotNull final Ore ore) { - Validate.notNull(ore, "Ore cannot be null"); - - this.oreTarget = ore; - } - - @Override - public void back(@NotNull HumanEntity humanEntity) { - if (status == 0) { - throw new UnsupportedOperationException(); - } - - if (last.size() != 0) { - status--; - last.removeLast().get().openSync(humanEntity); - return; - } - - throw new UnsupportedOperationException(); - } - - - @Override - public void next(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui) { - Validate.notNull(humanEntity, "HumanEntity cannot be null"); - Validate.notNull(inventoryGui, "InventoryGui cannot be null"); - - last.addLast(inventoryGui); - - if (status == 0) { - new WorldConfigGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, this).openSync(humanEntity); - status++; - return; - } - - if (status == 1) { - if (chooseBiome) { - new BiomeGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, this).openSync(humanEntity); - } else { - new OreGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, biomeTarget, this).openSync(humanEntity); - } - - status++; - return; - } - - if (status == 2 && chooseBiome) { - new OreGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, biomeTarget, this).openSync(humanEntity); - status++; - return; - } - - if (status == 2) { - openVerifyIfNeeded(humanEntity, inventoryGui, event -> { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, oreSource, oreTarget); - oreControlValues.getService().saveWorldOreConfig(worldOreConfigSource); - startGui.get().openSync(humanEntity); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }); - - status++; - return; - } - - if (status == 3) { - openVerifyIfNeeded(humanEntity, inventoryGui, event -> { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, oreSource, biomeSource, oreTarget, biomeTarget); - oreControlValues.getService().saveWorldOreConfig(worldOreConfigSource); - startGui.get().openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }); - - status++; - - } - } - - @Override - public boolean allowBack() { - return status != 0; - } - - @Override - public boolean isFilterWorldOreConfig() { - return false; - } - - @Override - public boolean shouldSet(@NotNull final Biome biome) { - for (final Ore ore : biome.getOres()) { - if (Arrays.equals(ore.getSettings(), oreSource.getSettings())) { - return true; - } - } - - return false; - } - - @Override - public boolean shouldSet(@NotNull final Ore ore) { - if (!Arrays.equals(ore.getSettings(), oreSource.getSettings())) { - return false; - } - - if (biomeSource != null) { - return true; - } - - if (worldOreConfigSource != worldOreConfigTarget && !worldOreConfigSource.getName().equals(worldOreConfigTarget.getName())) { - return true; - } - - return ore != oreSource; - } - - @Override - public boolean shouldSet(@NotNull final Ore ore, @NotNull final Biome biome) { - if (!Arrays.equals(ore.getSettings(), oreSource.getSettings())) { - return false; - } - - if (biomeSource == null) { - return true; - } - - if (worldOreConfigSource != worldOreConfigTarget && !worldOreConfigSource.getName().equals(worldOreConfigTarget.getName())) { - return true; - } - - if (biome != biomeSource) { - return true; - } - - return ore != oreSource; - } - - @Override - public boolean shouldSet(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - - private void openVerifyIfNeeded(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui, @NotNull final Consumer acceptAction) { - if (oreControlValues.getConfigValues().verifyCopyAction()) { - VerifyGui verifyGui = new VerifyGui(oreControlValues.getPlugin(), acceptAction, clickEvent1 -> { - status--; - last.removeLast(); - inventoryGui.get().openSync(humanEntity); - }); - - verifyGui.addDecorations(); - - verifyGui.openSync(humanEntity); - return; - } - - acceptAction.accept(null); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOresAction.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOresAction.java deleted file mode 100644 index 826558a2..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyOresAction.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.copy; - -import com.google.common.collect.Sets; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.gui.BiomeGui; -import de.derfrzocker.ore.control.gui.WorldConfigGui; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.CopyUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.gui.InventoryGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import org.apache.commons.lang.Validate; -import org.bukkit.entity.HumanEntity; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.LinkedList; -import java.util.Set; -import java.util.function.Consumer; -import java.util.function.Supplier; - -public class CopyOresAction implements CopyAction { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final Supplier startGui; - @NotNull - private final WorldOreConfig worldOreConfigSource; - @Nullable - private final Biome biomeSource; - @NotNull - private final Ore[] oresSource; - private WorldOreConfig worldOreConfigTarget; - private Biome biomeTarget; - private boolean chooseBiome; - private int status = 0; - private final LinkedList> last = new LinkedList<>(); - - public CopyOresAction(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull Supplier startGui, @NotNull final WorldOreConfig worldOreConfigSource, @Nullable final Biome biomeSource, @NotNull final Ore[] oresSource) { - Validate.notNull(guiSettings, "GuiSettings cannot be null"); - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - Validate.notNull(startGui, "Start Gui cannot be null"); - Validate.notNull(worldOreConfigSource, "WorldOreConfig cannot be null"); - Validate.notNull(oresSource, "Ores cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.worldOreConfigSource = worldOreConfigSource; - this.startGui = startGui; - this.biomeSource = biomeSource; - this.oresSource = oresSource; - } - - @NotNull - @Override - public WorldOreConfig getWorldOreConfigSource() { - return worldOreConfigSource; - } - - @Override - public void setWorldOreConfigTarget(@NotNull final WorldOreConfig worldOreConfig) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.worldOreConfigTarget = worldOreConfig; - } - - @Override - public void setBiomeTarget(@NotNull final Biome biome) { - Validate.notNull(biome, "Biome cannot be null"); - - this.biomeTarget = biome; - } - - @Override - public void setSettingTarget(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - - @Override - public void setChooseBiome(final boolean bool) { - this.chooseBiome = bool; - } - - @Override - public void setOreTarget(@NotNull final Ore ore) { - throw new UnsupportedOperationException(); - } - - @Override - public void abort(@NotNull HumanEntity humanEntity) { - startGui.get().openSync(humanEntity); - } - - @Override - public void back(@NotNull HumanEntity humanEntity) { - if (status == 0) { - throw new UnsupportedOperationException(); - } - - if (last.size() != 0) { - status--; - last.removeLast().get().openSync(humanEntity); - return; - } - - throw new UnsupportedOperationException(); - } - - @Override - public void next(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui) { - - last.addLast(inventoryGui); - - if (status == 0) { - new WorldConfigGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, this).openSync(humanEntity); - status++; - return; - } - - if (status == 1) { - if (chooseBiome) { - new BiomeGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, this).openSync(humanEntity); - } else { - openVerifyIfNeeded(humanEntity, inventoryGui, event -> { - if (biomeSource == null) { - for (Ore ore : oresSource) { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, ore, ore); - } - } else { - for (Ore ore : oresSource) { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, ore, biomeSource, ore); - } - } - - oreControlValues.getService().saveWorldOreConfig(worldOreConfigSource); - startGui.get().openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }); - } - - status++; - return; - } - - if (status == 2 && chooseBiome) { - openVerifyIfNeeded(humanEntity, inventoryGui, event -> { - if (biomeSource == null) { - final Set oreSet = Sets.newHashSet(biomeTarget.getOres()); - for (final Ore ore : oresSource) { - if (oreSet.contains(ore)) { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, ore, ore, biomeTarget); - } - } - } else { - final Set oreSet = Sets.newHashSet(biomeTarget.getOres()); - for (final Ore ore : oresSource) { - if (oreSet.contains(ore)) { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, ore, biomeSource, ore, biomeTarget); - } - } - } - - status++; - oreControlValues.getService().saveWorldOreConfig(worldOreConfigSource); - startGui.get().openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }); - } - - } - - @Override - public boolean allowBack() { - return status != 0; - } - - @Override - public boolean isFilterWorldOreConfig() { - return false; - } - - @Override - public boolean shouldSet(@NotNull final Biome biome) { - if (biomeSource == null) { - return true; - } - - if (worldOreConfigSource != worldOreConfigTarget && !worldOreConfigSource.getName().equals(worldOreConfigTarget.getName())) { - return true; - } - - return biomeSource != biome; - } - - @Override - public boolean shouldSet(@NotNull final Ore ore) { - return (worldOreConfigTarget != worldOreConfigSource && !worldOreConfigSource.getName().equals(worldOreConfigTarget.getName())) || biomeSource != null; - } - - @Override - public boolean shouldSet(@NotNull final Ore ore, @NotNull final Biome biome) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean shouldSet(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - - private void openVerifyIfNeeded(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui, @NotNull final Consumer acceptAction) { - if (oreControlValues.getConfigValues().verifyCopyAction()) { - VerifyGui verifyGui = new VerifyGui(oreControlValues.getPlugin(), acceptAction, clickEvent1 -> { - status--; - last.removeLast(); - inventoryGui.get().openSync(humanEntity); - }); - - verifyGui.addDecorations(); - - verifyGui.openSync(humanEntity); - return; - } - - acceptAction.accept(null); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopySettingAction.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopySettingAction.java deleted file mode 100644 index 565a6382..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopySettingAction.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.copy; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.gui.BiomeGui; -import de.derfrzocker.ore.control.gui.OreGui; -import de.derfrzocker.ore.control.gui.OreSettingsGui; -import de.derfrzocker.ore.control.gui.WorldConfigGui; -import de.derfrzocker.ore.control.gui.settings.GuiSettings; -import de.derfrzocker.ore.control.utils.CopyUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.gui.InventoryGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import org.apache.commons.lang.Validate; -import org.bukkit.entity.HumanEntity; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.LinkedList; -import java.util.function.Consumer; -import java.util.function.Supplier; - -public class CopySettingAction implements CopyAction { - - @NotNull - private final GuiSettings guiSettings; - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final Supplier startGui; - @NotNull - private final WorldOreConfig worldOreConfigSource; - @Nullable - private final Biome biomeSource; - @NotNull - private final Ore oreSource; - @NotNull - private final Setting settingSource; - private WorldOreConfig worldOreConfigTarget; - private Biome biomeTarget; - private Ore oreTarget; - private Setting settingTarget; - private boolean chooseBiome = false; - private int status = 0; - private final LinkedList> last = new LinkedList<>(); - - public CopySettingAction(@NotNull final GuiSettings guiSettings, @NotNull final OreControlValues oreControlValues, @NotNull Supplier startGui, @NotNull final WorldOreConfig worldOreConfigSource, @Nullable final Biome biomeSource, @NotNull final Ore oreSource, @NotNull final Setting settingSource) { - Validate.notNull(guiSettings, "GuiSettings cannot be null"); - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - Validate.notNull(startGui, "Start Gui cannot be null"); - Validate.notNull(worldOreConfigSource, "WorldOreConfig cannot be null"); - Validate.notNull(oreSource, "Ore cannot be null"); - Validate.notNull(settingSource, "Setting cannot be null"); - - this.guiSettings = guiSettings; - this.oreControlValues = oreControlValues; - this.startGui = startGui; - this.worldOreConfigSource = worldOreConfigSource; - this.biomeSource = biomeSource; - this.oreSource = oreSource; - this.settingSource = settingSource; - } - - @NotNull - @Override - public WorldOreConfig getWorldOreConfigSource() { - return worldOreConfigSource; - } - - @Override - public void setWorldOreConfigTarget(@NotNull final WorldOreConfig worldOreConfig) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.worldOreConfigTarget = worldOreConfig; - } - - @Override - public void setBiomeTarget(@NotNull final Biome biome) { - Validate.notNull(biome, "Biome cannot be null"); - - this.biomeTarget = biome; - } - - @Override - public void setSettingTarget(@NotNull final Setting setting) { - Validate.notNull(setting, "Setting cannot be null"); - - this.settingTarget = setting; - } - - @Override - public void setChooseBiome(final boolean bool) { - this.chooseBiome = bool; - } - - @Override - public void setOreTarget(@NotNull final Ore ore) { - Validate.notNull(ore, "Ore cannot be null"); - - this.oreTarget = ore; - } - - @Override - public void abort(@NotNull HumanEntity humanEntity) { - startGui.get().openSync(humanEntity); - } - - @Override - public void back(@NotNull HumanEntity humanEntity) { - if (status == 0) { - throw new UnsupportedOperationException(); - } - - if (last.size() != 0) { - status--; - last.removeLast().get().openSync(humanEntity); - return; - } - - throw new UnsupportedOperationException(); - } - - - @Override - public void next(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui) { - last.addLast(inventoryGui); - - if (status == 0) { - new WorldConfigGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, this).openSync(humanEntity); - status++; - return; - } - - if (status == 1) { - if (chooseBiome) { - new BiomeGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, this).openSync(humanEntity); - } else { - new OreGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, biomeTarget, this).openSync(humanEntity); - } - - status++; - return; - } - - if (status == 2 && chooseBiome) { - new OreGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, biomeTarget, this).openSync(humanEntity); - status++; - return; - } - - if (status == 2) { - new OreSettingsGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, biomeTarget, oreTarget, this).openSync(humanEntity); - status++; - return; - } - - if (status == 3 && chooseBiome) { - new OreSettingsGui(guiSettings, oreControlValues, humanEntity, worldOreConfigTarget, biomeTarget, oreTarget, this).openSync(humanEntity); - status++; - return; - } - - if (status == 3) { - openVerifyIfNeeded(humanEntity, inventoryGui, event -> { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, oreSource, settingSource, oreTarget, settingTarget); - oreControlValues.getService().saveWorldOreConfig(worldOreConfigSource); - startGui.get().openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }); - - status++; - return; - } - - if (status == 4) { - openVerifyIfNeeded(humanEntity, inventoryGui, event -> { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget, oreSource, biomeSource, settingSource, oreTarget, biomeTarget, settingTarget); - oreControlValues.getService().saveWorldOreConfig(worldOreConfigSource); - startGui.get().openSync(event.getWhoClicked()); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }); - - status++; - } - - } - - @Override - public boolean allowBack() { - return status != 0; - } - - @Override - public boolean isFilterWorldOreConfig() { - return false; - } - - @Override - public boolean shouldSet(@NotNull final Biome biome) { - return true; - } - - @Override - public boolean shouldSet(@NotNull final Ore ore) { - return true; - } - - @Override - public boolean shouldSet(@NotNull final Ore ore, @NotNull final Biome biome) { - return true; - } - - @Override - public boolean shouldSet(@NotNull final Setting setting) { - if (biomeSource != biomeTarget) { - return true; - } - - if (oreSource != oreTarget) { - return true; - } - - if (worldOreConfigSource != worldOreConfigTarget || !worldOreConfigSource.getName().equals(worldOreConfigTarget.getName())) { - return true; - } - - return settingSource != setting; - } - - private void openVerifyIfNeeded(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui, @NotNull final Consumer acceptAction) { - if (oreControlValues.getConfigValues().verifyCopyAction()) { - VerifyGui verifyGui = new VerifyGui(oreControlValues.getPlugin(), acceptAction, clickEvent1 -> { - status--; - last.removeLast(); - inventoryGui.get().openSync(humanEntity); - }); - - verifyGui.addDecorations(); - - verifyGui.openSync(humanEntity); - return; - } - - acceptAction.accept(null); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyWorldOreConfigAction.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyWorldOreConfigAction.java deleted file mode 100644 index 28748671..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/copy/CopyWorldOreConfigAction.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.copy; - -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import de.derfrzocker.ore.control.utils.CopyUtil; -import de.derfrzocker.ore.control.utils.OreControlValues; -import de.derfrzocker.spigot.utils.gui.InventoryGui; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import org.apache.commons.lang.Validate; -import org.bukkit.entity.HumanEntity; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class CopyWorldOreConfigAction implements CopyAction { - - @NotNull - private final OreControlValues oreControlValues; - @NotNull - private final Supplier startGui; - @NotNull - private final WorldOreConfig worldOreConfigSource; - private WorldOreConfig worldOreConfigTarget = null; - - public CopyWorldOreConfigAction(@NotNull final OreControlValues oreControlValues, @NotNull Supplier startGui, @NotNull final WorldOreConfig worldOreConfigSource) { - Validate.notNull(oreControlValues, "OreControlValues cannot be null"); - Validate.notNull(startGui, "Start Gui cannot be null"); - Validate.notNull(worldOreConfigSource, "WorldOreConfig cannot be null"); - - this.oreControlValues = oreControlValues; - this.startGui = startGui; - this.worldOreConfigSource = worldOreConfigSource; - } - - @Override - public void abort(@NotNull HumanEntity humanEntity) { - startGui.get().openSync(humanEntity); - } - - @Override - public void back(@NotNull HumanEntity humanEntity) { - throw new UnsupportedOperationException(); - } - - @NotNull - @Override - public WorldOreConfig getWorldOreConfigSource() { - return worldOreConfigSource; - } - - @Override - public void setWorldOreConfigTarget(@NotNull final WorldOreConfig worldOreConfig) { - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - this.worldOreConfigTarget = worldOreConfig; - } - - @Override - public void setBiomeTarget(@NotNull final Biome biome) { - throw new UnsupportedOperationException(); - } - - @Override - public void setSettingTarget(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - - @Override - public void setChooseBiome(final boolean bool) { - throw new UnsupportedOperationException(); - } - - @Override - public void setOreTarget(@NotNull final Ore ore) { - throw new UnsupportedOperationException(); - } - - @Override - public void next(@NotNull final HumanEntity humanEntity, @NotNull final Supplier inventoryGui) { - if (oreControlValues.getConfigValues().verifyCopyAction()) { - VerifyGui verifyGui = new VerifyGui(oreControlValues.getPlugin(), clickEvent -> { - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget); - oreControlValues.getService().saveWorldOreConfig(worldOreConfigTarget); - startGui.get().openSync(humanEntity); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - }, clickEvent1 -> inventoryGui.get().openSync(humanEntity)); - - verifyGui.addDecorations(); - - verifyGui.openSync(humanEntity); - return; - } - - CopyUtil.copy(oreControlValues.getService(), worldOreConfigSource, worldOreConfigTarget); - oreControlValues.getService().saveWorldOreConfig(worldOreConfigTarget); - startGui.get().openSync(humanEntity); - oreControlValues.getOreControlMessages().getGuiCopySuccessMessage().sendMessage(humanEntity); - } - - @Override - public boolean allowBack() { - return false; - } - - @Override - public boolean isFilterWorldOreConfig() { - return true; - } - - @Override - public boolean shouldSet(@NotNull final Biome biome) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean shouldSet(@NotNull final Ore ore) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean shouldSet(@NotNull final Ore ore, @NotNull final Biome biome) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean shouldSet(@NotNull final Setting setting) { - throw new UnsupportedOperationException(); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BiomeGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BiomeGuiSettings.java deleted file mode 100644 index 180b8893..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BiomeGuiSettings.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.gui.PageSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class BiomeGuiSettings extends PageSettings { - - public BiomeGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public BiomeGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public BiomeGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - @NotNull - public ItemStack getBiomeItemStack(@NotNull final String biome) { - final ItemStack itemStack = getSection().getItemStack("biomes." + biome); - - if (itemStack == null) { - throw new IllegalArgumentException("There is no ItemStack for the biome '" + biome + "'"); - } - - return itemStack.clone(); - } - - public int getBiomeGroupSwitchSlot() { - return getSection().getInt("biome-group.slot"); - } - - @NotNull - public ItemStack getBiomeGroupItemStack() { - return getSection().getItemStack("biome-group.group.item-stack").clone(); - } - - @NotNull - public ItemStack getBiomeItemStack() { - return getSection().getItemStack("biome-group.biome.item-stack").clone(); - } - - @NotNull - public ItemStack getInfoItemStack() { - return getSection().getItemStack("info.item-stack").clone(); - } - - public int getInfoSlot() { - return getSection().getInt("info.slot"); - } - - @NotNull - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - - public int getResetValueSlot() { - return getSection().getInt("value.reset.slot"); - } - - @NotNull - public ItemStack getResetValueItemStack() { - return getSection().getItemStack("value.reset.item-stack").clone(); - } - - public int getCopyValueSlot() { - return getSection().getInt("value.copy.slot"); - } - - @NotNull - public ItemStack getCopyValueItemStack() { - return getSection().getItemStack("value.copy.item-stack").clone(); - } - - public ItemStack getAbortItemStack() { - return getSection().getItemStack("abort.item-stack").clone(); - } - - public int getAbortSlot() { - return getSection().getInt("abort.slot"); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BooleanGuiSetting.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BooleanGuiSetting.java deleted file mode 100644 index 5dca0e75..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/BooleanGuiSetting.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.gui.BasicSettings; -import de.derfrzocker.spigot.utils.gui.VerifyGui; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class BooleanGuiSetting extends BasicSettings implements VerifyGui.VerifyGuiSettingsInterface { - - public BooleanGuiSetting(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public BooleanGuiSetting(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public BooleanGuiSetting(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - @Override - public int getAcceptSlot() { - return getSection().getInt("true.slot"); - } - - @Override - public ItemStack getAcceptItemStack() { - return getSection().getItemStack("true.item-stack").clone(); - } - - @Override - public ItemStack getDenyItemStack() { - return getSection().getItemStack("false.item-stack").clone(); - } - - @Override - public int getDenySlot() { - return getSection().getInt("false.slot"); - } - - @NotNull - public ItemStack getInfoItemStack() { - return getSection().getItemStack("info.item-stack").clone(); - } - - public int getInfoSlot() { - return getSection().getInt("info.slot"); - } - - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - -} \ No newline at end of file diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/ConfigGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/ConfigGuiSettings.java deleted file mode 100644 index 3af4b383..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/ConfigGuiSettings.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.gui.BasicSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class ConfigGuiSettings extends BasicSettings { - - public ConfigGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public ConfigGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public ConfigGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - public int getsafeModeSlot() { - return getSection().getInt("safe-mode.slot"); - } - - @NotNull - public ItemStack getsafeModeItemStack() { - return getSection().getItemStack("safe-mode.item-stack").clone(); - } - - public int getLanguageSlot() { - return getSection().getInt("language.slot"); - } - - @NotNull - public ItemStack getLanguageItemStack() { - return getSection().getItemStack("language.item-stack").clone(); - } - - public int getTranslateTabCompilationSlot() { - return getSection().getInt("translate-tab-compilation.slot"); - } - - @NotNull - public ItemStack getTranslateTabCompilationItemStack() { - return getSection().getItemStack("translate-tab-compilation.item-stack").clone(); - } - - public int getVerifyCopyActionSlot() { - return getSection().getInt("verify.copy-action.slot"); - } - - @NotNull - public ItemStack getVerifyCopyActionItemStack() { - return getSection().getItemStack("verify.copy-action.item-stack").clone(); - } - - public int getVerifyResetActionSlot() { - return getSection().getInt("verify.reset-action.slot"); - } - - @NotNull - public ItemStack getVerifyResetActionItemStack() { - return getSection().getItemStack("verify.reset-action.item-stack").clone(); - } - - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - - public ItemStack getReloadItemStack() { - return getSection().getItemStack("reload.item-stack").clone(); - } - - public int getReloadSlot() { - return getSection().getInt("reload.slot"); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/GuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/GuiSettings.java deleted file mode 100644 index bb0e8195..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/GuiSettings.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.Config; -import de.derfrzocker.spigot.utils.Version; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.util.function.Supplier; - -public class GuiSettings { - - @NotNull - private final Supplier biomeGuiSettings; - @NotNull - private final Supplier booleanGuiSetting; - @NotNull - private final Supplier configGuiSettings; - @NotNull - private final Supplier languageGuiSettings; - @NotNull - private final Supplier oreGuiSettings; - @NotNull - private final Supplier oreSettingsGuiSettings; - @NotNull - private final Supplier settingsGuiSettings; - @NotNull - private final Supplier worldConfigGuiSettings; - @NotNull - private final Supplier worldGuiSettings; - - public GuiSettings(@NotNull final BiomeGuiSettings biomeGuiSettings, @NotNull final BooleanGuiSetting booleanGuiSetting, @NotNull final ConfigGuiSettings configGuiSettings, @NotNull final LanguageGuiSettings languageGuiSettings, @NotNull final OreGuiSettings oreGuiSettings, @NotNull final OreSettingsGuiSettings oreSettingsGuiSettings, @NotNull final SettingsGuiSettings settingsGuiSettings, @NotNull final WorldConfigGuiSettings worldConfigGuiSettings, @NotNull final WorldGuiSettings worldGuiSettings) { - Validate.notNull(biomeGuiSettings, "BiomeGuiSettings cannot be null"); - Validate.notNull(booleanGuiSetting, "BooleanGuiSetting cannot be null"); - Validate.notNull(configGuiSettings, "ConfigGuiSettings cannot be null"); - Validate.notNull(languageGuiSettings, "LanguageGuiSettings cannot be null"); - Validate.notNull(oreGuiSettings, "OreGuiSettings cannot be null"); - Validate.notNull(oreSettingsGuiSettings, "OreSettingsGuiSettings cannot be null"); - Validate.notNull(settingsGuiSettings, "SettingsGuiSettings cannot be null"); - Validate.notNull(worldConfigGuiSettings, "WorldConfigGuiSettings cannot be null"); - Validate.notNull(worldGuiSettings, "WorldGuiSettings cannot be null"); - - this.biomeGuiSettings = () -> biomeGuiSettings; - this.booleanGuiSetting = () -> booleanGuiSetting; - this.configGuiSettings = () -> configGuiSettings; - this.languageGuiSettings = () -> languageGuiSettings; - this.oreGuiSettings = () -> oreGuiSettings; - this.oreSettingsGuiSettings = () -> oreSettingsGuiSettings; - this.settingsGuiSettings = () -> settingsGuiSettings; - this.worldConfigGuiSettings = () -> worldConfigGuiSettings; - this.worldGuiSettings = () -> worldGuiSettings; - } - - public GuiSettings(@NotNull final Plugin plugin, @NotNull final String directory, @NotNull final Version version) { - Validate.notNull(plugin, "Plugin cannot be null"); - Validate.notNull(directory, "Directory cannot be null"); - Validate.notNull(version, "Version cannot be null"); - - this.booleanGuiSetting = new SettingsSupplier() { - @NotNull - @Override - protected BooleanGuiSetting get0() { - checkFile(plugin, directory + "/boolean-gui.yml"); - return new BooleanGuiSetting(plugin, directory + "/boolean-gui.yml", true); - } - }; - - this.configGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected ConfigGuiSettings get0() { - checkFile(plugin, directory + "/config-gui.yml"); - return new ConfigGuiSettings(plugin, directory + "/config-gui.yml", true); - } - }; - - this.languageGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected LanguageGuiSettings get0() { - checkFile(plugin, directory + "/language-gui.yml"); - return new LanguageGuiSettings(plugin, directory + "/language-gui.yml", true); - } - }; - - this.settingsGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected SettingsGuiSettings get0() { - checkFile(plugin, directory + "/settings-gui.yml"); - return new SettingsGuiSettings(plugin, directory + "/settings-gui.yml", true); - } - }; - - this.worldConfigGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected WorldConfigGuiSettings get0() { - checkFile(plugin, directory + "/world-config-gui.yml"); - return new WorldConfigGuiSettings(plugin, directory + "/world-config-gui.yml", true); - } - }; - - if (version == Version.v1_13_R1 || version == Version.v1_13_R2) { - this.biomeGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected BiomeGuiSettings get0() { - checkFile(plugin, directory + "/biome-gui_v1.13.yml"); - return new BiomeGuiSettings(plugin, directory + "/biome-gui_v1.13.yml", true); - } - }; - - this.oreGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected OreGuiSettings get0() { - checkFile(plugin, directory + "/ore-gui_v1.13.yml"); - return new OreGuiSettings(plugin, directory + "/ore-gui_v1.13.yml", true); - } - }; - - this.oreSettingsGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected OreSettingsGuiSettings get0() { - checkFile(plugin, directory + "/ore-settings-gui_v1.13.yml"); - return new OreSettingsGuiSettings(plugin, directory + "/ore-settings-gui_v1.13.yml", true); - } - }; - - this.worldGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected WorldGuiSettings get0() { - checkFile(plugin, directory + "/world-gui_v1.13.yml"); - return new WorldGuiSettings(plugin, directory + "/world-gui_v1.13.yml", true); - } - }; - } else { - this.biomeGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected BiomeGuiSettings get0() { - checkFile(plugin, directory + "/biome-gui.yml"); - final BiomeGuiSettings settings = new BiomeGuiSettings(plugin, directory + "/biome-gui.yml", true); - - if (version.isNewerOrSameThan(Version.v1_14_R1)) { - checkFile(plugin, directory + "/biome-gui_v1.14.yml"); - settings.addValues(directory + "/biome-gui_v1.14.yml", true); - } - - if (version.isNewerOrSameThan(Version.v1_16_R1)) { - checkFile(plugin, directory + "/biome-gui_v1.16.yml"); - settings.addValues(directory + "/biome-gui_v1.16.yml", true); - } - - return settings; - } - }; - - this.oreGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected OreGuiSettings get0() { - checkFile(plugin, directory + "/ore-gui.yml"); - return new OreGuiSettings(plugin, directory + "/ore-gui.yml", true); - } - }; - - this.oreSettingsGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected OreSettingsGuiSettings get0() { - checkFile(plugin, directory + "/ore-settings-gui.yml"); - return new OreSettingsGuiSettings(plugin, directory + "/ore-settings-gui.yml", true); - } - }; - - this.worldGuiSettings = new SettingsSupplier() { - @NotNull - @Override - protected WorldGuiSettings get0() { - checkFile(plugin, directory + "/world-gui.yml"); - return new WorldGuiSettings(plugin, directory + "/world-gui.yml", true); - } - }; - - } - } - - @NotNull - public BiomeGuiSettings getBiomeGuiSettings() { - return this.biomeGuiSettings.get(); - } - - @NotNull - public BooleanGuiSetting getBooleanGuiSetting() { - return this.booleanGuiSetting.get(); - } - - @NotNull - public ConfigGuiSettings getConfigGuiSettings() { - return this.configGuiSettings.get(); - } - - @NotNull - public LanguageGuiSettings getLanguageGuiSettings() { - return this.languageGuiSettings.get(); - } - - @NotNull - public OreGuiSettings getOreGuiSettings() { - return this.oreGuiSettings.get(); - } - - @NotNull - public OreSettingsGuiSettings getOreSettingsGuiSettings() { - return this.oreSettingsGuiSettings.get(); - } - - @NotNull - public SettingsGuiSettings getSettingsGuiSettings() { - return this.settingsGuiSettings.get(); - } - - @NotNull - public WorldConfigGuiSettings getWorldConfigGuiSettings() { - return this.worldConfigGuiSettings.get(); - } - - @NotNull - public WorldGuiSettings getWorldGuiSettings() { - return this.worldGuiSettings.get(); - } - - - private abstract static class SettingsSupplier implements Supplier { - - @Nullable - private T setting; - - @Override - public T get() { - if (setting == null) { - setting = get0(); - } - - return setting; - } - - @NotNull - protected abstract T get0(); - - } - - private void checkFile(@NotNull Plugin plugin, @NotNull final String name) { - final File file = new File(plugin.getDataFolder(), name); - - if (!file.exists()) { - return; - } - - final YamlConfiguration configuration = new Config(file); - - final YamlConfiguration configuration2 = new Config(plugin.getResource(name)); - - if (configuration.getInt("version") == configuration2.getInt("version")) - return; - - plugin.getLogger().warning("File " + name + " has an outdated / new version, replacing it!"); - - if (!file.delete()) { - throw new RuntimeException("can't delete file " + name + " stop plugin start!"); - } - - plugin.saveResource(name, true); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/LanguageGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/LanguageGuiSettings.java deleted file mode 100644 index 097b520f..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/LanguageGuiSettings.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.Language; -import de.derfrzocker.spigot.utils.gui.BasicSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class LanguageGuiSettings extends BasicSettings { - - public LanguageGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public LanguageGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public LanguageGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - @NotNull - public ItemStack getLanguageItemStack(@NotNull final Language language) { - final ItemStack itemStack = getSection().getItemStack("language." + language + ".item-stack"); - - if (itemStack == null) { - throw new IllegalArgumentException("There is no ItemStack for the language '" + language + "'"); - } - - return itemStack.clone(); - } - - public int getLanguageSlot(@NotNull final Language language) { - return getSection().getInt("language." + language + ".slot"); - } - - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - - @NotNull - public ItemStack getInfoItemStack() { - return getSection().getItemStack("info.item-stack").clone(); - } - - public int getInfoSlot() { - return getSection().getInt("info.slot"); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreGuiSettings.java deleted file mode 100644 index ca2b3e97..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreGuiSettings.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.gui.PageSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class OreGuiSettings extends PageSettings { - - public OreGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public OreGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public OreGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - public ItemStack getInfoItemStack() { - return getSection().getItemStack("info.item-stack").clone(); - } - - public ItemStack getInfoBiomeItemStack() { - return getSection().getItemStack("info.biome-item-stack").clone(); - } - - public int getInfoSlot() { - return getSection().getInt("info.slot"); - } - - public String getDefaultOreItemStackSettingsFormat() { - return getSection().getString("default-ore.settings-format"); - } - - public ItemStack getDefaultOreItemStack() { - return getSection().getItemStack("default-ore.item-stack").clone(); - } - - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - - public int getResetValueSlot() { - return getSection().getInt("value.reset.slot"); - } - - public ItemStack getResetValueItemStack() { - return getSection().getItemStack("value.reset.item-stack").clone(); - } - - public int getCopyValueSlot() { - return getSection().getInt("value.copy.slot"); - } - - public ItemStack getCopyValueItemStack() { - return getSection().getItemStack("value.copy.item-stack").clone(); - } - - public ItemStack getAbortItemStack() { - return getSection().getItemStack("abort.item-stack").clone(); - } - - public int getAbortSlot() { - return getSection().getInt("abort.slot"); - } - -} \ No newline at end of file diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreSettingsGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreSettingsGuiSettings.java deleted file mode 100644 index e316ea21..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/OreSettingsGuiSettings.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.spigot.utils.gui.PageSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class OreSettingsGuiSettings extends PageSettings { - - public OreSettingsGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public OreSettingsGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public OreSettingsGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - @NotNull - public ItemStack getSettingsItemStack(@NotNull final Setting setting) { - final ItemStack itemStack = getSection().getItemStack("settings-item-stack." + setting.toString()); - - if (itemStack == null) { - throw new IllegalArgumentException("There is no ItemStack for the settings-item-stack '" + setting.toString() + "'"); - } - - return itemStack.clone(); - } - - @NotNull - public ItemStack getInfoItemStack() { - return getSection().getItemStack("info.item-stack").clone(); - } - - @NotNull - public ItemStack getInfoBiomeItemStack() { - return getSection().getItemStack("info.biome-item-stack").clone(); - } - - public int getInfoSlot() { - return getSection().getInt("info.slot"); - } - - @NotNull - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - - public int getStatusSlot() { - return getSection().getInt("status.slot"); - } - - @NotNull - public ItemStack getActivateItemStack() { - return getSection().getItemStack("status.activate").clone(); - } - - @NotNull - public ItemStack getDeactivateItemStack() { - return getSection().getItemStack("status.deactivate").clone(); - } - - public int getResetValueSlot() { - return getSection().getInt("value.reset.slot"); - } - - @NotNull - public ItemStack getResetValueItemStack() { - return getSection().getItemStack("value.reset.item-stack").clone(); - } - - public int getCopyValueSlot() { - return getSection().getInt("value.copy.slot"); - } - - @NotNull - public ItemStack getCopyValueItemStack() { - return getSection().getItemStack("value.copy.item-stack").clone(); - } - - public ItemStack getAbortItemStack() { - return getSection().getItemStack("abort.item-stack").clone(); - } - - public int getAbortSlot() { - return getSection().getInt("abort.slot"); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/SettingsGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/SettingsGuiSettings.java deleted file mode 100644 index 74854dab..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/SettingsGuiSettings.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.gui.BasicSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -public class SettingsGuiSettings extends BasicSettings { - - public SettingsGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public SettingsGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public SettingsGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - public int getOreSlot() { - return getSection().getInt("ore.slot"); - } - - @NotNull - public ItemStack getInfoItemStack() { - return getSection().getItemStack("info.item-stack").clone(); - } - - @NotNull - public ItemStack getInfoBiomeItemStack() { - return getSection().getItemStack("info.biome-item-stack").clone(); - } - - public int getInfoSlot() { - return getSection().getInt("info.slot"); - } - - @NotNull - public Set getItemStackValues() { - final Set set = new HashSet<>(); - getSection().getConfigurationSection("items"). - getKeys(false).stream(). - map(value -> getSection().getConfigurationSection("items." + value)). - map(value -> new SettingsGuiSettings.ItemStackValues(value.getInt("slot", 0), value.getDouble("value", 0), value.getItemStack("item-stack").clone())). - forEach(set::add); - return set; - } - - @NotNull - public ItemStack getDefaultOreItemStack() { - return getSection().getItemStack("default-ore-item-stack").clone(); - } - - @NotNull - public ItemStack getDefaultBiomeOreItemStack() { - return getSection().getItemStack("default-biome-ore-item-stack").clone(); - } - - @NotNull - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - - public int getResetValueSlot() { - return getSection().getInt("value.reset.slot"); - } - - @NotNull - public ItemStack getResetValueItemStack() { - return getSection().getItemStack("value.reset.item-stack").clone(); - } - - public int getCopyValueSlot() { - return getSection().getInt("value.copy.slot"); - } - - @NotNull - public ItemStack getCopyValueItemStack() { - return getSection().getItemStack("value.copy.item-stack").clone(); - } - - public static final class ItemStackValues { - private final int slot; - private final double value; - @NotNull - private final ItemStack itemStack; - - private ItemStackValues(final int slot, final double value, @NotNull final ItemStack itemStack) { - this.slot = slot; - this.value = value; - this.itemStack = itemStack; - } - - public int getSlot() { - return slot; - } - - public double getValue() { - return value; - } - - @NotNull - public ItemStack getItemStack() { - return itemStack; - } - - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldConfigGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldConfigGuiSettings.java deleted file mode 100644 index 9debc4c0..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldConfigGuiSettings.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.gui.BasicSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class WorldConfigGuiSettings extends BasicSettings { - - public WorldConfigGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public WorldConfigGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public WorldConfigGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - public int getBiomeItemStackSlot() { - return getSection().getInt("biome.slot"); - } - - @NotNull - public ItemStack getBiomeItemStack() { - return getSection().getItemStack("biome.item-stack").clone(); - } - - public int getOreItemStackSlot() { - return getSection().getInt("ore.slot"); - } - - @NotNull - public ItemStack getOreItemStack() { - return getSection().getItemStack("ore.item-stack").clone(); - } - - @NotNull - public ItemStack getBackItemStack() { - return getSection().getItemStack("back.item-stack").clone(); - } - - @NotNull - public ItemStack getInfoItemStack() { - return getSection().getItemStack("info.item-stack").clone(); - } - - public int getInfoSlot() { - return getSection().getInt("info.slot"); - } - - public int getBackSlot() { - return getSection().getInt("back.slot"); - } - - public int getResetValueSlot() { - return getSection().getInt("value.reset.slot"); - } - - @NotNull - public ItemStack getResetValueItemStack() { - return getSection().getItemStack("value.reset.item-stack").clone(); - } - - public int getCopyValueSlot() { - return getSection().getInt("value.copy.slot"); - } - - @NotNull - public ItemStack getCopyValueItemStack() { - return getSection().getItemStack("value.copy.item-stack").clone(); - } - - public int getTemplateDeleteSlot() { - return getSection().getInt("template.delete.slot"); - } - - @NotNull - public ItemStack getTemplateDeleteItemStack() { - return getSection().getItemStack("template.delete.item-stack").clone(); - } - - public ItemStack getAbortItemStack() { - return getSection().getItemStack("abort.item-stack").clone(); - } - - public int getAbortSlot() { - return getSection().getInt("abort.slot"); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldGuiSettings.java b/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldGuiSettings.java deleted file mode 100644 index 2a811708..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/gui/settings/WorldGuiSettings.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.gui.settings; - -import de.derfrzocker.spigot.utils.gui.PageSettings; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class WorldGuiSettings extends PageSettings { - - public WorldGuiSettings(@NotNull Plugin plugin, @NotNull String file) { - super(plugin, file); - } - - public WorldGuiSettings(@NotNull Plugin plugin, @NotNull String file, boolean copy) { - super(plugin, file, copy); - } - - public WorldGuiSettings(@NotNull Plugin plugin, @NotNull Supplier configurationSectionSupplier) { - super(plugin, configurationSectionSupplier); - } - - @NotNull - public ItemStack getWorldItemStack() { - return getSection().getItemStack("world-item-stack").clone(); - } - - @NotNull - public ItemStack getTemplateItemStack() { - return getSection().getItemStack("template.item-stack").clone(); - } - - @NotNull - public ItemStack getCreateTemplateItemStack() { - return getSection().getItemStack("template.create.item-stack").clone(); - } - - public int getCreateTemplateSlot() { - return getSection().getInt("template.create.slot"); - } - - public int getEditConfigSlot() { - return getSection().getInt("config.edit.slot"); - } - - @NotNull - public ItemStack getEditConfigItemStack() { - return getSection().getItemStack("config.edit.item-stack").clone(); - } - - public ItemStack getGlobalItemStack() { - return getSection().getItemStack("global.item-stack").clone(); - } - - public ItemStack getAbortItemStack() { - return getSection().getItemStack("abort.item-stack").clone(); - } - - public int getAbortSlot() { - return getSection().getInt("abort.slot"); - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/BaseComponentUtil.java b/ore-control/src/main/java/de/derfrzocker/ore/control/utils/BaseComponentUtil.java deleted file mode 100644 index 9b488db8..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/BaseComponentUtil.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.utils; - -import de.derfrzocker.ore.control.OreControlMessages; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; -import org.jetbrains.annotations.NotNull; - -public class BaseComponentUtil { - - public static BaseComponent[] combineBaseComponent(@NotNull final BaseComponent[] baseComponents, @NotNull final BaseComponent... baseComponents1) { - final int firstLength = baseComponents.length; - final int secondLength = baseComponents1.length; - final BaseComponent[] result = new BaseComponent[firstLength + secondLength]; - - System.arraycopy(baseComponents, 0, result, 0, firstLength); - System.arraycopy(baseComponents1, 0, result, firstLength, secondLength); - - return result; - } - - public static BaseComponent[] buildUrlButton(String text, String url, OreControlMessages messages) { - final BaseComponent[] begin = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', messages.getButtonOpenString().getRawMessage())); - final BaseComponent[] end = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', messages.getButtonCloseString().getRawMessage())); - - final BaseComponent[] buttons = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', text)); - final BaseComponent[] hoverEventMessage = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', messages.getClickMe().getRawMessage())); - final HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverEventMessage); - final ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, url); - - for (final BaseComponent button : buttons) { - button.setHoverEvent(hoverEvent); - button.setClickEvent(clickEvent); - } - - final BaseComponent[] first = combineBaseComponent(begin, buttons); - - return combineBaseComponent(first, end); - } - - public static BaseComponent[] buildLineWithUrlButton(String lineText, String clickText, String url, OreControlMessages messages) { - final String[] split = lineText.split("%%button%"); - - final BaseComponent[] button = buildUrlButton(clickText, url, messages); - - BaseComponent[] result = null; - - for (int i = 0; i < split.length; i++) { - final BaseComponent[] textPart = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', split[i])); - - if (result == null) { - result = textPart; - } else { - result = combineBaseComponent(result, textPart); - } - - if ((i + 1) < split.length) { - result = combineBaseComponent(result, button); - } - - if ((i + 1) == split.length && lineText.endsWith("%%button%")) { - result = combineBaseComponent(result, button); - } - - } - - return result; - } - -} - diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/CopyUtil.java b/ore-control/src/main/java/de/derfrzocker/ore/control/utils/CopyUtil.java deleted file mode 100644 index c32a280c..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/CopyUtil.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.utils; - -import com.google.common.collect.Sets; -import de.derfrzocker.ore.control.api.*; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class CopyUtil { - - /** - * Copy all values from the given WorldOreConfig to an other WorldOreConfig - * - * @param from the source of the values that get copy - * @param to the destinations of the values - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the WorldOreConfigs are the same or have the same name - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to) { //TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - valid(from, to); - ResetUtil.reset(to); - - from.getBiomeOreSettings().forEach((biome, biomeOreSettings) -> biomeOreSettings.getOreSettings().forEach((ore, oreSettings) -> { - oreSettings.getSettings().forEach(((setting, integer) -> service.setValue(to, biome, ore, setting, integer))); - service.setActivated(to, biome, ore, oreSettings.isActivated()); - })); - - from.getOreSettings().forEach((ore, oreSettings) -> { - oreSettings.getSettings().forEach(((setting, integer) -> service.setValue(to, ore, setting, integer))); - service.setActivated(to, ore, oreSettings.isActivated()); - }); - } - - /** - * Copy the OreSettings from the given Ore and the given WorldOreConfig to a new WorldOreConfig and a new. - * - * @param from the source of the values that get copy - * @param to the destinations of the values - * @param fromOre the source Ore - * @param toOre the destinations Ore - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the WorldOreConfigs and the Ores are the same - * @throws IllegalArgumentException if the given Ores dont have the same Settings - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Ore toOre) {//TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - valid(fromOre, toOre); - valid(from, to, fromOre, toOre); - ResetUtil.reset(to, toOre); - - from.getOreSettings(fromOre).ifPresent(oreSettings -> { - oreSettings.getSettings().forEach(((setting, integer) -> service.setValue(to, toOre, setting, integer))); - service.setActivated(to, toOre, oreSettings.isActivated()); - }); - } - - /** - * Copy the OreSettings from the given Ore and given source WorldOreConfig, - * to the destinations OreSettings in the specified Biome. - * - * @param from the source of the values that get copy - * @param to the destinations of the values - * @param fromOre the source Ore - * @param toOre the destinations Ore - * @param toBiome the destinations Biome - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the given Ores dont have the same Settings - * @throws IllegalArgumentException if the Biome destinations dont have the given Ore destinations - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Ore toOre, @NotNull final Biome toBiome) { //TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - Validate.notNull(toBiome, "Target Biome cannot be null"); - valid(fromOre, toOre); - valid(toBiome, toOre); - ResetUtil.reset(to, toOre, toBiome); - - from.getOreSettings(fromOre).ifPresent(oreSettings -> { - oreSettings.getSettings().forEach(((setting, integer) -> service.setValue(to, toBiome, toOre, setting, integer))); - service.setActivated(to, toBiome, toOre, oreSettings.isActivated()); - }); - } - - /** - * Copy the OreSettings from a specific Biome to an other OreSettings. - * - * @param from the source of the values that get copy - * @param to the destinations of the values - * @param fromOre the source Ore - * @param fromBiome the source Biome - * @param toOre the destinations Ore - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the given Ores dont have the same Settings - * @throws IllegalArgumentException if the Biome source dont have the given Ore source - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Biome fromBiome, @NotNull final Ore toOre) { //TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(fromBiome, "Source Biome cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - valid(fromBiome, fromOre); - valid(fromOre, toOre); - ResetUtil.reset(to, toOre); - - from.getBiomeOreSettings(fromBiome).flatMap(biomeOreSettings -> biomeOreSettings.getOreSettings(fromOre)).ifPresent(oreSettings -> { - oreSettings.getSettings().forEach((setting, integer) -> service.setValue(to, toOre, setting, integer)); - service.setActivated(to, toOre, oreSettings.isActivated()); - }); - - } - - /** - * Copy the OreSettings from a specific Biome to an other OreSettings in a specific Biome. - * - * @param from the source of the values that get copy - * @param to the destinations of the values - * @param fromOre the source Ore - * @param fromBiome the source Biome - * @param toOre the destinations Ore - * @param toBiome the destinations Biome - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the given Ores dont have the same Settings - * @throws IllegalArgumentException if the Biome source dont have the given Ore source - * @throws IllegalArgumentException if the Biome destination dont have the given Ore destination - * @throws IllegalArgumentException if the WorldOreConfig, Ore and Biome are the same - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Biome fromBiome, @NotNull final Ore toOre, @NotNull final Biome toBiome) { //TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(fromBiome, "Source Biome cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - Validate.notNull(toBiome, "Target Biome cannot be null"); - valid(fromOre, toOre); - valid(fromBiome, fromOre); - valid(toBiome, toOre); - valid(from, to, toOre, fromOre, toBiome, fromBiome); - ResetUtil.reset(to, toOre, toBiome); - - from.getBiomeOreSettings(fromBiome).flatMap(biomeOreSettings -> biomeOreSettings.getOreSettings(fromOre)).ifPresent(oreSettings -> { - oreSettings.getSettings().forEach((setting, integer) -> service.setValue(to, toBiome, toOre, setting, integer)); - service.setActivated(to, toBiome, toOre, oreSettings.isActivated()); - }); - } - - /** - * Copy all OreSettings from the given Biome to an other Biome. If the Target Biome dont need one OreSettings, - * for example EMERALD than this OreSetting dont get copy. - * - * @param from the source of the values that get copy - * @param to the destinations of the values - * @param fromBiome the source Biome - * @param toBiome the destinations Biome - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the given WorldOreConfig and the given Biome are the same - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Biome fromBiome, @NotNull final Biome toBiome) { //TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromBiome, "Source Biome cannot be null"); - Validate.notNull(toBiome, "Target Biome cannot be null"); - valid(from, to, fromBiome, toBiome); - ResetUtil.reset(to, toBiome); - - from.getBiomeOreSettings(fromBiome).ifPresent(biomeOreSettings -> biomeOreSettings.getOreSettings().values().stream().filter(oreSettings -> { - try { - valid(toBiome, oreSettings.getOre()); - } catch (final IllegalArgumentException e) { - return false; - } - - return true; - }).forEach(oreSettings -> { - oreSettings.getSettings().forEach((setting, integer) -> service.setValue(to, toBiome, oreSettings.getOre(), setting, integer)); - service.setActivated(to, toBiome, oreSettings.getOre(), oreSettings.isActivated()); - })); - - } - - /** - * Copy the value of the given Setting, Ore and WorldOreConfig to an other WorldOreConfig, Ore and Setting. - * - * @param from the source of the value that get copy - * @param to the destination of the value - * @param fromOre the source Ore - * @param fromSetting the source Setting - * @param toOre the destination Ore - * @param toSetting the destination Setting - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the given WorldOreConfig, Ore and Setting are the same - * @throws IllegalArgumentException if the Ore source dont have the given Setting source - * @throws IllegalArgumentException if the Ore destination dont have the given Setting destination - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Setting fromSetting, @NotNull final Ore toOre, @NotNull final Setting toSetting) { //TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(fromSetting, "Source Setting cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - Validate.notNull(toSetting, "Target Setting cannot be null"); - valid(from, to, fromOre, toOre, fromSetting, toSetting); - valid(fromOre, fromSetting); - valid(toOre, toSetting); - ResetUtil.reset(to, toOre, toSetting); - - from.getOreSettings(fromOre).flatMap(oreSettings -> oreSettings.getValue(fromSetting)).ifPresent(integer -> service.setValue(to, toOre, toSetting, integer)); - } - - /** - * Copy the value of the given Setting, Ore, Biome and WorldOreConfig to an other WorldOreConfig, Ore and Setting - * - * @param from the source of the value that get copy - * @param to the destination of the value - * @param fromOre the source Ore - * @param fromBiome the source Biome - * @param fromSetting the source Setting - * @param toOre the destination Ore - * @param toSetting the destination Setting - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the Biome source dont have the given Ore source - * @throws IllegalArgumentException if the Ore source dont have the given Setting source - * @throws IllegalArgumentException if the Ore destination dont have the given Setting destination - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Biome fromBiome, @NotNull final Setting fromSetting, @NotNull final Ore toOre, @NotNull final Setting toSetting) { //TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(fromBiome, "Source Biome cannot be null"); - Validate.notNull(fromSetting, "Source Setting cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - Validate.notNull(toSetting, "Target Setting cannot be null"); - valid(fromBiome, fromOre); - valid(fromOre, fromSetting); - valid(toOre, toSetting); - ResetUtil.reset(to, toOre, toSetting); - - from.getBiomeOreSettings(fromBiome).flatMap(biomeOreSettings -> biomeOreSettings.getOreSettings(fromOre)).flatMap(oreSettings -> oreSettings.getValue(fromSetting)).ifPresent(integer -> service.setValue(to, toOre, toSetting, integer)); - } - - /** - * Copy the value of the given Setting, Ore and WorldOreConfig to an other WorldOreConfig, Ore, Biome and Setting - * - * @param from the source of the value that get copy - * @param to the destination of the value - * @param fromOre the source Ore - * @param fromSetting the source Setting - * @param toOre the destination Ore - * @param toBiome the destination Biome - * @param toSetting the destination Setting - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the Ore source dont have the given Setting source - * @throws IllegalArgumentException if the Ore destination dont have the given Setting destination - * @throws IllegalArgumentException if the Biome destination dont have the given Ore destination - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Setting fromSetting, @NotNull final Ore toOre, @NotNull final Biome toBiome, @NotNull final Setting toSetting) {//TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(fromSetting, "Source Setting cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - Validate.notNull(toBiome, "Target Biome cannot be null"); - Validate.notNull(toSetting, "Target Setting cannot be null"); - valid(fromOre, fromSetting); - valid(toBiome, toOre); - valid(toOre, toSetting); - ResetUtil.reset(to, toOre, toBiome, toSetting); - - from.getOreSettings(fromOre).flatMap(oreSettings -> oreSettings.getValue(fromSetting)).ifPresent(integer -> service.setValue(to, toBiome, toOre, toSetting, integer)); - } - - /** - * Copy the value of the given Setting, Ore, Biome and WorldOreConfig to an other WorldOreConfig, Ore, Biome Setting - * - * @param from the source of the value that get copy - * @param to the destination of the value - * @param fromOre the source Ore - * @param fromBiome the source Biome - * @param fromSetting the source Setting - * @param toOre the destination Ore - * @param toBiome the destination Biome - * @param toSetting the destination Setting - * @throws IllegalArgumentException if one of the arguments is null - * @throws IllegalArgumentException if the Biome destination dont have the given Ore destination - * @throws IllegalArgumentException if the Ore source dont have the given Setting source - * @throws IllegalArgumentException if the Ore destination dont have the given Setting destination - * @throws IllegalArgumentException if the Biome destination dont have the given Ore destination - */ - public static void copy(@NotNull final OreControlService service, @NotNull final WorldOreConfig from, @NotNull final WorldOreConfig to, @NotNull final Ore fromOre, @NotNull final Biome fromBiome, @NotNull final Setting fromSetting, @NotNull final Ore toOre, @NotNull final Biome toBiome, @NotNull final Setting toSetting) {//TODO add test cases - Validate.notNull(service, "OreControlService cannot be null"); - Validate.notNull(from, "Source WorldOreConfig cannot be null"); - Validate.notNull(to, "Target WorldOreConfig cannot be null"); - Validate.notNull(fromOre, "Source Ore cannot be null"); - Validate.notNull(fromBiome, "Source Biome cannot be null"); - Validate.notNull(fromSetting, "Source Setting cannot be null"); - Validate.notNull(toOre, "Target Ore cannot be null"); - Validate.notNull(toBiome, "Target Biome cannot be null"); - Validate.notNull(toSetting, "Target Setting cannot be null"); - valid(from, to, fromOre, toOre, fromBiome, toBiome, fromSetting, toSetting); - valid(fromBiome, fromOre); - valid(fromOre, fromSetting); - valid(toBiome, toOre); - valid(toOre, toSetting); - ResetUtil.reset(to, toOre, toBiome, toSetting); - - from.getBiomeOreSettings(fromBiome).flatMap(biomeOreSettings -> biomeOreSettings.getOreSettings(fromOre)).flatMap(oreSettings -> oreSettings.getValue(fromSetting)).ifPresent(integer -> service.setValue(to, toBiome, toOre, toSetting, integer)); - } - - private static void valid(final Ore ore, final Setting setting) { - if (!Sets.newHashSet(ore.getSettings()).contains(setting)) { - throw new IllegalArgumentException("The Ore '" + ore + "' don't have the Setting '" + setting + "'!"); - } - } - - private static void valid(final Biome biome, final Ore ore) { - if (!Sets.newHashSet(biome.getOres()).contains(ore)) { - throw new IllegalArgumentException("The Biome '" + biome + "' don't have the Ore '" + ore + "'!"); - } - } - - private static void valid(final WorldOreConfig worldOreConfig, final WorldOreConfig worldOreConfig1) { - if (worldOreConfig == worldOreConfig1 || worldOreConfig.getName().equals(worldOreConfig1.getName())) { - throw new IllegalArgumentException("The given WorldOreConfig (" + worldOreConfig.getName() + ") are the same!"); - } - } - - private static void valid(final Ore ore, final Ore ore1) { - if (!Arrays.equals(ore.getSettings(), ore1.getSettings())) { - throw new IllegalArgumentException("The given Ore's ('" + ore + "' '" + ore1 + "') have not the same Settings!"); - } - } - - private static void valid(final WorldOreConfig worldOreConfig, final WorldOreConfig worldOreConfig1, final Ore ore, final Ore ore1) { - if ((worldOreConfig == worldOreConfig1 || worldOreConfig.getName().equals(worldOreConfig1.getName())) && ore == ore1) { - throw new IllegalArgumentException("The given WorldOreConfig (" + worldOreConfig.getName() + ") and the given Ores (" + ore + ") are the same!"); - } - } - - private static void valid(final WorldOreConfig worldOreConfig, final WorldOreConfig worldOreConfig1, final Ore ore, final Ore ore1, final Biome biome, final Biome biome1) { - if ((worldOreConfig == worldOreConfig1 || worldOreConfig.getName().equals(worldOreConfig1.getName())) && ore == ore1 && biome == biome1) { - throw new IllegalArgumentException("The given WorldOreConfig (" + worldOreConfig.getName() + "), the given Ores (" + ore + ") and the given Biomes (" + biome + ") are the same!"); - } - } - - private static void valid(final WorldOreConfig worldOreConfig, final WorldOreConfig worldOreConfig1, final Biome biome, final Biome biome1) { - if ((worldOreConfig == worldOreConfig1 || worldOreConfig.getName().equals(worldOreConfig1.getName())) && biome == biome1) { - throw new IllegalArgumentException("The given WorldOreConfig (" + worldOreConfig.getName() + ") and the given Biomes (" + biome + ") are the same!"); - } - } - - private static void valid(final WorldOreConfig worldOreConfig, final WorldOreConfig worldOreConfig1, final Ore ore, final Ore ore1, final Setting setting, final Setting setting1) { - if ((worldOreConfig == worldOreConfig1 || worldOreConfig.getName().equals(worldOreConfig1.getName())) && ore == ore1 && setting == setting1) { - throw new IllegalArgumentException("The given WorldOreConfig (" + worldOreConfig.getName() + "), the given Ores (" + ore + ") and the given Settings (" + setting + ") are the same!"); - } - } - - private static void valid(final WorldOreConfig worldOreConfig, final WorldOreConfig worldOreConfig1, final Ore ore, final Ore ore1, final Biome biome, final Biome biome1, final Setting setting, final Setting setting1) { - if ((worldOreConfig == worldOreConfig1 || worldOreConfig.getName().equals(worldOreConfig1.getName())) && ore == ore1 && biome == biome1 && setting == setting1) { - throw new IllegalArgumentException("The given WorldOreConfig (" + worldOreConfig.getName() + "), the given Ores (" + ore + "), the given Biomes (" + biome + ") and the given Settings (" + setting + ") are the same!"); - } - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlUtil.java b/ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlUtil.java deleted file mode 100644 index ca86532a..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlUtil.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.utils; - -import de.derfrzocker.ore.control.OreControl; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.spigot.utils.Version; -import de.derfrzocker.spigot.utils.message.MessageKey; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Stream; - -@SuppressWarnings("Duplicates") -@Deprecated -public class OreControlUtil { - - /** - * Returns if the given value is unsafe or safe. - * This only checks if the value is to low, this does not check if the value is to high. - * - * @param setting which must be non-null - * @param value that get checked - * @return true for unsafe false for safe - */ - public static boolean isUnSafe(@NotNull final Setting setting, final double value) { - Validate.notNull(setting, "Setting cannot be null"); - - return setting.getMinimumValue() > value; - } - - /** - * @return a map with translated Ore names - */ - public static HashMap getTranslatedOres() { //TODO add test cases - return getTranslatedOres(Ore.values()); - } - - /** - * @param ores which must be non-null - * @return a map with the translated Ore names of the given Ores - * @throws NullPointerException if Ore is null - */ - public static HashMap getTranslatedOres(@NotNull final Ore... ores) { //TODO add test cases - Validate.notNull(ores, "Ores cannot be null"); - - final HashMap map = new HashMap<>(); - - Stream.of(ores).forEach(value -> map.put(value, new MessageKey(OreControl.getInstance(), "ore." + value.toString()).getMessage().replace(" ", "_"))); - - return map; - } - - /** - * @return a map with all translated Biome names - */ - public static HashMap getTranslatedBiomes() { //TODO add test cases - final HashMap map = new HashMap<>(); - - Stream.of(Biome.values()).forEach(value -> map.put(value, new MessageKey(OreControl.getInstance(), "biome." + value.toString()).getMessage().replace(" ", "_"))); - - return map; - } - - /** - * @return a map with all translated Setting names - */ - public static HashMap getTranslatedSettings() { //TODO add test cases - return getTranslatedSettings(Setting.values()); - } - - /** - * @param settings which must be non-null - * @return a map with the translated Setting names of the given Settings - * @throws NullPointerException if Setting is null - */ - public static HashMap getTranslatedSettings(@NotNull final Setting... settings) { //TODO add test cases - Validate.notNull(settings, "Settings cannot be null"); - - final HashMap map = new HashMap<>(); - - Stream.of(settings).forEach(value -> map.put(value, new MessageKey(OreControl.getInstance(), "setting." + value.toString()).getMessage().replace(" ", "_"))); - - return map; - } - - /** - * Return an Optional that contains the Ore of the given String if translated is true it only checks the translated names. - * If false it only checks the Name of the Ores. If no Ore match the String it returns an empty Optional. - * - * @param oreName which must be non-null - * @param translated true if the oreName is translated or false if not - * @return an Optional describing the Ore of the given String, - * or an empty Optional if the String not match an Ore. - */ - public static Optional getOre(@NotNull final String oreName, final boolean translated) { //TODO add test cases - Validate.notNull(oreName, "Ore name cannot be null"); - - Optional optional; - - if (translated) { - optional = getTranslatedOres().entrySet().stream().filter(entry -> entry.getValue().equalsIgnoreCase(oreName)).findAny().map(Map.Entry::getKey); - } else { - try { - optional = Optional.of(Ore.valueOf(oreName.toUpperCase())); - } catch (final IllegalArgumentException e) { - optional = Optional.empty(); - } - } - - return optional; - } - - /** - * Return an Optional that contains the Ore of the given String if translated is true it only checks the translated names. - * If false it only checks the Name of the Ores. If no Ore match the String it returns an empty Optional. - *

- * Other as {@link #getOre(String, boolean)} this method only search through the given Oes. - * - * @param oreName which must be non-null - * @param translated true if the oreName is translated or false if not - * @param ores which must be non-null - * @return an Optional describing the Ore of the given String, - * or an empty Optional if the String not match an Ore. - */ - public static Optional getOre(@NotNull final String oreName, final boolean translated, @NotNull final Ore... ores) { //TODO add test cases - Validate.notNull(oreName, "Ore name cannot be null"); - Validate.notNull(ores, "Ores cannot be null"); - - Optional optional; - - if (translated) { - optional = getTranslatedOres(ores).entrySet().stream().filter(entry -> entry.getValue().equalsIgnoreCase(oreName)).findAny().map(Map.Entry::getKey); - } else { - try { - optional = Optional.of(Ore.valueOf(oreName.toUpperCase())); - } catch (final IllegalArgumentException e) { - optional = Optional.empty(); - } - } - - return optional; - } - - /** - * Return an Optional that contains the Biome of the given String if translated is true it only checks the translated names. - * If false it only checks the Name of the Biome. If no Biome match the String it returns an empty Optional. - * - * @param biomeName which must be non-null - * @param translated true if the biomeName is translated or false if not - * @return an Optional describing the Biome of the given String, - * or an empty Optional if the String not match an Biome. - */ - public static Optional getBiome(@NotNull final String biomeName, final boolean translated, @NotNull final Version version) { //TODO add test cases - Validate.notNull(biomeName, "Biome Name cannot be null"); - Validate.notNull(version, "Version cannot be null"); - - Optional optional; - - if (translated) { - optional = getTranslatedBiomes().entrySet().stream().filter(entry -> version.isNewerOrSameThan(entry.getKey().getSince())).filter(entry -> entry.getValue().equalsIgnoreCase(biomeName)).findAny().map(Map.Entry::getKey); - } else { - try { - optional = Optional.of(Biome.valueOf(biomeName.toUpperCase())); - if (version.isOlderThan(optional.get().getSince())) { - optional = Optional.empty(); - } - } catch (final IllegalArgumentException e) { - optional = Optional.empty(); - } - } - - return optional; - } - - /** - * Return an Optional that contains the Setting of the given String if translated is true it only checks the translated names. - * If false it only checks the Name of the Setting. If no Setting match the String it returns an empty Optional. - * - * @param settingName which must be non-null - * @param translated true if the settingName is translated or false if not - * @return an Optional describing the Setting of the given String, - * or an empty Optional if the String not match an Setting. - */ - public static Optional getSetting(@NotNull final String settingName, final boolean translated) { //TODO add test cases - Validate.notNull(settingName, "Setting Name cannot be null"); - - Optional optional; - - if (translated) { - optional = getTranslatedSettings().entrySet().stream().filter(entry -> entry.getValue().equalsIgnoreCase(settingName)).findAny().map(Map.Entry::getKey); - } else { - try { - optional = Optional.of(Setting.valueOf(settingName.toUpperCase())); - } catch (final IllegalArgumentException e) { - optional = Optional.empty(); - } - } - - return optional; - } - - /** - * Return an Optional that contains the Setting of the given String if translated is true it only checks the translated names. - * If false it only checks the Name of the Setting. If no Setting match the String it returns an empty Optional. - *

- * Other as {@link #getSetting(String, boolean)} this method only search through the given Settings. - * - * @param settingName which must be non-null - * @param translated true if the settingName is translated or false if not - * @param settings which must be non-null - * @return an Optional describing the Setting of the given String, - * or an empty Optional if the String not match an Setting. - */ - public static Optional getSetting(@NotNull final String settingName, final boolean translated, @NotNull final Setting... settings) { //TODO add test cases - Validate.notNull(settingName, "Setting name cannot be null"); - Validate.notNull(settings, "Settings cannot be null"); - - Optional optional; - - if (translated) { - optional = getTranslatedSettings(settings).entrySet().stream().filter(entry -> entry.getValue().equalsIgnoreCase(settingName)).findAny().map(Map.Entry::getKey); - } else { - try { - optional = Stream.of(settings).filter(value -> value.toString().equalsIgnoreCase(settingName.toUpperCase())).findAny(); - } catch (final IllegalArgumentException e) { - optional = Optional.empty(); - } - } - - return optional; - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlValues.java b/ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlValues.java deleted file mode 100644 index 3f1f93fa..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/OreControlValues.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.utils; - -import de.derfrzocker.ore.control.ConfigValues; -import de.derfrzocker.ore.control.OreControlMessages; -import de.derfrzocker.ore.control.Permissions; -import de.derfrzocker.ore.control.api.OreControlService; -import de.derfrzocker.spigot.utils.Version; -import org.apache.commons.lang.Validate; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.function.Supplier; - -public class OreControlValues { - - @NotNull - private final Supplier serviceSupplier; - @NotNull - private final Plugin plugin; - @NotNull - private final ConfigValues configValues; - @NotNull - private final OreControlMessages oreControlMessages; - @NotNull - private final Permissions permissions; - @NotNull - private final Version version; - - public OreControlValues(@NotNull final Supplier serviceSupplier, @NotNull final Plugin plugin, @NotNull final ConfigValues configValues, @NotNull final OreControlMessages oreControlMessages, @NotNull final Permissions permissions, @NotNull final Version version) { - Validate.notNull(serviceSupplier, "Service supplier cannot be null"); - Validate.notNull(plugin, "Plugin cannot be null"); - Validate.notNull(configValues, "ConfigValues cannot be null"); - Validate.notNull(oreControlMessages, "OreControlMessages cannot be null"); - Validate.notNull(permissions, "Permissions cannot be null"); - Validate.notNull(version, "Version cannot be null"); - - this.serviceSupplier = serviceSupplier; - this.plugin = plugin; - this.configValues = configValues; - this.oreControlMessages = oreControlMessages; - this.permissions = permissions; - this.version = version; - } - - @NotNull - public Supplier getServiceSupplier() { - return serviceSupplier; - } - - @NotNull - public OreControlService getService() { - return getServiceSupplier().get(); - } - - @NotNull - public Plugin getPlugin() { - return plugin; - } - - @NotNull - public ConfigValues getConfigValues() { - return configValues; - } - - @NotNull - public OreControlMessages getOreControlMessages() { - return oreControlMessages; - } - - @NotNull - public Permissions getPermissions() { - return permissions; - } - - @NotNull - public Version getVersion() { - return version; - } - -} diff --git a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/ResetUtil.java b/ore-control/src/main/java/de/derfrzocker/ore/control/utils/ResetUtil.java deleted file mode 100644 index 49c0a530..00000000 --- a/ore-control/src/main/java/de/derfrzocker/ore/control/utils/ResetUtil.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 - 2021 Marvin (DerFrZocker) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package de.derfrzocker.ore.control.utils; - -import com.google.common.collect.Sets; -import de.derfrzocker.ore.control.api.Biome; -import de.derfrzocker.ore.control.api.Ore; -import de.derfrzocker.ore.control.api.Setting; -import de.derfrzocker.ore.control.api.WorldOreConfig; -import org.apache.commons.lang.Validate; -import org.jetbrains.annotations.NotNull; - -public class ResetUtil { - - /** - * This clear all set values from the given WorldOreConfig, it not remove the OreSettings or the BiomeOreSettings Object itself. - * - * @param worldOreConfig that should reset - * @throws IllegalArgumentException if WorldOreConfig is null - */ - public static void reset(@NotNull final WorldOreConfig worldOreConfig) { //TODO add test cases - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - - worldOreConfig.getBiomeOreSettings().forEach(((biome, biomeOreSettings) -> biomeOreSettings.getOreSettings().forEach(((ore, oreSettings) -> { - oreSettings.getSettings().clear(); - oreSettings.setActivated(true); - })))); - - worldOreConfig.getOreSettings().forEach(((ore, oreSettings) -> { - oreSettings.getSettings().clear(); - oreSettings.setActivated(true); - })); - } - - /** - * Reset the values from the given Ore in the given WorldOreConfig. - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @throws IllegalArgumentException if WorldOreConfig or Ore is null - */ - public static void reset(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore) { //TODO add test cases - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - - worldOreConfig.getOreSettings(ore).ifPresent(oreSettings -> { - oreSettings.getSettings().clear(); - oreSettings.setActivated(true); - }); - } - - /** - * Reset the given Setting from the given Ore in the given WorldOreConfig. - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @param setting which must be non-null - * @throws IllegalArgumentException if WorldOreConfig, Ore or Setting is null - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - public static void reset(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore, @NotNull final Setting setting) { //TODO add test cases - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - - valid(ore, setting); - - worldOreConfig.getOreSettings(ore).ifPresent(oreSettings -> oreSettings.getSettings().remove(setting)); - } - - /** - * Reset all OreSettings from the given Biome in the given WorldOreConfig. - * - * @param worldOreConfig which must be non-null - * @param biome which must be non-null - * @throws IllegalArgumentException if WorldOreConfig or Biome is null - */ - public static void reset(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Biome biome) { //TODO add test cases - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(biome, "Biome cannot be null"); - - worldOreConfig.getBiomeOreSettings(biome).ifPresent(biomeOreSettings -> biomeOreSettings.getOreSettings().forEach((ore, oreSettings) -> { - oreSettings.getSettings().clear(); - oreSettings.setActivated(true); - })); - } - - /** - * Reset the OreSetting from the given Ore, in the given Biome, in the given WorldOreConfig. - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @param biome which must be non-null - * @throws IllegalArgumentException if WorldOreConfig, Ore or Biome is null - * @throws IllegalArgumentException if the Biome dont have the given Ore - */ - public static void reset(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore, @NotNull final Biome biome) {//TODO add test cases - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(biome, "Biome cannot be null"); - valid(biome, ore); - - worldOreConfig.getBiomeOreSettings(biome).flatMap(biomeOreSettings -> biomeOreSettings.getOreSettings(ore)).ifPresent(oreSettings -> { - oreSettings.getSettings().clear(); - oreSettings.setActivated(true); - }); - } - - /** - * Reset the Setting in the given Ore, in the given Biome, in the given WorldOreConfig. - * - * @param worldOreConfig which must be non-null - * @param ore which must be non-null - * @param biome which must be non-null - * @param setting which must be non-null - * @throws IllegalArgumentException if WorldOreConfig, Ore, Setting or Biome is null - * @throws IllegalArgumentException if the Biome dont have the given Ore - * @throws IllegalArgumentException if the Ore dont have the given Setting - */ - public static void reset(@NotNull final WorldOreConfig worldOreConfig, @NotNull final Ore ore, @NotNull final Biome biome, @NotNull final Setting setting) {//TODO add test cases - Validate.notNull(worldOreConfig, "WorldOreConfig cannot be null"); - Validate.notNull(ore, "Ore cannot be null"); - Validate.notNull(biome, "Biome cannot be null"); - Validate.notNull(setting, "Setting cannot be null"); - - valid(biome, ore); - valid(ore, setting); - - worldOreConfig.getBiomeOreSettings(biome).flatMap(biomeOreSettings -> biomeOreSettings.getOreSettings(ore)).ifPresent(oreSettings -> oreSettings.getSettings().remove(setting)); - } - - private static void valid(final Ore ore, final Setting setting) { - if (!Sets.newHashSet(ore.getSettings()).contains(setting)) { - throw new IllegalArgumentException("The Ore '" + ore + "' don't have the Setting '" + setting + "'!"); - } - } - - private static void valid(final Biome biome, final Ore ore) { - if (!Sets.newHashSet(biome.getOres()).contains(ore)) { - throw new IllegalArgumentException("The Biome '" + biome + "' don't have the Ore '" + ore + "'!"); - } - } - -} diff --git a/ore-control/src/main/resources/config.yml b/ore-control/src/main/resources/config.yml deleted file mode 100644 index d51e1baa..00000000 --- a/ore-control/src/main/resources/config.yml +++ /dev/null @@ -1,56 +0,0 @@ -################################################################################# -# --------------------------------------------------------------------------- # -# | ___ ____ _ _ | # -# | / _ \ _ __ ___ / ___| ___ _ __ | |_ _ __ ___ | | | # -# | | | | || '__|/ _ \ _____ | | / _ \ | '_ \ | __|| '__|/ _ \ | | | # -# | | |_| || | | __/|_____|| |___| (_) || | | || |_ | | | (_) || | | # -# | \___/ |_| \___| \____|\___/ |_| |_| \__||_| \___/ |_| | # -# | | # -# | | # -# | SOURCE CODE: https://github.com/DerFrZocker/Ore-Control | # -# | BUG REPORTS: https://github.com/DerFrZocker/Ore-Control/issues | # -# | Donation: https://www.paypal.me/DerFrZocker | # -# | Patreon: https://www.patreon.com/woollydevelopment | # -# | | # -# | You can find a version with comments here | # -# | https://github.com/DerFrZocker/Ore-Control/wiki/Config | # -# | | # -# | | # -# | NOTE: | # -# | PLEASE KEEP IN MIND, | # -# | THAT THE PLUGIN ONLY AFFECTS NEWLY GENERATED CHUNKS | # -# | | # -# --------------------------------------------------------------------------- # -#################################################################################. - - - -# When ever or not the plugin should allow you to set potential unsafe values, which can cause a server crash. -# 'true' (Default) : the plugin won't let you set potential unsafe values -# 'false' : the plugin will allow you to set potential unsafe values -safe-mode: true - -# The language of the message from this plugin -# Currently following languages are supported: -# 'english' (Default) -# 'german' / 'deutsch' (fully translated) -# 'chinese' / '中国' / '中國' (not fully translated) (Thanks to Pings for the translation) -# 'custom' (default english) -# -# You can also submit a new Language if you want. -# Simply translate the messages.yml in the Ore-Control folder and send it to me -language: english - -# If the tab compilation should also be translated -# Example instead of normal english '/orecontrol set value iron vein_size world 10' -# to the chosen language (in this example german) '/orecontrol set value eisen adergröße world 10' -# 'true' (Default) : translate -# 'false' : don't translate -translate-tab-compilation: true - -# If the plugin should ask for verification, if you copy or reset values via the gui -# 'true' (Default) : ask for verification -# 'false' : don't ask for verification -verify: - copy-action: true - reset-action: true \ No newline at end of file diff --git a/ore-control/src/main/resources/data/gui/biome-groups.yml b/ore-control/src/main/resources/data/gui/biome-groups.yml deleted file mode 100644 index 2b92f348..00000000 --- a/ore-control/src/main/resources/data/gui/biome-groups.yml +++ /dev/null @@ -1,100 +0,0 @@ -# Do not edit this file -biome-groups: - OCEAN: - - OCEAN - - FROZEN_OCEAN - - DEEP_OCEAN - - WARM_OCEAN - - LUKEWARM_OCEAN - - COLD_OCEAN - - DEEP_WARM_OCEAN - - DEEP_LUKEWARM_OCEAN - - DEEP_COLD_OCEAN - - DEEP_FROZEN_OCEAN - PLAINS: - - PLAINS - - SUNFLOWER_PLAINS - DESERT: - - DESERT - - DESERT_HILLS - - DESERT_LAKES - MOUNTAINS: - - MOUNTAINS - - SNOWY_MOUNTAINS - - WOODED_MOUNTAINS - - GRAVELLY_MOUNTAINS - - TAIGA_MOUNTAINS - - SNOWY_TAIGA_MOUNTAINS - - MODIFIED_GRAVELLY_MOUNTAINS - FOREST: - - FOREST - - BIRCH_FOREST - - BIRCH_FOREST_HILLS - - DARK_FOREST - - FLOWER_FOREST - - TALL_BIRCH_FOREST - - DARK_FOREST_HILLS - TAIGA: - - TAIGA - - TAIGA_HILLS - - SNOWY_TAIGA - - SNOWY_TAIGA_HILLS - - GIANT_TREE_TAIGA - - GIANT_TREE_TAIGA_HILLS - - TAIGA_MOUNTAINS - - SNOWY_TAIGA_MOUNTAINS - - GIANT_SPRUCE_TAIGA - - GIANT_SPRUCE_TAIGA_HILLS - SWAMP: - - SWAMP - - SWAMP_HILLS - RIVER: - - RIVER - - FROZEN_RIVER - BEACH: - - BEACH - - SNOWY_BEACH - JUNGLE: - - JUNGLE - - JUNGLE_HILLS - - JUNGLE_EDGE - - MODIFIED_JUNGLE - - MODIFIED_JUNGLE_EDGE - - BAMBOO_JUNGLE - - BAMBOO_JUNGLE_HILLS - SAVANNA: - - SAVANNA - - SAVANNA_PLATEAU - - SHATTERED_SAVANNA - - SHATTERED_SAVANNA_PLATEAU - BADLANDS: - - BADLANDS - - WOODED_BADLANDS_PLATEAU - - BADLANDS_PLATEAU - - ERODED_BADLANDS - - MODIFIED_WOODED_BADLANDS_PLATEAU - - MODIFIED_BADLANDS_PLATEAU - HILLS: - - DESERT_HILLS - - WOODED_HILLS - - TAIGA_HILLS - - JUNGLE_HILLS - - BIRCH_FOREST_HILLS - - SNOWY_TAIGA_HILLS - - GIANT_TREE_TAIGA_HILLS - - SWAMP_HILLS - - TALL_BIRCH_HILLS - - DARK_FOREST_HILLS - - GIANT_SPRUCE_TAIGA_HILLS - - BAMBOO_JUNGLE_HILLS - SNOWY: - - SNOWY_TUNDRA - - SNOWY_MOUNTAINS - - SNOWY_BEACH - - SNOWY_TAIGA - - SNOWY_TAIGA_HILLS - - SNOWY_TAIGA_MOUNTAINS - - - - diff --git a/ore-control/src/main/resources/data/gui/biome-gui.yml b/ore-control/src/main/resources/data/gui/biome-gui.yml deleted file mode 100644 index 8444fbd5..00000000 --- a/ore-control/src/main/resources/data/gui/biome-gui.yml +++ /dev/null @@ -1,939 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.biome.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -biome-group: - slot: 4 - biome: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.switch.biome.name]%' - lore: - - " " - - "%%translation:[gui.biome.switch.biome.click]%" - group: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.switch.biome-group.name]%' - lore: - - " " - - "%%translation:[gui.biome.switch.biome-group.click]%" -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page.name]%' - blockMaterial: OAK_SIGN - lore: - - " " - - "%%translation:[gui.next-page.click]%" -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page.name]%' - blockMaterial: OAK_SIGN - lore: - - " " - - "%%translation:[gui.previous-page.click]%" -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.reset.name]%' - lore: - - " " - - "%%translation:[gui.biome.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.copy.name]%' - lore: - - " " - - "%%translation:[gui.biome.copy.click]%" -biomes: - NETHER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHERRACK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.NETHER]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - PLAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: POPPY - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.PLAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DESERT: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DEAD_BUSH - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DESERT]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SWAMP: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BROWN_MUSHROOM - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SWAMP]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - RIVER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.RIVER]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FROZEN_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FROZEN_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FROZEN_RIVER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FROZEN_RIVER]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TUNDRA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TUNDRA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MUSHROOM_FIELDS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_MUSHROOM_BLOCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MUSHROOM_FIELDS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MUSHROOM_FIELD_SHORE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_MUSHROOM_BLOCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MUSHROOM_FIELD_SHORE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BEACH: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BEACH]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DESERT_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SANDSTONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DESERT_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WOODED_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WOODED_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MOUNTAIN_EDGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MOUNTAIN_EDGE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - JUNGLE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.JUNGLE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - JUNGLE_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.JUNGLE_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - JUNGLE_EDGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.JUNGLE_EDGE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - STONE_SHORE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.STONE_SHORE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_BEACH: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_BEACH]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BIRCH_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BIRCH_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BIRCH_FOREST_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BIRCH_FOREST_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DARK_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DARK_OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DARK_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_TREE_TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_TREE_TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_TREE_TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_TREE_TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WOODED_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WOODED_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SAVANNA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SAVANNA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SAVANNA_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SAVANNA_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BADLANDS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BADLANDS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WOODED_BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WOODED_BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - LUKEWARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.LUKEWARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - COLD_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.COLD_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_WARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_WARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_LUKEWARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_LUKEWARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_COLD_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_COLD_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_FROZEN_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_FROZEN_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SUNFLOWER_PLAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SUNFLOWER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SUNFLOWER_PLAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DESERT_LAKES: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DEAD_BUSH - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DESERT_LAKES]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GRAVELLY_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GRAVEL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GRAVELLY_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FLOWER_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TULIP - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FLOWER_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TAIGA_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TAIGA_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SWAMP_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BROWN_MUSHROOM - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SWAMP_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - ICE_SPIKES: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PACKED_ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.ICE_SPIKES]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_JUNGLE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_JUNGLE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_JUNGLE_EDGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_JUNGLE_EDGE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TALL_BIRCH_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TALL_BIRCH_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TALL_BIRCH_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TALL_BIRCH_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DARK_FOREST_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DARK_OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DARK_FOREST_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TAIGA_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TAIGA_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_SPRUCE_TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_SPRUCE_TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_SPRUCE_TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_SPRUCE_TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_GRAVELLY_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GRAVEL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_GRAVELLY_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SHATTERED_SAVANNA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SHATTERED_SAVANNA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SHATTERED_SAVANNA_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SHATTERED_SAVANNA_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - ERODED_BADLANDS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.ERODED_BADLANDS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_WOODED_BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_WOODED_BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GRASS_BLOCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" -biome_group: - slot: 8 - biome: - item_stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.biome]%' - group: - item_stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.biome_group]%' -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/biome-gui_v1.13.yml b/ore-control/src/main/resources/data/gui/biome-gui_v1.13.yml deleted file mode 100644 index b5dacd14..00000000 --- a/ore-control/src/main/resources/data/gui/biome-gui_v1.13.yml +++ /dev/null @@ -1,939 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.biome.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -biome-group: - slot: 4 - biome: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.switch.biome.name]%' - lore: - - " " - - "%%translation:[gui.biome.switch.biome.click]%" - group: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.switch.biome-group.name]%' - lore: - - " " - - "%%translation:[gui.biome.switch.biome-group.click]%" -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page.name]%' - blockMaterial: SIGN - lore: - - " " - - "%%translation:[gui.next-page.click]%" -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page.name]%' - blockMaterial: SIGN - lore: - - " " - - "%%translation:[gui.previous-page.click]%" -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.reset.name]%' - lore: - - " " - - "%%translation:[gui.biome.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.copy.name]%' - lore: - - " " - - "%%translation:[gui.biome.copy.click]%" -biomes: - NETHER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHERRACK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.NETHER]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - PLAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: POPPY - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.PLAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DESERT: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DEAD_BUSH - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DESERT]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SWAMP: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BROWN_MUSHROOM - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SWAMP]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - RIVER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.RIVER]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FROZEN_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FROZEN_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FROZEN_RIVER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FROZEN_RIVER]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TUNDRA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TUNDRA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MUSHROOM_FIELDS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_MUSHROOM_BLOCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MUSHROOM_FIELDS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MUSHROOM_FIELD_SHORE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_MUSHROOM_BLOCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MUSHROOM_FIELD_SHORE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BEACH: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BEACH]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DESERT_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SANDSTONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DESERT_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WOODED_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WOODED_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MOUNTAIN_EDGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MOUNTAIN_EDGE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - JUNGLE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.JUNGLE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - JUNGLE_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.JUNGLE_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - JUNGLE_EDGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.JUNGLE_EDGE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - STONE_SHORE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.STONE_SHORE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_BEACH: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_BEACH]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BIRCH_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BIRCH_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BIRCH_FOREST_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BIRCH_FOREST_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DARK_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DARK_OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DARK_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_TREE_TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_TREE_TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_TREE_TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_TREE_TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WOODED_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WOODED_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SAVANNA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SAVANNA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SAVANNA_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SAVANNA_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BADLANDS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BADLANDS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WOODED_BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WOODED_BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - LUKEWARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.LUKEWARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - COLD_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.COLD_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_WARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_WARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_LUKEWARM_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_LUKEWARM_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_COLD_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: WATER_BUCKET - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_COLD_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DEEP_FROZEN_OCEAN: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DEEP_FROZEN_OCEAN]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SUNFLOWER_PLAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SUNFLOWER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SUNFLOWER_PLAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DESERT_LAKES: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DEAD_BUSH - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DESERT_LAKES]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GRAVELLY_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GRAVEL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GRAVELLY_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - FLOWER_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TULIP - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.FLOWER_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TAIGA_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TAIGA_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SWAMP_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BROWN_MUSHROOM - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SWAMP_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - ICE_SPIKES: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PACKED_ICE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.ICE_SPIKES]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_JUNGLE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_JUNGLE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_JUNGLE_EDGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: JUNGLE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_JUNGLE_EDGE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TALL_BIRCH_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TALL_BIRCH_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - TALL_BIRCH_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BIRCH_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.TALL_BIRCH_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - DARK_FOREST_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: DARK_OAK_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.DARK_FOREST_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY_TAIGA_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY_TAIGA_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_SPRUCE_TAIGA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_SPRUCE_TAIGA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - GIANT_SPRUCE_TAIGA_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SPRUCE_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.GIANT_SPRUCE_TAIGA_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_GRAVELLY_MOUNTAINS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GRAVEL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_GRAVELLY_MOUNTAINS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SHATTERED_SAVANNA: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SHATTERED_SAVANNA]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SHATTERED_SAVANNA_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ACACIA_SAPLING - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SHATTERED_SAVANNA_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - ERODED_BADLANDS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.ERODED_BADLANDS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_WOODED_BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_WOODED_BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - MODIFIED_BADLANDS_PLATEAU: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.MODIFIED_BADLANDS_PLATEAU]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GRASS_BLOCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SNOWY: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SNOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SNOWY]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" -biome_group: - slot: 8 - biome: - item_stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.biome]%' - group: - item_stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE_BUTTON - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.biome.biome_group]%' -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/biome-gui_v1.14.yml b/ore-control/src/main/resources/data/gui/biome-gui_v1.14.yml deleted file mode 100644 index 373385ce..00000000 --- a/ore-control/src/main/resources/data/gui/biome-gui_v1.14.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Do not edit this file -version: 10 -biomes: - BAMBOO_JUNGLE: - ==: org.bukkit.inventory.ItemStack - v: 1631 - type: BAMBOO - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BAMBOO_JUNGLE]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BAMBOO_JUNGLE_HILLS: - ==: org.bukkit.inventory.ItemStack - v: 1631 - type: BAMBOO - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BAMBOO_JUNGLE_HILLS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" \ No newline at end of file diff --git a/ore-control/src/main/resources/data/gui/biome-gui_v1.16.yml b/ore-control/src/main/resources/data/gui/biome-gui_v1.16.yml deleted file mode 100644 index d4a43e5f..00000000 --- a/ore-control/src/main/resources/data/gui/biome-gui_v1.16.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Do not edit this file -version: 10 -biomes: - NETHER_WASTES: - ==: org.bukkit.inventory.ItemStack - v: 1631 - type: NETHERRACK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.NETHER_WASTES]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - SOUL_SAND_VALLEY: - ==: org.bukkit.inventory.ItemStack - v: 1631 - type: SOUL_SAND - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.SOUL_SAND_VALLEY]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - CRIMSON_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1631 - type: CRIMSON_FUNGUS - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.CRIMSON_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - WARPED_FOREST: - ==: org.bukkit.inventory.ItemStack - v: 1631 - type: WARPED_FUNGUS - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.WARPED_FOREST]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" - BASALT_DELTAS: - ==: org.bukkit.inventory.ItemStack - v: 1631 - type: BASALT - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[biome.BASALT_DELTAS]%' - lore: - - " " - - "%%translation:[gui.biome.%reset-copy%biome.click]%" \ No newline at end of file diff --git a/ore-control/src/main/resources/data/gui/boolean-gui.yml b/ore-control/src/main/resources/data/gui/boolean-gui.yml deleted file mode 100644 index 617439b9..00000000 --- a/ore-control/src/main/resources/data/gui/boolean-gui.yml +++ /dev/null @@ -1,88 +0,0 @@ -# Do not edit this file -version: 10 -rows: 4 -name: '%%translation:[gui.boolean.name]%' -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -'true': - slot: 21 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GREEN_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.boolean.set.true]%' - lore: - - " " - - '%%translation:[gui.boolean.true-click]%' -'false': - slot: 23 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.boolean.set.false]%' - lore: - - " " - - '%%translation:[gui.boolean.false-click]%' -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' \ No newline at end of file diff --git a/ore-control/src/main/resources/data/gui/config-gui.yml b/ore-control/src/main/resources/data/gui/config-gui.yml deleted file mode 100644 index 7c2f3dfe..00000000 --- a/ore-control/src/main/resources/data/gui/config-gui.yml +++ /dev/null @@ -1,153 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.config.name]%' -rows: 4 -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.config.back.click]%" -reload: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BOW - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.config.reload.name]%' - lore: - - " " - - "%%translation:[gui.config.reload.click]%" -language: - slot: 20 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.config.language.name]%' - lore: - - " " - - '%%translation:[gui.config.language.description]%' - - " " - - "%%translation:[gui.info.lore-current]%" - - "%%translation:[gui.info.lore-default]%" - - " " - - '%%translation:[gui.config.language.click]%' - internal: H4sIAAAAAAAAAEWRya6jVhRFqVIivXpK/iIz9ESP8SAD2/SGS2NzaZQJYGzfS2MaA4ZvykfGVZOMztHZe0l763wSxCfxx6kcq8rtH1dUFR/Ed+NC/JUL9FbMaemLz9nNF79h8q9UYsWvIud5MeNZjt1mn8TnG2qL/omK4Qfx8Sxez7Evhk+CIL59ED9O6NakPy/f/x2m6DkKojdFlGhxok/6Ih+ZLS4syaZfwbSdTwALs2MWu21Jm9wNQLmD814fvVsWSkmAs9kcGrW6LLQZdG5KHihRb8YmaeWq8gKjNkPLl6FMGq46bQetE46h7VQkCzIVzmW1UIHF0IvVcXGkv5Rr2bvudXpcl52xrzeIlISTFB+V1mLW+yO4XATuNuFZ1N/RDgu0TV7SVsGB1OYMxq69RgkZl9XThUdr33OL8RQltKWOVFcOUdfbLlQauqesw22jXo/X9amt6j6v6a2R2CdE42R4qNtL2dw33WMLKHHy8VqEq43vT1mOYkqPNNhQqmE/tOCi+r0O3dlytCF4hJUDnrmNSkVqXwcRurGLheyskAIMw3vPndUXhI/UOThp+opNXJ/d10PXl8PGahkOqHsm1DQ/pebsZNlmA6VAq7NT2WH/GDfSTDZsopo5H4eV2BxY3TkaZQrzmM6dLPbC6WgPkrPtOedElUMp1LVrnhRlPland49aT3BYKDmIioPrezFG+mCfUTtF4yA2pAKPF3gvXYaTfE+yo3rQ0VVC5NAVYzrAlZ+zeJWtHtHnGXQMlbl7SRj2Kxu7o64dGTrX+wbKccpnpHp3cZbfOkM/DnuR1g3PnMlzE4+SlVLckLPXUthJ7jW0zruD4BovJG9TwSz2nXkIW8Eji6Cc2pDFI/AGB5MLkBac3IECpb8/iN9hWo3Ft3+KxaTTkKlyzr9n0Q45WGGAnPPO2abBehPAqgxGs18yNmkzDZrJwRCN2mZsuWTjdccDzV7A6nF2CO6ObLBJ+ObkBAHZeP+6QgaaUa6bU1JXQxII9ywMkINMJY32bcyZQqapzzQUql8+tmqyWqUvkVkFNXxdwmpJQg85jb9cwuCdw68K3WfyGq4GbjdGBaxTwL/1Ab2ZwcAPlOo+ncuPyeL+91o102Y1xHmt1peDMCaRN100yF90uCQniX53YAD2BIB3HFj9EmjKe8I6XkFth+8dl2xyzukE33Ecxq/4bMxA82jnDEubTZAdqijGOzqpFcEOvSWuY3SNmC1BfBC/gbQuiD9l1KK8X6q0Rk1BEP8B6FWwXpQEAAA= - skull-owner: Dipicrylamine -safe-mode: - slot: 21 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BEDROCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.config.safe-mode.name]%' - lore: - - " " - - "%%translation:[gui.config.safe-mode.description]%" - - " " - - "%%translation:[gui.info.lore-current]%" - - "%%translation:[gui.info.lore-default]%" - - " " - - '%%translation:[gui.config.safe-mode.click]%' -translate-tab-compilation: - slot: 22 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PAPER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.config.translate-tab-compilation.name]%' - lore: - - " " - - "%%translation:[gui.config.translate-tab-compilation.description]%" - - " " - - "%%translation:[gui.info.lore-current]%" - - "%%translation:[gui.info.lore-default]%" - - " " - - '%%translation:[gui.config.translate-tab-compilation.click]%' -verify: - copy-action: - slot: 23 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.config.verify.copy-action.name]%' - lore: - - " " - - "%%translation:[gui.config.verify.copy-action.description]%" - - " " - - "%%translation:[gui.info.lore-current]%" - - "%%translation:[gui.info.lore-default]%" - - " " - - '%%translation:[gui.config.verify.copy-action.click]%' - reset-action: - slot: 24 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.config.verify.reset-action.name]%' - lore: - - " " - - "%%translation:[gui.config.verify.reset-action.description]%" - - " " - - "%%translation:[gui.info.lore-current]%" - - "%%translation:[gui.info.lore-default]%" - - " " - - '%%translation:[gui.config.verify.reset-action.click]%' -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' \ No newline at end of file diff --git a/ore-control/src/main/resources/data/gui/language-gui.yml b/ore-control/src/main/resources/data/gui/language-gui.yml deleted file mode 100644 index 3c020ca1..00000000 --- a/ore-control/src/main/resources/data/gui/language-gui.yml +++ /dev/null @@ -1,119 +0,0 @@ -# Do not edit this file -version: 10 -rows: 4 -name: '%%translation:[gui.language.name]%' -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -language: - GERMAN: - slot: 11 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '&fDeutsch' - internal: H4sIAAAAAAAAAE2PsW6DMBRFXytVoqif0RXJCTaUIUNUpMYoQCFAgjcwJuAYGiVQFb6rH1jGjlfnnOHqADq8HC6jUp+3r7pVQoNHWsGrU5r1Gy8Kg3AiDIxRYTiIIMOuLQs7dWU7QuigL9FV3IZW3J9BG8TPMN7EXQeABw2eskKNAn7F5CF2alB18hSfqLXs5IBUSOXVpn02le/Uot3Cd1trPzn/XDIUR6Jy02tYH41ll6G9GSuxi1e8S7+DY2qG7oXkMsK+m+MgOa/DpFK+PM9MbnHwERE/4TPrUhS6HIdujoLEN4M5WvuStb6MW+Y2knWZzGdu5jLoaL9y6mizWR7AHyk0BGccAQAA - lore: - - " " - - '&7>> &bKlicke, um Deutsch als Sprache zu wählen! &7<<' - ENGLISH: - slot: 10 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '&fEnglish' - internal: H4sIAAAAAAAAAE2OzU6DQBhFP01MkPgYbkmG35aFC2vRDukM0o4MsIMyDdChNhQM8FQ+onTn7t7cc5KrAqjwtD/1Un6238dKCgXucQHPjp3pWVEstFzPkWa5t4SsQhOZm9umsdTF0lBBnaWLaLtKXB9B6cTQ9a24qgBwp8BDlMlewK8YfZTGJSpiXx5G7Myd7ZEMcH1Z4HM05m/Ywc28b16d7ej+Y+0u47ZMTL9Mz2GfNxHamjspNjv90Hz9JE0kKScWZasybfyKGqEVrMOJ1ImeMA/RGg+Ev9cBJwZhUUMnMqUftKbcs1KGh4Ctbv5I18Up5d5EKt89xuhlfg9/zfkAfRgBAAA= - lore: - - " " - - '&7>> &bClick to select english as language! &7<<' - CHINESE: - slot: 12 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '&f中国' - internal: H4sIAAAAAAAAAE2PzU6DQBhFP01MkPgYbkmG4a8sXFShdEinaEuhMzso0xSYqU0LCj6XDyhLlzfnnMXVAXR42ra9lO/Xz2MthQb3pIJndBSlhT3XmJmVZ9izwjJmll8atueUpm9hs3CEDvoUXcS1q8XtEbRODF1/FTcdAO40eMgK2Qv4FWOM+P6Eqn0sDyNxp51ukUxIc/HIORvLN+ISNfHl3F2N/j/X6YrckcyKT/z80ZcqQytrI8VyYx7U7muNmcMU/aY/WcMjatOIDSwnJk/DIUlPijZSUbxoKeYtD+J6HcRtkoc4yReSNQzxaOck6RwnQWjT4LWempaNsX/co5fpAfwBiBRtoxwBAAA= - lore: - - " " - - '&7>> &bClick to select 中国 as language! &7<<' - CUSTOM: - slot: 13 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '&fCustom' - internal: H4sIAAAAAAAAAE2Oy06DQBhGf01MkPgYbkkGKbeFC2O1HdIOCpTL7CgzBIaZ2lAw0qfyEZ2lyy/nnOQzAUx4SIdZyo/xq+0lN+AWM3h0vYb7fuBbPqpba8XalRU4LLAcx/VbFq647XkmmDo683Hq+eUejIn/TPPILyYA3Bhwl9dy5vDLlwjRskOsjGSzYE/vLEUyxuLs41O+HF+xh5Xm2xdvt4T/XHeqC1dWTtTR0+d8VDnaOYnk28Ru1OG7Eu8DXSeKZklH1titimggorLphg6VIHIv3q577RCVqyqjHVHYphnr4+zwRDfav+YDyaSIC80LvJA0CtsSPev38AeMyEasGAEAAA== - lore: - - " " - - '%%translation:[gui.language.custom.click]%' -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/ore-gui.yml b/ore-control/src/main/resources/data/gui/ore-gui.yml deleted file mode 100644 index 881dd331..00000000 --- a/ore-control/src/main/resources/data/gui/ore-gui.yml +++ /dev/null @@ -1,163 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.ore.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page.name]%' - blockMaterial: OAK_SIGN - lore: - - " " - - "%%translation:[gui.next-page.click]%" -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page.name]%' - blockMaterial: OAK_SIGN - lore: - - " " - - "%%translation:[gui.previous-page.click]%" -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore.reset.name]%' - lore: - - " " - - "%%translation:[gui.ore.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore.copy.name]%' - lore: - - " " - - "%%translation:[gui.ore.copy.click]%" -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -default-ore: - settings-format: "%setting%: &d%value%" - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore.ore.name]%' - lore: - - " " - - "%%translation:[gui.ore.ore.status]%" - - " " - - " &7> &f%%settings%" - - " " - - "%%translation:[gui.ore.%reset-copy%ore.click]%" -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - ' ' - - '%%translation:[gui.info.lore-world]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== - biome-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - ' ' - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-biome]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/ore-gui_v1.13.yml b/ore-control/src/main/resources/data/gui/ore-gui_v1.13.yml deleted file mode 100644 index 67146966..00000000 --- a/ore-control/src/main/resources/data/gui/ore-gui_v1.13.yml +++ /dev/null @@ -1,163 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.ore.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page.name]%' - blockMaterial: SIGN - lore: - - " " - - "%%translation:[gui.next-page.click]%" -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page.name]%' - blockMaterial: SIGN - lore: - - " " - - "%%translation:[gui.previous-page.click]%" -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore.reset.name]%' - lore: - - " " - - "%%translation:[gui.ore.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore.copy.name]%' - lore: - - " " - - "%%translation:[gui.ore.copy.click]%" -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -default-ore: - settings-format: "%setting%: &d%value%" - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore.ore.name]%' - lore: - - " " - - "%%translation:[gui.ore.ore.status]%" - - " " - - " &7> &f%%settings%" - - " " - - "%%translation:[gui.ore.%reset-copy%ore.click]%" -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - ' ' - - '%%translation:[gui.info.lore-world]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== - biome-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - ' ' - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-biome]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/ore-settings-gui.yml b/ore-control/src/main/resources/data/gui/ore-settings-gui.yml deleted file mode 100644 index 07a79e7a..00000000 --- a/ore-control/src/main/resources/data/gui/ore-settings-gui.yml +++ /dev/null @@ -1,320 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.ore-settings.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page.name]%' - blockMaterial: OAK_SIGN - lore: - - " " - - "%%translation:[gui.next-page.click]%" -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page.name]%' - blockMaterial: OAK_SIGN - lore: - - " " - - "%%translation:[gui.previous-page.click]%" -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.reset.name]%' - lore: - - " " - - "%%translation:[gui.ore-settings.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.copy.name]%' - lore: - - " " - - "%%translation:[gui.ore-settings.copy.click]%" -status: - slot: 4 - deactivate: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GREEN_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.status.active.name]%' - lore: - - " " - - '%%translation:[gui.ore-settings.status.active.current]%' - - " " - - '%%translation:[gui.ore-settings.status.active.click]%' - activate: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.status.inactive.name]%' - lore: - - " " - - '%%translation:[gui.ore-settings.status.inactive.current]%' - - " " - - '%%translation:[gui.ore-settings.status.inactive.click]%' -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -settings-item-stack: - VEIN_SIZE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.VEIN_SIZE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - VEINS_PER_CHUNK: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.VEINS_PER_CHUNK]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - HEIGHT_RANGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.HEIGHT_RANGE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - HEIGHT_CENTER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.HEIGHT_CENTER]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - MINIMUM_ORES_PER_CHUNK: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.MINIMUM_ORES_PER_CHUNK]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - ORES_PER_CHUNK_RANGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.ORES_PER_CHUNK_RANGE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - MINIMUM_HEIGHT: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.MINIMUM_HEIGHT]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - HEIGHT_SUBTRACT_VALUE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.HEIGHT_SUBTRACT_VALUE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - VEINS_PER_BIOME: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.VEINS_PER_BIOME]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - SEA_LEVEL_DIVIDER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.SEA_LEVEL_DIVIDER]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - SEA_LEVEL_ADDER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.SEA_LEVEL_ADDER]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-ore]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== - biome-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: Info - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-biome]%' - - '%%translation:[gui.info.lore-ore]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/ore-settings-gui_v1.13.yml b/ore-control/src/main/resources/data/gui/ore-settings-gui_v1.13.yml deleted file mode 100644 index 96cebf30..00000000 --- a/ore-control/src/main/resources/data/gui/ore-settings-gui_v1.13.yml +++ /dev/null @@ -1,320 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.ore-settings.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page.name]%' - blockMaterial: SIGN - lore: - - " " - - "%%translation:[gui.next-page.click]%" -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page.name]%' - blockMaterial: SIGN - lore: - - " " - - "%%translation:[gui.previous-page.click]%" -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.reset.name]%' - lore: - - " " - - "%%translation:[gui.ore-settings.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.copy.name]%' - lore: - - " " - - "%%translation:[gui.ore-settings.copy.click]%" -status: - slot: 4 - deactivate: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GREEN_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.status.active.name]%' - lore: - - " " - - '%%translation:[gui.ore-settings.status.active.current]%' - - " " - - '%%translation:[gui.ore-settings.status.active.click]%' - activate: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.ore-settings.status.inactive.name]%' - lore: - - " " - - '%%translation:[gui.ore-settings.status.inactive.current]%' - - " " - - '%%translation:[gui.ore-settings.status.inactive.click]%' -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -settings-item-stack: - VEIN_SIZE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.VEIN_SIZE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - VEINS_PER_CHUNK: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.VEINS_PER_CHUNK]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - HEIGHT_RANGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.HEIGHT_RANGE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - HEIGHT_CENTER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.HEIGHT_CENTER]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - MINIMUM_ORES_PER_CHUNK: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.MINIMUM_ORES_PER_CHUNK]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - ORES_PER_CHUNK_RANGE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.ORES_PER_CHUNK_RANGE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - MINIMUM_HEIGHT: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.MINIMUM_HEIGHT]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - HEIGHT_SUBTRACT_VALUE: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.HEIGHT_SUBTRACT_VALUE]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - VEINS_PER_BIOME: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.VEINS_PER_BIOME]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - SEA_LEVEL_DIVIDER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.SEA_LEVEL_DIVIDER]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' - SEA_LEVEL_ADDER: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[setting.SEA_LEVEL_ADDER]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - " " - - '%%translation:[gui.ore-settings.%reset-copy%setting.click]%' -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-ore]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== - biome-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: Info - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-biome]%' - - '%%translation:[gui.info.lore-ore]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/settings-gui.yml b/ore-control/src/main/resources/data/gui/settings-gui.yml deleted file mode 100644 index 6c708235..00000000 --- a/ore-control/src/main/resources/data/gui/settings-gui.yml +++ /dev/null @@ -1,202 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.settings.name]%' -rows: 4 -ore: - slot: 22 -items: - '0': - slot: 20 - value: -1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f-1.0' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' - - " " - - "%%translation:[gui.settings.remove.click]%" - '1': - slot: 21 - value: -0.1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f-0.1' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' - - " " - - "%%translation:[gui.settings.remove.click]%" - '2': - slot: 23 - value: 0.1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GREEN_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f+0.1' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' - - " " - - "%%translation:[gui.settings.add.click]%" - '3': - slot: 24 - value: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GREEN_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f+1.0' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' - - " " - - "%%translation:[gui.settings.add.click]%" -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -default-ore-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[ore.%ore%]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' -default-biome-ore-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COAL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[ore.%ore%]%' - lore: - - " " - - '%%translation:[gui.info.lore-current]%' - - '%%translation:[gui.info.lore-default]%' -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-ore]%' - - '%%translation:[gui.info.lore-setting]%' - - '%%translation:[gui.info.lore-default]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== - biome-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - - '%%translation:[gui.info.lore-biome]%' - - '%%translation:[gui.info.lore-ore]%' - - '%%translation:[gui.info.lore-setting]%' - - '%%translation:[gui.info.lore-default]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.settings.reset.name]%' - lore: - - " " - - "%%translation:[gui.settings.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.settings.copy.name]%' - lore: - - " " - - "%%translation:[gui.settings.copy.click]%" -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/verify-gui.yml b/ore-control/src/main/resources/data/gui/verify-gui.yml deleted file mode 100644 index f19e1dfb..00000000 --- a/ore-control/src/main/resources/data/gui/verify-gui.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.verify.name]%' -rows: 4 -accept: - slot: 21 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GREEN_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.verify.accept.name]%' - lore: - - " " - - '%%translation:[gui.verify.accept.click]%' -deny: - slot: 23 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_TERRACOTTA - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.verify.deny.name]%' - lore: - - " " - - '%%translation:[gui.verify.deny.click]%' -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - diff --git a/ore-control/src/main/resources/data/gui/world-config-gui.yml b/ore-control/src/main/resources/data/gui/world-config-gui.yml deleted file mode 100644 index efc4b807..00000000 --- a/ore-control/src/main/resources/data/gui/world-config-gui.yml +++ /dev/null @@ -1,141 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.world-config.name]%' -rows: 4 -back: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: IRON_DOOR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.back.name]%' - lore: - - " " - - "%%translation:[gui.back.click]%" -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -biome: - slot: 21 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: GRASS_BLOCK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.world-config.biome.name]%' - lore: - - " " - - "%%translation:[gui.world-config.%reset-copy%biome.click]%" -ore: - slot: 23 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: STONE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.world-config.ore.name]%' - lore: - - " " - - "%%translation:[gui.world-config.%reset-copy%ore.click]%" -info: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '%%translation:[gui.info.name]%' - lore: - - " " - - '%%translation:[gui.info.lore-world]%' - internal: H4sIAAAAAAAAAE2PT0+DMByGf5qYIPFjeCUplDJ28GBkyUpW0K2DtTf+dHZQ5rKBjn0uP6AcPb55nufw2gA2PG3awZj389f+YJQF97SG533oeZgUoRMUIXb8kHhOOat8J0Cej8rSdXGhbLCn6KTO/UFdHsHq1bUfzupiA8CdBQ9ZYQYFv2qMkdxpVO9iU400mDbfIJPS5jSjx2ws32hAu4kvX4PVOP/nkr7IiRE41vL4MZRdhlZ4bdRy7Vbd9ltGlCT5grCmHdlNNoxXOM0zLRrdJbwaE17rNBI/yW2BUq51En1iFi1I0rSI5QKJThrGW5flW1/cpJGcXsUmnu936GV6AH9vPz7lHAEAAA== -value: - reset: - slot: 1 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: NETHER_STAR - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.world-config.reset.name]%' - lore: - - " " - - "%%translation:[gui.world-config.reset.click]%" - copy: - slot: 7 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.world-config.copy.name]%' - lore: - - " " - - "%%translation:[gui.world-config.copy.click]%" -template: - delete: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: ANVIL - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.world-config.delete.name]%' - lore: - - " " - - "%%translation:[gui.world-config.delete.click]%" -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/world-gui.yml b/ore-control/src/main/resources/data/gui/world-gui.yml deleted file mode 100644 index f33b346a..00000000 --- a/ore-control/src/main/resources/data/gui/world-gui.yml +++ /dev/null @@ -1,144 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.world.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page]%' - blockMaterial: OAK_SIGN -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: OAK_SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page]%' - blockMaterial: OAK_SIGN -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -world-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '&f%world%' - lore: - - " " - - "%%translation:[gui.world.type]%" - - " " - - '%%translation:[gui.world.%reset-copy%world.click]%' - internal: H4sIAAAAAAAAAEWRya6jVhRFqVIivXpK/iIz9ESP8SAD2/SGS2NzaZQJYGzfS2MaA4ZvykfGVZOMztHZe0l763wSxCfxx6kcq8rtH1dUFR/Ed+NC/JUL9FbMaemLz9nNF79h8q9UYsWvIud5MeNZjt1mn8TnG2qL/omK4Qfx8Sxez7Evhk+CIL59ED9O6NakPy/f/x2m6DkKojdFlGhxok/6Ih+ZLS4syaZfwbSdTwALs2MWu21Jm9wNQLmD814fvVsWSkmAs9kcGrW6LLQZdG5KHihRb8YmaeWq8gKjNkPLl6FMGq46bQetE46h7VQkCzIVzmW1UIHF0IvVcXGkv5Rr2bvudXpcl52xrzeIlISTFB+V1mLW+yO4XATuNuFZ1N/RDgu0TV7SVsGB1OYMxq69RgkZl9XThUdr33OL8RQltKWOVFcOUdfbLlQauqesw22jXo/X9amt6j6v6a2R2CdE42R4qNtL2dw33WMLKHHy8VqEq43vT1mOYkqPNNhQqmE/tOCi+r0O3dlytCF4hJUDnrmNSkVqXwcRurGLheyskAIMw3vPndUXhI/UOThp+opNXJ/d10PXl8PGahkOqHsm1DQ/pebsZNlmA6VAq7NT2WH/GDfSTDZsopo5H4eV2BxY3TkaZQrzmM6dLPbC6WgPkrPtOedElUMp1LVrnhRlPland49aT3BYKDmIioPrezFG+mCfUTtF4yA2pAKPF3gvXYaTfE+yo3rQ0VVC5NAVYzrAlZ+zeJWtHtHnGXQMlbl7SRj2Kxu7o64dGTrX+wbKccpnpHp3cZbfOkM/DnuR1g3PnMlzE4+SlVLckLPXUthJ7jW0zruD4BovJG9TwSz2nXkIW8Eji6Cc2pDFI/AGB5MLkBac3IECpb8/iN9hWo3Ft3+KxaTTkKlyzr9n0Q45WGGAnPPO2abBehPAqgxGs18yNmkzDZrJwRCN2mZsuWTjdccDzV7A6nF2CO6ObLBJ+ObkBAHZeP+6QgaaUa6bU1JXQxII9ywMkINMJY32bcyZQqapzzQUql8+tmqyWqUvkVkFNXxdwmpJQg85jb9cwuCdw68K3WfyGq4GbjdGBaxTwL/1Ab2ZwcAPlOo+ncuPyeL+91o102Y1xHmt1peDMCaRN100yF90uCQniX53YAD2BIB3HFj9EmjKe8I6XkFth+8dl2xyzukE33Ecxq/4bMxA82jnDEubTZAdqijGOzqpFcEOvSWuY3SNmC1BfBC/gbQuiD9l1KK8X6q0Rk1BEP8B6FWwXpQEAAA= - skull-owner: Dipicrylamine -template: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PAPER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%template%' - lore: - - " " - - "%%translation:[gui.world.type]%" - - " " - - '%%translation:[gui.world.%reset-copy%template.click]%' - create: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PAPER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.world.template.create.name]%' - lore: - - " " - - "%%translation:[gui.world.template.create.create]%" -global: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BOOK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[config-type.GLOBAL]%' - lore: - - " " - - "%%translation:[gui.world.type]%" - - " " - - '%%translation:[gui.world.%reset-copy%global.click]%' -config: - edit: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COMPARATOR - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.world.config.name]%' - blockMaterial: COMPARATOR - lore: - - " " - - "%%translation:[gui.world.config.click]%" -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/gui/world-gui_v1.13.yml b/ore-control/src/main/resources/data/gui/world-gui_v1.13.yml deleted file mode 100644 index 03b61771..00000000 --- a/ore-control/src/main/resources/data/gui/world-gui_v1.13.yml +++ /dev/null @@ -1,144 +0,0 @@ -# Do not edit this file -version: 10 -name: '%%translation:[gui.world.name]%' -rows: 4 -gap: 1 -empty-rows: - up: 1 - below: 0 -next-page: - slot: 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.next-page]%' - blockMaterial: SIGN -previous-page: - slot: 0 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: SIGN - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.previous-page]%' - blockMaterial: SIGN -abort: - slot: 4 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BARRIER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.abort.name]%' - lore: - - " " - - "%%translation:[gui.abort.click]%" -world-item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PLAYER_HEAD - meta: - ==: ItemMeta - meta-type: SKULL - display-name: '&f%world%' - lore: - - " " - - "%%translation:[gui.world.type]%" - - " " - - '%%translation:[gui.world.%reset-copy%world.click]%' - internal: H4sIAAAAAAAAAEWRya6jVhRFqVIivXpK/iIz9ESP8SAD2/SGS2NzaZQJYGzfS2MaA4ZvykfGVZOMztHZe0l763wSxCfxx6kcq8rtH1dUFR/Ed+NC/JUL9FbMaemLz9nNF79h8q9UYsWvIud5MeNZjt1mn8TnG2qL/omK4Qfx8Sxez7Evhk+CIL59ED9O6NakPy/f/x2m6DkKojdFlGhxok/6Ih+ZLS4syaZfwbSdTwALs2MWu21Jm9wNQLmD814fvVsWSkmAs9kcGrW6LLQZdG5KHihRb8YmaeWq8gKjNkPLl6FMGq46bQetE46h7VQkCzIVzmW1UIHF0IvVcXGkv5Rr2bvudXpcl52xrzeIlISTFB+V1mLW+yO4XATuNuFZ1N/RDgu0TV7SVsGB1OYMxq69RgkZl9XThUdr33OL8RQltKWOVFcOUdfbLlQauqesw22jXo/X9amt6j6v6a2R2CdE42R4qNtL2dw33WMLKHHy8VqEq43vT1mOYkqPNNhQqmE/tOCi+r0O3dlytCF4hJUDnrmNSkVqXwcRurGLheyskAIMw3vPndUXhI/UOThp+opNXJ/d10PXl8PGahkOqHsm1DQ/pebsZNlmA6VAq7NT2WH/GDfSTDZsopo5H4eV2BxY3TkaZQrzmM6dLPbC6WgPkrPtOedElUMp1LVrnhRlPland49aT3BYKDmIioPrezFG+mCfUTtF4yA2pAKPF3gvXYaTfE+yo3rQ0VVC5NAVYzrAlZ+zeJWtHtHnGXQMlbl7SRj2Kxu7o64dGTrX+wbKccpnpHp3cZbfOkM/DnuR1g3PnMlzE4+SlVLckLPXUthJ7jW0zruD4BovJG9TwSz2nXkIW8Eji6Cc2pDFI/AGB5MLkBac3IECpb8/iN9hWo3Ft3+KxaTTkKlyzr9n0Q45WGGAnPPO2abBehPAqgxGs18yNmkzDZrJwRCN2mZsuWTjdccDzV7A6nF2CO6ObLBJ+ObkBAHZeP+6QgaaUa6bU1JXQxII9ywMkINMJY32bcyZQqapzzQUql8+tmqyWqUvkVkFNXxdwmpJQg85jb9cwuCdw68K3WfyGq4GbjdGBaxTwL/1Ab2ZwcAPlOo+ncuPyeL+91o102Y1xHmt1peDMCaRN100yF90uCQniX53YAD2BIB3HFj9EmjKe8I6XkFth+8dl2xyzukE33Ecxq/4bMxA82jnDEubTZAdqijGOzqpFcEOvSWuY3SNmC1BfBC/gbQuiD9l1KK8X6q0Rk1BEP8B6FWwXpQEAAA= - skull-owner: Dipicrylamine -template: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PAPER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%template%' - lore: - - " " - - "%%translation:[gui.world.type]%" - - " " - - '%%translation:[gui.world.%reset-copy%template.click]%' - create: - slot: 5 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: PAPER - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '%%translation:[gui.world.template.create.name]%' - lore: - - " " - - "%%translation:[gui.world.template.create.create]%" -global: - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BOOK - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: '&f%%translation:[config-type.GLOBAL]%' - lore: - - " " - - "%%translation:[gui.world.type]%" - - " " - - '%%translation:[gui.world.%reset-copy%global.click]%' -config: - edit: - slot: 3 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: COMPARATOR - meta: - ==: ItemMeta - meta-type: TILE_ENTITY - display-name: '%%translation:[gui.world.config.name]%' - blockMaterial: COMPARATOR - lore: - - " " - - "%%translation:[gui.world.config.click]%" -decorations: - '0': - slot: - - 0 - - 1 - - 3 - - 5 - - 7 - - 8 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: RED_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' - '1': - slot: - - 2 - - 4 - - 6 - item-stack: - ==: org.bukkit.inventory.ItemStack - v: 1519 - type: BLACK_STAINED_GLASS_PANE - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ' ' diff --git a/ore-control/src/main/resources/data/settings.yml b/ore-control/src/main/resources/data/settings.yml deleted file mode 100644 index ab325c54..00000000 --- a/ore-control/src/main/resources/data/settings.yml +++ /dev/null @@ -1,203 +0,0 @@ -# Do not edit this file -defaults: - ore-settings: - - ==: OreControl#OreSettings - ore: DIAMOND - settings: - VEIN_SIZE: 8 - VEINS_PER_CHUNK: 1 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 16 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: REDSTONE - settings: - VEIN_SIZE: 8 - VEINS_PER_CHUNK: 8 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 16 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: COAL - settings: - VEIN_SIZE: 17 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: IRON - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 64 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GOLD - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 2 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 32 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GOLD_BADLANDS - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 32 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 32 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: EMERALD - settings: - ORES_PER_CHUNK_RANGE: 6 - MINIMUM_ORES_PER_CHUNK: 3 - MINIMUM_HEIGHT: 4 - HEIGHT_RANGE: 28 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: LAPIS - settings: - VEIN_SIZE: 7 - VEINS_PER_CHUNK: 1 - HEIGHT_RANGE: 16 - HEIGHT_CENTER: 16 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: DIRT - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 256 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GRAVEL - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 8 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 256 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: GRANITE - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: DIORITE - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: ANDESITE - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 80 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: NETHER_QUARTZ - settings: - VEIN_SIZE: 14 - VEINS_PER_CHUNK: 16 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: INFESTED_STONE - settings: - VEIN_SIZE: 9 - VEINS_PER_CHUNK: 7 - MINIMUM_HEIGHT: 0 - HEIGHT_RANGE: 64 - HEIGHT_SUBTRACT_VALUE: 0 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: MAGMA - settings: - VEIN_SIZE: 33 - VEINS_PER_CHUNK: 4 - HEIGHT_RANGE: 10 - SEA_LEVEL_DIVIDER: 2 - SEA_LEVEL_ADDER: -4 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: NETHER_GOLD - settings: - VEIN_SIZE: 10 - VEINS_PER_CHUNK: 10 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: ANCIENT_DEBRIS - settings: - VEIN_SIZE: 2 - VEINS_PER_CHUNK: 1 - MINIMUM_HEIGHT: 8 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 16 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: ANCIENT_DEBRIS_2 - settings: - VEIN_SIZE: 3 - VEINS_PER_CHUNK: 1 - HEIGHT_RANGE: 8 - HEIGHT_CENTER: 16 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: COPPER - settings: - VEIN_SIZE: 10 - VEINS_PER_CHUNK: 6 - HEIGHT_RANGE: 48 - HEIGHT_CENTER: 48 - VEINS_PER_BIOME: 0 - biome-ore-settings: - - ==: OreControl#BiomeOreSettings - biome: BASALT_DELTAS - ore-settings: - - ==: OreControl#OreSettings - ore: NETHER_GOLD - settings: - VEIN_SIZE: 10 - VEINS_PER_CHUNK: 20 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - - ==: OreControl#OreSettings - ore: NETHER_QUARTZ - settings: - VEIN_SIZE: 10 - VEINS_PER_CHUNK: 32 - MINIMUM_HEIGHT: 10 - HEIGHT_RANGE: 128 - HEIGHT_SUBTRACT_VALUE: 20 - VEINS_PER_BIOME: 0 - -version: 8 \ No newline at end of file diff --git a/ore-control/src/main/resources/lang/de.yml b/ore-control/src/main/resources/lang/de.yml deleted file mode 100644 index da19bd58..00000000 --- a/ore-control/src/main/resources/lang/de.yml +++ /dev/null @@ -1,402 +0,0 @@ -version: 10 -command: - player-only: Dieser Befehl ist nur für Spieler! - set: - value: - usage: '&f/&9orecontrol set value &f<&9Erz&f> <&9Einstellung&f> <&9Weltd&f> - <&9Anzahl&f(&9%&f)>' - description: Setze ein Wert, für eine Welt - not-enough-args: - - '&4Falsche Anzahl an Argumenten!' - - '&cbenutze %%translation:[command.set.value.usage]%' - success: '&aDer Wert wurde erfolgreich gesetzt!' - biome: - usage: '&f/&9orecontrol set biome &f<&9biome&f> <&9Erz&f> <&9Einstellung&f> - <&9Welt&f> <&9Anzahl&f(&9%&f)>' - description: Setze einen Wert, für ein bestimmtes Biome - not-enough-args: - - '&4Falsche Anzahl an Argumenten!' - - '&cbenutze %%translation:[command.set.biome.usage]%' - success: '&aDer Wert wurde erfolgreich gesetzt!' - create: - usage: '&f/&9orecontrol create &f<&9name&f>' - description: Erstelle eine Vorlage, in der du Werte setzen kannst bevor du eine - Welt erstellst - not-enough-args: - - '&4Falsche Anzahl an Argumenten!' - - '&cbenutze %%translation:[command.create.usage]%' - success: '&aDie Vorlage &f''&9%world-config%&f'' &awurde erfolgreich erstellt!' - reload: - usage: '&f/&9orecontrol reload' - description: Reloaded die Nachrichten, Config und Gui Einstellungen - begin: '&aBeginne mit dem Reloaden!' - end: '&aReloaden Fertig!' - info: - usage: '&f/&9orecontrol info' - description: Zeigt dir ein par Informationen zum Plugin - help: - separator-format: ' ' - header-format: ~~~~~~~~~~~~~~~~~~~&9Befehle&f~~~~~~~~~~~~~~~~~~~ - footer-format: ~~~~~~~~~~~~~~~~~~~&9Befehle&f~~~~~~~~~~~~~~~~~~~ - permission-format: '-> &9Berechtigung&f: %permission%' - description-format: '-> &9Beschreibung&f: %description%' - usage-format: '&9Benutzung&f: %usage%' - short-format: '&9%command%&f: %description%' - usage: '&f/&9orecontrol help &f(<&9subbefehl&f>)' - description: Zeigt dir alle Befehle an und wenn ein SubBefehl angegeben ist, werden - genauere Details zu diesem Befehl angezeigt -world-config: - not-found: '&4Die Config &f''&9%world-config%&f''&4 existiert nicht!' - already-exists: '&4Cie Config &f''&9%world-config%&f'' &4existiert bereits!' -ore: - not-found: - - '&4Das Erz &f''&9%ore%&f'' &4existiert nicht!, ' - - '&cbenutze &f''&9diamond&f'', ''&9coal&f'', ''&9lapis&f'', ''&9iron&f'', ''&9gold&f'', - ''&9gold_badlands&f''' - - '&coder &f''&9redstone&f''' - not-valid: - - '&4Das Erz &f''&9%ore%&f'' &4kann nicht in das' - - '&4Biom &f''&9%biome%&f''&4gesetzt werden!' - DIAMOND: Diamant - COAL: Kohle - GOLD: Gold - GOLD_BADLANDS: Ödland Gold - LAPIS: Lapis - IRON: Eisen - REDSTONE: Redstone - EMERALD: Smaragd - DIRT: Erde - GRAVEL: Kies - GRANITE: Granit - DIORITE: Diorit - ANDESITE: Andesit - NETHER_QUARTZ: Nether Quartz - INFESTED_STONE: Befallener Stein - MAGMA: Magma - NETHER_GOLD: Nether Gold - ANCIENT_DEBRIS: Antiker Schutt - ANCIENT_DEBRIS_2: Antiker Schutt 2 - COPPER: "Kupfer" -setting: - not-found: '&4Die Einstellung &f''&9%setting%&f'' &4existiert nicht!' - not-valid: - - '&4Die Einstellung &f''&9%setting%&f'' &4ist nicht für das' - - '&4Erz &f''&9%ore%&f''&4 bestimmt!' - VEIN_SIZE: Adergröße - VEINS_PER_CHUNK: Adern pro Chunk - HEIGHT_RANGE: Höhenbereich - HEIGHT_CENTER: Höhe Mitte - MINIMUM_ORES_PER_CHUNK: Minimale Erze pro Chunk - ORES_PER_CHUNK_RANGE: Erze pro Chunk Bereich - MINIMUM_HEIGHT: Mindesthöhe - HEIGHT_SUBTRACT_VALUE: Höhe subtrahieren Wert - VEINS_PER_BIOME: Adern pro Biome - SEA_LEVEL_DIVIDER: Meeresspiegelteiler - SEA_LEVEL_ADDER: Meeresspiegeladdierer -biome: - not-found: '&4Das Biome &f''&9%biome%&f'' &4existiert nicht!' - OCEAN: Meer - PLAINS: Flachland - DESERT: Wüste - MOUNTAINS: Berge - FOREST: Wald - TAIGA: Taiga - SWAMP: Sumpf - RIVER: Fluss - FROZEN_OCEAN: Gefrorenes Meer - FROZEN_RIVER: Gefrorener Fluss - SNOWY_TUNDRA: Verschneite Tundra - SNOWY_MOUNTAINS: Verschneite Berge - MUSHROOM_FIELDS: Pilzfelder - MUSHROOM_FIELD_SHORE: Pilzfeld Ufer - BEACH: Strand - DESERT_HILLS: Wüstenhügel - WOODED_HILLS: Bewaldete Hügel - TAIGA_HILLS: Taiga Hügel - MOUNTAIN_EDGE: Gebirgsrand - JUNGLE: Dschungel - JUNGLE_HILLS: Dschungelhügel - JUNGLE_EDGE: Dschungelrand - DEEP_OCEAN: Tiefes Meer - STONE_SHORE: Steinufer - SNOWY_BEACH: Verschneiter Strand - BIRCH_FOREST: Birkenwald - BIRCH_FOREST_HILLS: Birkenwald Hügel - DARK_FOREST: Dunkler Wald - SNOWY_TAIGA: Verschneite Taiga - SNOWY_TAIGA_HILLS: Verschneite Taiga Hügel - GIANT_TREE_TAIGA: Riesenbaum Taiga - GIANT_TREE_TAIGA_HILLS: Riesenbaum Taiga Hügel - WOODED_MOUNTAINS: Bewaldete Berge - SAVANNA: Savanne - SAVANNA_PLATEAU: Savanne Plateau - BADLANDS: Ödland - WOODED_BADLANDS_PLATEAU: Bewaldete Ödland Plateau - BADLANDS_PLATEAU: Ödland Plateau - WARM_OCEAN: Warmes Meer - LUKEWARM_OCEAN: Lauwarmes Meer - COLD_OCEAN: Kaltes Meer - DEEP_WARM_OCEAN: Tiefes warmes Meer - DEEP_LUKEWARM_OCEAN: Tiefes Lauwarmes Meer - DEEP_COLD_OCEAN: Tiefes Kaltes Meer - DEEP_FROZEN_OCEAN: Tiefes Gefrorenes Meer - SUNFLOWER_PLAINS: Sonnenblumenebenen - DESERT_LAKES: Wüstenseen - GRAVELLY_MOUNTAINS: Kiesige Berge - FLOWER_FOREST: Blumenwald - TAIGA_MOUNTAINS: Taiga Berge - SWAMP_HILLS: Sumpfhügel - ICE_SPIKES: Eisspitzen - MODIFIED_JUNGLE: Modifizierter Dschungel - MODIFIED_JUNGLE_EDGE: Modifizierter Dschungelrand - TALL_BIRCH_FOREST: Hoher Birkenwald - TALL_BIRCH_HILLS: Hohe Birkenhügel - DARK_FOREST_HILLS: Dunkle Waldhügel - SNOWY_TAIGA_MOUNTAINS: Verschneite Taiga Berge - GIANT_SPRUCE_TAIGA: Riesige Fichten Taiga - GIANT_SPRUCE_TAIGA_HILLS: Riesige Fichten Taiga Hügel - MODIFIED_GRAVELLY_MOUNTAINS: Modifizierte Kiesige Berge - SHATTERED_SAVANNA: Zerschlagene Savanne - SHATTERED_SAVANNA_PLATEAU: Zerschlagenes Savannen Plateau - ERODED_BADLANDS: Ausgehöhltes Ödland - MODIFIED_WOODED_BADLANDS_PLATEAU: Modifiziertes Bewaldetes Ödland Plateau - MODIFIED_BADLANDS_PLATEAU: Modified Ödland Plateau - BAMBOO_JUNGLE: Bambus Dschungel - BAMBOO_JUNGLE_HILLS: Bambus Dschungelhügel - HILLS: Hügels - SNOWY: Verschneite - NETHER: Nether - NETHER_WASTES: Nether-Ödland - SOUL_SAND_VALLEY: Seelensandtal - CRIMSON_FOREST: Karmesinwald - WARPED_FOREST: Wirrwald - BASALT_DELTAS: Basaltdeltas -config-type: - GLOBAL: Global - TEMPLATE: Vorlage - OVERWORLD: Oberwelt - NETHER: Nether -number: - not-valid: '&f''&9%value%&f'' &4ist keine Zahl!' - not-safe: - - '&4Die Nummer &f''&9%value%&f'' &4ist nicht sicher!' - - '&4Wenn du sie trozdem setzen möchtes,' - - '&4setze in der config den Wert &f''&9safe-mode&f'' &4auf &f''&9false&f''' - - '&4Und führe den Befehl &f''&9/orecontrol reload&f'' &4aus' - not-safe-warning: '&eWarn: Die Nummer &f''&9%value%&f'' &eist nicht sicher!' - not-safe-see-also: "&eFür mehr informationen lese dir diesen %%button%&e wiki eintrag durch" -gui: - copy: - success: '&aDie Werte wurden erfolgreich kopiert!' - reset: - success: '&aDie Werte wurden erfolgreich zurückgesetzt!' - anvil: - title: Schreibe einen Namen! - previous-page: - name: '&fVorherige Seite' - click: '&7>> &bKlicke, um zur vorherigen Seite zu gehen! &7<<' - next-page: - name: '&fNächste Seite' - click: '&7>> &bKlicke, um zur nächsten Seite zu gehen! &7<<' - back: - name: '&fZurück' - click: '&7>> &bKlicke, um einen schrit zurück zu gehen! &7<<' - abort: - name: '&fAbbrechen' - click: '&7>> &bKlicke, um das Kopieren abzubrechen! &7<<' - info: - name: '&eInfo' - lore-world: ' &7> &fWelt: &d%world%' - lore-biome: ' &7> &fBiome: &d%%translation:[biome.%biome%]%' - lore-ore: ' &7> &fErz: &d%%translation:[ore.%ore%]%' - lore-setting: ' &7> &fEinstellung: &d%%translation:[setting.%setting%]%' - lore-current: ' &7> &fAktuell: &d%amount%' - lore-default: ' &7> &fStandart: &d%default%' - world: - name: Wähle eine Welt! - type: ' &7> &fTyp: &d%%translation:[config-type.%config-type%]%' - world: - click: '&7>> &bKlicke, um diese Welt zu bearbeiten! &7<<' - template: - create: - name: '&fNeue Vorlage' - create: '&7>> &bklicke, um eine neue Vorlage zu erstellen! &7<<' - click: '&7>> &bKlicke, um diese Vorlage zu bearbeiten! &7<<' - global: - click: '&7>> &bKlicke, um die Globale Konfig zu bearbeiten! &7<<' - config: - edit: Ändere Config Einstellungen! - name: '&fKonfig' - click: '&7>> &bKlicke, um die Konfig zu bearbeiten! &7<<' - reset-copy: - world: - click: '&7>> &bKlicke, um diese Welt zu wählen! &7<<' - template: - click: '&7>> &bKlicke, um diese Vorlage zu wählen! &7<<' - global: - click: '&7>> &bKlicke, um die globale Konfig zu wählen! &7<<' - world-config: - name: Wähle einen Typ! - biome: - name: '&fBiome spezifisch' - click: '&7>> &bKlicke, um ein bestimmtes Biom zu bearbeiten! &7<<' - ore: - name: '&fGanze Welt' - click: '&7>> &bKlicke, um die ganze Welt zu bearbeiten! &7<<' - reset: - name: '&fReset' - click: '&7>> &bKlicke, um alle Einstellungen zu resetten! &7<<' - copy: - name: '&fKopieren' - click: '&7>> &bKlicke, um alle Einstellung zu kopieren! &7<<' - delete: - name: '&fLöschen' - click: '&7>> &bKlicke, um diese Welten-Konfig zu löschen! &7<<' - reset-copy: - biome: - click: '&7>> &bKlicke, um ein Biome zu wählen! &7<<' - ore: - click: '&7>> &bKlicke, um die ganze Welt zu wählen! &7<<' - biome: - biome-group: Biome Gruppen - name: Wähle ein Biom! - biome: - click: '&7>> &bKlicke, um dieses Biome zu bearbeiten! &7<<' - switch: - biome: - name: '&fBiome' - click: '&7>> &bKlicke, um zur Biome-Auswahl zu wechseln! &7<<' - biome-group: - name: '&fBiome Gruppe' - click: '&7>> &bKlicke, um zur Auswahl der Biomgruppe zu wechseln! &7<<' - reset: - name: '&fReset' - click: '&7>> &bKlicke, um alle Biome zu resetten! &7<<' - copy: - name: '&fKopieren' - click: '&7>> &bKlicke, um alle Biome zu kopieren! &7<<' - reset-copy: - biome: - click: '&7>> &bKlicke, um dieses Biome zu wählen! &7<<' - ore: - name: Wähle ein Erz! - ore: - name: '&f%%translation:[ore.%ore%]%' - status: ' &7> &fStatus: &a%%translation:[gui.boolean.%status%]%' - click: '&7>> &bKlicke, um diese Erz zu bearbeiten! &7<<' - reset: - name: '&fReset' - click: '&7>> &bKlicke, um alle Erze zu resetten! &7<<' - copy: - name: '&fKopieren' - click: '&7>> &bKlicke, um alle Erze zu kopieren! &7<<' - reset-copy: - ore: - click: '&7>> &bKlicke, um dieses Erz zu wählen! &7<<' - ore-settings: - activate: §aAktiviere die Erzgenerierung! - deactivate: §cDeaktiviere die Erzgeneration! - name: Wähle eine Einstellung! - setting: - click: '&7>> &bKlicke, um diese Einstellung zu bearbeiten! &7<<' - status: - active: - name: '&fAktivieren / Deaktivieren' - current: ' &7> &fAktuell: &aAktive' - click: '&7>> &bKlicke, um dieses Erz zu deaktivieren! &7<<' - inactive: - name: '&fAktivieren / Deaktivieren' - current: ' &7> &fAktuell: &cInaktive' - click: '&7>> &bKlicke, um dieses Erz zu aktivieren! &7<<' - reset: - name: '&fReset' - click: '&7>> &bKlicke, um alle Einstellungen zu resetten! &7<<' - copy: - name: '&fKopieren' - click: '&7>> &bKlicke, um alle Einstellungen zu kopieren! &7<<' - reset-copy: - setting: - click: '&7>> &bKlicke, um diese Einstellung zu wählen! &7<<' - settings: - name: Einen Wert einstellen! - reset: - name: '&fReset' - click: '&7>> &bKlicke, um diese Einstellung zu resetten! &7<<' - copy: - name: '&fKopieren' - click: '&7>> &bKlicke, um diese Einstellung zu kopieren! &7<<' - add: - click: '&7>> &bKlicke, um %change-value% hinzuzufügen! &7<<' - remove: - click: '&7>> &bKlicke, um %change-value% zu entfernen! &7<<' - verify: - name: Akzeptiere oder lehne die Aktion ab! - accept: - name: '&fAkzeptieren' - click: '&7>> &bKlicke, um zu Akzeptieren! &7<<' - deny: - name: '&fAblehnen' - click: '&7>> &bKlicke, um Abzulehnen! &7<<' - config: - name: Wähle eine Config Option! - back: - click: '&7>> &bKlicke, um zur welten gui zu gelangen! &7<<' - reload: - name: '&fNeu laden' - click: '&7>> &bKlicke, um die Konfig neu zuladen &7<<' - language: - name: '&fSprache' - description: ' &7> &cHelfe beim Übersetzen des Plugins!%%new-line% &7> &fJedes - bisschen hilft, übersetze%%new-line% &7> &feinfach die &dmessages.yml&f in - dem%%new-line% &7> &fplugin Ordner und sende sie zu mir.' - click: '&7>> &bKlicke, um die Sprache zu ändern! &7<<' - safe-mode: - name: '&fSicherer Modus' - description: ' &7> &fWähle, ob das Plugin warnen soll, wenn%%new-line% &7> &fein - nicht sicherer Wert gewählt wird.' - click: '&7>> &bKlicke, um den abgesicherten Modus ein-/auszuschalten! &7<<' - translate-tab-compilation: - name: '&fTap Übersetzung' - description: ' &7> &fAktiviere, wenn du Biome / Erze / Einstellungen%%new-line% - &7> &fin der von dir gewählten sprache schreiben%%new-line% &7> &fmöchtest, - in befehlen.' - click: '&7>> &bKlicke, um die Tap übersetzung ein-/auszuschalten! &7<<' - verify: - copy-action: - name: '&fÜberprüfen von Kopieraktionen' - description: ' &7> &fAktiviere, wenn du kopier Aktionen%%new-line% &7> &fbestädigen - möchtest.' - click: '&7>> &bKlicke, um die Verifizierung ein-/auszuschalten! &7<<' - reset-action: - name: '&fRücksetzaktionen überprüfen' - description: ' &7> &fAktiviere, wenn du reset Aktionen%%new-line% &7> &fbestädigen - möchtest.' - click: '&7>> &bKlicke, um die Verifizierung ein-/auszuschalten! &7<<' - language: - name: Wähle eine Sprache! - custom: - click: '&7>> &bKlicke, um custom als sprache zu wählen! &7<<' - boolean: - true-click: '&7>> &bKlicke, um zu Aktivieren! &7<<' - false-click: '&7>> &bKlicke, um zu Deaktivieren! &7<<' - set: - 'true': '&fAktivieren' - 'false': '&fDeaktivieren' - name: Aktivieren oder Deaktivieren - 'true': '&aAktive' - 'false': '&cInaktive' -welcome: - button-open-string: '&4[' - button-close-string: '&4]' - header: '&bDanke, das du Ore-Control benutzt!' - found-bug: Wenn du einen Fehler gefunden hast, melden ihn bitte auf %%button% - feature-request: Wenn du zusätzliche funktionen haben möchtest, verwenden bitte - auch %%button% - support: Treten meinem %%button% Server bei, wenn du Fragen zu meinem Plugin hast - support-my-work: Wenn dir meine Arbeit gefällt, %%button:[rating]% sie bitte oder - mache eine kleine %%button:[donation]% - not-show-again: Nicht mehr anzeigen - not-show-again-success: '&aDie Willkommensnachricht wird nicht mehr angezeigt' - click-me: Klick mich - rating: bewerte - donation: Spende diff --git a/ore-control/src/main/resources/lang/en.yml b/ore-control/src/main/resources/lang/en.yml deleted file mode 100644 index 33fb6a71..00000000 --- a/ore-control/src/main/resources/lang/en.yml +++ /dev/null @@ -1,391 +0,0 @@ -version: 10 -command: - player-only: This Command is only for Players! - set: - value: - usage: '&f/&9orecontrol set value &f<&9ore&f> <&9setting&f> <&9world&f> <&9amount&f(&9%&f)>' - description: Set a specific value to an ore type and world - not-enough-args: - - '&4Wrong amount of arguments!' - - '&cuse %%translation:[command.set.value.usage]%' - success: '&aThe value has been updated successfully!' - biome: - usage: '&f/&9orecontrol set biome &f<&9biome&f> <&9ore&f> <&9setting&f> <&9world&f> - <&9amount&f(&9%&f)>' - description: Set a specific value to an ore type in a specific biome and world - not-enough-args: - - '&4Wrong amount of arguments!' - - '&cuse %%translation:[command.set.biome.usage]%' - success: '&aThe value has been updated successfully!' - create: - usage: '&f/&9orecontrol create &f<&9name&f>' - description: Create a template file, in there you can set values before create - a new world - not-enough-args: - - '&4Wrong amount of arguments!' - - '&cuse %%translation:[command.create.usage]%' - success: '&aThe template &f''&9%world-config%&f'' &awas created successfully!' - reload: - usage: '&f/&9orecontrol reload' - description: Reload config, messages and gui settings - begin: '&aBegin with the reload!' - end: '&aReload finish!' - info: - usage: '&f/&9orecontrol info' - description: Shows you some infos about the plugin - help: - separator-format: ' ' - header-format: ~~~~~~~~~~~~~~~~~~~&9Commands&f~~~~~~~~~~~~~~~~~~~ - footer-format: ~~~~~~~~~~~~~~~~~~~&9Commands&f~~~~~~~~~~~~~~~~~~~ - permission-format: '-> &9permission&f: %permission%' - description-format: '-> &9description&f: %description%' - usage-format: '&9usage&f: %usage%' - short-format: '&9%command%&f: %description%' - usage: '&f/&9orecontrol help &f(<&9subcommand&f>)' - description: Displays all commands and if a subcommand is specified, more details - are displayed -world-config: - not-found: '&4The config &f''&9%world-config%&f''&4 does not exist!' - already-exists: '&4The Config &f''&9%world-config%&f'' &4already exist!' -ore: - not-found: - - '&4The ore &f''&9%ore%&f'' &4does not exist!, ' - - '&cuse &f''&9diamond&f'', ''&9coal&f'', ''&9lapis&f'', ''&9iron&f'', ''&9gold&f'', - ''&9gold_badlands&f'' &cor' - - '&f''&9redstone&f''' - not-valid: '&4The Ore &f''&9%ore%&f'' &4is not valid for the biome &f''&9%biome%&f''&4!' - DIAMOND: Diamond - COAL: Coal - GOLD: Gold - GOLD_BADLANDS: Badlands Gold - LAPIS: Lapis - IRON: Iron - REDSTONE: Redstone - EMERALD: Emerald - DIRT: Dirt - GRAVEL: Gravel - GRANITE: Granite - DIORITE: Diorite - ANDESITE: Andesite - NETHER_QUARTZ: Nether Quartz - INFESTED_STONE: Infested Stone - MAGMA: Magma - NETHER_GOLD: Nether Gold - ANCIENT_DEBRIS: Ancient Debris - ANCIENT_DEBRIS_2: Ancient Debris 2 - COPPER: "Copper" -setting: - not-found: '&4The setting &f''&9%setting%&f'' &4does not exist!' - not-valid: '&4The setting &f''&9%setting%&f'' &4is not valid with the ore &f''&9%ore%&f''&4!' - VEIN_SIZE: Vein Size - VEINS_PER_CHUNK: Veins per Chunk - HEIGHT_RANGE: Height Range - HEIGHT_CENTER: Height Center - MINIMUM_ORES_PER_CHUNK: Minimum Ores Per Chunk - ORES_PER_CHUNK_RANGE: Ores per Chunk Range - MINIMUM_HEIGHT: Minimum Height - HEIGHT_SUBTRACT_VALUE: Height Subtract Value - VEINS_PER_BIOME: Veins Per Biome - SEA_LEVEL_DIVIDER: Sea Level Divider - SEA_LEVEL_ADDER: Sea Level Adder -biome: - not-found: '&4The biome &f''&9%biome%&f'' &4does not exist!' - OCEAN: Ocean - PLAINS: Plains - DESERT: Desert - MOUNTAINS: Mountains - FOREST: Forest - TAIGA: Taiga - SWAMP: Swamp - RIVER: River - FROZEN_OCEAN: Frozen Ocean - FROZEN_RIVER: Frozen River - SNOWY_TUNDRA: Snowy Tundra - SNOWY_MOUNTAINS: Snowy Mountains - MUSHROOM_FIELDS: Mushroom Fields - MUSHROOM_FIELD_SHORE: Mushroom Field Shore - BEACH: Beach - DESERT_HILLS: Desert Hills - WOODED_HILLS: Wooded Hills - TAIGA_HILLS: Taiga Hills - MOUNTAIN_EDGE: Mountain Edge - JUNGLE: Jungle - JUNGLE_HILLS: Jungle Hills - JUNGLE_EDGE: Jungle Edge - DEEP_OCEAN: Deep Ocean - STONE_SHORE: Stone Shore - SNOWY_BEACH: Snowy Beach - BIRCH_FOREST: Birch Forest - BIRCH_FOREST_HILLS: Birch Forest Hills - DARK_FOREST: Dark Forest - SNOWY_TAIGA: Snowy Taiga - SNOWY_TAIGA_HILLS: Snowy Taiga Hills - GIANT_TREE_TAIGA: Giant Tree Taiga - GIANT_TREE_TAIGA_HILLS: Giant Tree Taiga Hills - WOODED_MOUNTAINS: Wooded Mountains - SAVANNA: Savanna - SAVANNA_PLATEAU: Savanna Plateau - BADLANDS: Badlands - WOODED_BADLANDS_PLATEAU: Wooded Badlands Plateau - BADLANDS_PLATEAU: Badlands Plateau - WARM_OCEAN: Warm Ocean - LUKEWARM_OCEAN: Lukewarm Ocean - COLD_OCEAN: Cold Ocean - DEEP_WARM_OCEAN: Deep Warm Ocean - DEEP_LUKEWARM_OCEAN: Deep Lukewarm Ocean - DEEP_COLD_OCEAN: Deep Cold Ocean - DEEP_FROZEN_OCEAN: Deep Frozen Ocean - SUNFLOWER_PLAINS: Sunflower Plains - DESERT_LAKES: Desert Lakes - GRAVELLY_MOUNTAINS: Gravelly Mountains - FLOWER_FOREST: Flower Forest - TAIGA_MOUNTAINS: Taiga Mountains - SWAMP_HILLS: Swamp Hills - ICE_SPIKES: Ice Spikes - MODIFIED_JUNGLE: Modified Jungle - MODIFIED_JUNGLE_EDGE: Modified Jungle Edge - TALL_BIRCH_FOREST: Tall Birch Forest - TALL_BIRCH_HILLS: Tall Birch Hills - DARK_FOREST_HILLS: Dark Forest Hills - SNOWY_TAIGA_MOUNTAINS: Snowy Taiga Mountains - GIANT_SPRUCE_TAIGA: Giant Spruce Taiga - GIANT_SPRUCE_TAIGA_HILLS: Giant Spruce Taiga Hills - MODIFIED_GRAVELLY_MOUNTAINS: Modified Gravelly Mountains - SHATTERED_SAVANNA: Shattered Savanna - SHATTERED_SAVANNA_PLATEAU: Shattered Savanna Plateau - ERODED_BADLANDS: Eroded Badlands - MODIFIED_WOODED_BADLANDS_PLATEAU: Modified Wooded Badlands Plateau - MODIFIED_BADLANDS_PLATEAU: Modified Badlands Plateau - BAMBOO_JUNGLE: Bamboo Jungle - BAMBOO_JUNGLE_HILLS: Bamboo Jungle Hills - HILLS: Hills - SNOWY: Snowy - NETHER: Nether - NETHER_WASTES: Nether Wastes - SOUL_SAND_VALLEY: Soul Sand Valley - CRIMSON_FOREST: Crimson Forest - WARPED_FOREST: Warped Forest - BASALT_DELTAS: Basalt Deltas -config-type: - GLOBAL: Global - TEMPLATE: Template - OVERWORLD: Overworld - NETHER: Nether -number: - not-valid: '&f''&9%value%&f'' &4is not a valid number!' - not-safe: - - '&4The number &f''&9%value%&f'' &4is not safe!' - - '&4If you want to use it anyway,' - - '&4set &f''&9safe-mode&f'' &4in the config to &f''&9false&f''' - - '&4And execute the &f''&9/orecontrol reload&f'' &4command' - not-safe-warning: '&eWarn: The number &f''&9%value%&f'' &eis not safe!' - not-safe-see-also: "&eFor more infos visit this %%button%&e wiki post" -gui: - copy: - success: '&aCopy the values with Success!' - reset: - success: '&aReset the values with Success!' - anvil: - title: Type a name! - previous-page: - name: '&fPrevious page' - click: '&7>> &bClick to go to the previous page! &7<<' - next-page: - name: '&fNext page' - click: '&7>> &bClick to go to the next page! &7<<' - back: - name: '&fBack' - click: '&7>> &bClick to go a step back! &7<<' - abort: - name: '&fAbort' - click: '&7>> &bClick to abort the copy action! &7<<' - info: - name: '&eInfo' - lore-world: ' &7> &fWorld: &d%world%' - lore-biome: ' &7> &fBiome: &d%%translation:[biome.%biome%]%' - lore-ore: ' &7> &fOre: &d%%translation:[ore.%ore%]%' - lore-setting: ' &7> &fSetting: &d%%translation:[setting.%setting%]%' - lore-current: ' &7> &fCurrently: &d%amount%' - lore-default: ' &7> &fDefault: &d%default%' - world: - name: Choose a World! - type: ' &7> &fType: &d%%translation:[config-type.%config-type%]%' - world: - click: '&7>> &bClick to edit this world! &7<<' - template: - create: - name: '&fNew template' - create: '&7>> &bClick to create a new template! &7<<' - click: '&7>> &bClick to edit this template! &7<<' - global: - click: '&7>> &bClick to edit the global config! &7<<' - config: - name: '&fConfig' - click: '&7>> &bClick to edit the config! &7<<' - reset-copy: - world: - click: '&7>> &bClick to select this world! &7<<' - template: - click: '&7>> &bClick to select this template! &7<<' - global: - click: '&7>> &bClick to select the global config! &7<<' - world-config: - name: Choose a Type! - biome: - name: '&fBiome specific' - click: '&7>> &bClick to edit a specific biome! &7<<' - ore: - name: '&fWhole world' - click: '&7>> &bClick to edit the whole world! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all settings! &7<<' - delete: - name: '&fDelete' - click: '&7>> &bClick to delete this world-config! &7<<' - reset-copy: - biome: - click: '&7>> &bClick to select biome! &7<<' - ore: - click: '&7>> &bClick to select whole word! &7<<' - biome: - name: Choose a Biome! - biome: - click: '&7>> &bClick to edit this biome! &7<<' - switch: - biome: - name: '&fBiome' - click: '&7>> &bClick to switch to biome selection! &7<<' - biome-group: - name: '&fBiome Group' - click: '&7>> &bClick to switch to biome group selection! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all biome settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all biome settings! &7<<' - reset-copy: - biome: - click: '&7>> &bClick to select this biome! &7<<' - ore: - name: Choose an Ore! - ore: - name: '&f%%translation:[ore.%ore%]%' - status: ' &7> &fStatus: &a%%translation:[gui.boolean.%status%]%' - click: '&7>> &bClick to edit this ore! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all ore settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all ore settings! &7<<' - reset-copy: - ore: - click: '&7>> &bClick to select this ore! &7<<' - ore-settings: - name: Choose a Setting! - setting: - click: '&7>> &bClick to edit this setting! &7<<' - status: - active: - name: '&fActivate / Deactivate' - current: ' &7> &fCurrently: &aActive' - click: '&7>> &bClick to deactivate this ore! &7<<' - inactive: - name: '&fActivate / Deactivate' - current: ' &7> &fCurrently: &cInactive' - click: '&7>> &bClick to activate this ore! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all settings! &7<<' - reset-copy: - setting: - click: '&7>> &bClick to select this setting! &7<<' - settings: - name: Set a value! - reset: - name: '&fReset' - click: '&7>> &bClick to reset this setting! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy this setting! &7<<' - add: - click: '&7>> &bClick to add %change-value%! &7<<' - remove: - click: '&7>> &bClick to remove %change-value%! &7<<' - verify: - name: Accept or Deny the Action! - accept: - name: '&fAccept' - click: '&7>> &bClick to accept! &7<<' - deny: - name: '&fDeny' - click: '&7>> &bClick to deny! &7<<' - config: - name: Select a config option! - back: - click: '&7>> &bClick to go back to world gui! &7<<' - reload: - name: '&fReload' - click: '&7>> &bClick to reload configs from disk &7<<' - language: - name: '&fLanguage' - description: ' &7> &cHelp to translate the plugin!%%new-line% &7> &fEvery bit - helps, simply%%new-line% &7> &ftranslate the &dmessages.yml%%new-line% &7> - &fin the plugins directory and%%new-line% &7> &fsend it to me.' - click: '&7>> &bClick to change the language! &7<<' - safe-mode: - name: '&fSafe mode' - description: ' &7> &fChoose if the plugin should warn%%new-line% &7> &fyou if - you set a unsafe value.' - click: '&7>> &bClick to turn safe mode on / off! &7<<' - translate-tab-compilation: - name: '&fTap translation' - description: ' &7> &fActivate, if you want to type%%new-line% &7> &fBiomes / - Ores / Settings in your%%new-line% &7> &fselected Language, in commands.' - click: '&7>> &bClick to turn tab translation on / off! &7<<' - verify: - copy-action: - name: '&fVerify copy actions' - description: ' &7> &fActivate, if you want to verify%%new-line% &7> &fcopy - actions.' - click: '&7>> &bClick to turn verification on / off! &7<<' - reset-action: - name: '&fVerify reset actions' - description: ' &7> &fActivate, if you want to verify%%new-line% &7> &freset - actions.' - click: '&7>> &bClick to turn verification on / off! &7<<' - language: - name: Choose a Language! - custom: - click: '&7>> &bClick to select custom as language! &7<<' - boolean: - true-click: '&7>> &bClick to Activate! &7<<' - false-click: '&7>> &bClick to Deactivate! &7<<' - set: - 'true': '&fActivate' - 'false': '&fDeactivate' - name: Activate or Deactivate - 'true': '&aActive' - 'false': '&cInactive' -welcome: - button-open-string: '&4[' - button-close-string: '&4]' - header: '&bThanks for using Ore-Control!' - found-bug: If you found a bug, please report it on %%button% - feature-request: If you have a feature request, use also %%button% - support: Join my %%button% server, if you have questions about my plugin - support-my-work: If you like my work, please %%button:[rating]% it, or make a small - %%button:[donation]% - not-show-again: Do not show again - not-show-again-success: '&aThe welcome message won''t show again' - click-me: Click me - rating: rate - donation: donation diff --git a/ore-control/src/main/resources/lang/zh.yml b/ore-control/src/main/resources/lang/zh.yml deleted file mode 100644 index 99b59611..00000000 --- a/ore-control/src/main/resources/lang/zh.yml +++ /dev/null @@ -1,396 +0,0 @@ -version: 10 -command: - - player-only: "此命令仅供玩家使用!" - set: - value: - usage: "&f/&9orecontrol set value &f<&9ore&f> <&9setting&f> <&9world&f> <&9amount&f(&9%&f)>" - description: "设置矿石类型和矿石生成参数" - not-enough-args: - - "&4错误的指令!" - - "&c使用 %%translation:[command.set.value.usage]%" - success: "&a该数值已成功更新!" - - biome: - usage: '&f/&9orecontrol set biome &f<&9biome&f> <&9ore&f> <&9setting&f> <&9world&f> <&9amount&f(&9%&f)>' - description: 'Set a specific value to an ore type in a specific biome and world' - not-enough-args: - - "&4错误的指令!" - - "&c使用 %%translation:[command.set.biome.usage]%" - success: "&a该数值已成功更新!" - create: - usage: '&f/&9orecontrol create &f<&9name&f>' - description: "创建一个矿物生成模板。您可以在生成新世界前设置" - not-enough-args: - - "&4错误的指令!" - - "&c使用 %%translation:[command.create.usage]%" - success: "&a该模板&f'&9%world-config%&f' &a创建成功!" - reload: - usage: '&f/&9orecontrol reload' - description: "重新加载插件配置" - begin: "&c请重新加载该插件" - end: "&a已重新加载该插件" - info: - usage: '&f/&9orecontrol info' - description: 'Shows you some infos about the plugin' - - help: - separator-format: ' ' - header-format: "~~~~~~~~~~~~~~~~~~~&9命令&f~~~~~~~~~~~~~~~~~~~" - footer-format: "~~~~~~~~~~~~~~~~~~~&9命令&f~~~~~~~~~~~~~~~~~~~" - permission-format: "-> &9permission&f: %permission%" - description-format: "-> &9description&f: %description%" - usage-format: "&9usage&f: %usage%" - short-format: "&9%command%&f: %description%" - usage: '&f/&9orecontrol help &f(<&9subcommand&f>)' - description: "显示所有的命令。如果指定一个命令,则显示更多的详细信息" - -world-config: - not-found: "&4配置文件&f'&9%world-config%&f'&4不存在!" - already-exists: "&4该配置&f'&9%world-config%&f' &4已存在" -ore: - not-found: - - "&4这个矿石&f'&9%ore%&f' &4不存在!, " - - "&c请使用 &f'&9钻石矿&f', '&9煤矿&f', '&9青金石矿&f', '&9铁矿&f', '&9金矿&f', '&9黏土山金矿&f' &c或者" - - "&f'&9红石&f'" - not-valid: "&4此生物群系矿石设置为生效&f'&9%ore%&f' &4&f'&9%biome%&f'&4!" - DIAMOND: "&r钻石矿" - COAL: "&r煤矿" - GOLD: "&r金矿" - GOLD_BADLANDS: "&r黏土山群系生成的金矿" - LAPIS: "&r青金石矿" - IRON: "&r铁矿" - REDSTONE: "&r红石矿" - EMERALD: "&r绿宝石矿" - DIRT: "&r泥土" - GRAVEL: "&r砂砾" - GRANITE: "&r花岗岩" - DIORITE: "&r闪长岩" - ANDESITE: "&r安山岩" - NETHER_QUARTZ: "Nether Quartz" - INFESTED_STONE: "Infested Stone" - MAGMA: "Magma" - NETHER_GOLD: "Nether Gold" - ANCIENT_DEBRIS: "Ancient Debris" - ANCIENT_DEBRIS_2: "Ancient Debris 2" - COPPER: "Copper" - -setting: - not-found: "&4该设置 &f'&9%setting%&f' &4未能生效!" - not-valid: "&4该矿石设置 &f'&9%setting%&f' &4未能生效! &f'&9%ore%&f'&4!" - VEIN_SIZE: "&r单个矿脉的最大矿物块数量" - VEINS_PER_CHUNK: "&r每个区块的矿脉数量" - HEIGHT_RANGE: "&r最高生成高度" - HEIGHT_CENTER: "&r集中生成高度" - MINIMUM_ORES_PER_CHUNK: "&r最小的单区块尝试生成次数" - ORES_PER_CHUNK_RANGE: "&r矿石生成规模" - MINIMUM_HEIGHT: "&r最低生成高度" - HEIGHT_SUBTRACT_VALUE: "&r生成高度减去值(未知功能,推荐不要设置)" - VEINS_PER_BIOME: "&r每个生物群系的静脉" - SEA_LEVEL_DIVIDER: "Sea Level Divider" - SEA_LEVEL_ADDER: "Sea Level Adder" - -biome: - not-found: "&4该生物群系&f'&9%biome%&f' &4不存在!" - MODIFIED_GRAVELLY_MOUNTAINS: "破碎砂砾高山" - OCEAN: "海洋" - PLAINS: "平原" - DESERT: "沙漠" - MOUNTAINS: "高山" - FOREST: "森林" - TAIGA: "针叶林" - SWAMP: "沼泽" - RIVER: "河流" - FROZEN_OCEAN: "冻洋" - FROZEN_RIVER: "冰河" - SNOWY_TUNDRA: "雪原" - SNOWY_MOUNTAINS: "雪山" - MUSHROOM_FIELDS: "蘑菇岛" - MUSHROOM_FIELD_SHORE: "蘑菇岛岸" - BEACH: "沙滩" - DESERT_HILLS: "沙漠丘陵" - WOODED_HILLS: "森林丘陵" - TAIGA_HILLS: "针叶林丘陵" - MOUNTAIN_EDGE: "山地边缘(非默认自然生成)" - JUNGLE: "丛林" - JUNGLE_HILLS: "丛林丘陵" - JUNGLE_EDGE: "丛林边缘" - DEEP_OCEAN: "深海" - STONE_SHORE: "岩石海岸" - SNOWY_BEACH: "冰冻沙滩" - BIRCH_FOREST: "桦木林" - BIRCH_FOREST_HILLS: "桦木林丘陵" - DARK_FOREST: "黑森林" - SNOWY_TAIGA: "积雪针叶林" - SNOWY_TAIGA_HILLS: "积雪针叶林丘陵" - GIANT_TREE_TAIGA: "巨型针叶林" - GIANT_TREE_TAIGA_HILLS: "巨型针叶林丘陵" - WOODED_MOUNTAINS: "繁茂山地" - SAVANNA: "热带草原" - SAVANNA_PLATEAU: "热带高原" - BADLANDS: "恶地" - WOODED_BADLANDS_PLATEAU: "繁茂恶地高原" - BADLANDS_PLATEAU: "恶地高原" - WARM_OCEAN: "暖水海洋" - LUKEWARM_OCEAN: "温水海洋" - COLD_OCEAN: "冷水海洋" - DEEP_WARM_OCEAN: "暖水深海(非默认自然生成)" - DEEP_LUKEWARM_OCEAN: "温水深海" - DEEP_COLD_OCEAN: "冷水深海" - DEEP_FROZEN_OCEAN: "冰封深海" - SUNFLOWER_PLAINS: "向日葵平原" - DESERT_LAKES: "沙漠胡泊" - GRAVELLY_MOUNTAINS: "砂砾山地" - FLOWER_FOREST: "花海" - TAIGA_MOUNTAINS: "针叶林山地" - SWAMP_HILLS: "沼泽山区" - ICE_SPIKES: "冰刺之地" - MODIFIED_JUNGLE: "丛林山区" - MODIFIED_JUNGLE_EDGE: "丛林山区变种" - TALL_BIRCH_FOREST: "高大桦木林" - TALL_BIRCH_HILLS: "高大桦木丘陵" - DARK_FOREST_HILLS: "黑森林丘陵" - SNOWY_TAIGA_MOUNTAINS: "积雪针叶林山地" - GIANT_SPRUCE_TAIGA: "巨型云杉林" - GIANT_SPRUCE_TAIGA_HILLS: "巨型云杉针叶林丘陵" - SHATTERED_SAVANNA: "破碎热带草原" - SHATTERED_SAVANNA_PLATEAU: "破碎热带高原" - ERODED_BADLANDS: "风蚀恶地" - MODIFIED_WOODED_BADLANDS_PLATEAU: "破碎恶地繁茂高原" - MODIFIED_BADLANDS_PLATEAU: "破碎恶地高原" - BAMBOO_JUNGLE: "竹林" - BAMBOO_JUNGLE_HILLS: "竹林丘陵" - HILLS: "丘陵" - SNOWY: "积雪" - NETHER: "Nether" - NETHER_WASTES: "Nether Wastes" - SOUL_SAND_VALLEY: "Soul Sand Valley" - CRIMSON_FOREST: "Crimson Forest" - WARPED_FOREST: "Warped Forest" - BASALT_DELTAS: "Basalt Deltas" - -config-type: - GLOBAL: Global - TEMPLATE: Template - OVERWORLD: Overworld - NETHER: Nether - -number: - not-valid: "&f'&9%value%&f' &4这不是一个有效的数字!" - not-safe: - - "&4这个数字&f'&9%value%&f' &4不合适!" - - "&4如果您想使用," - - "&4请将配置中的&f'&9safe-mode&f' &4设置为&f'&9false&f'" - - "&4然后&f'&9/重启该插件(/orecontrol reload)&f'" - not-safe-warning: "&e警告: 这个数字 &f'&9%value%&f' &不合适!" - not-safe-see-also: "&eFor more infos visit this %%button%&e wiki post" - -gui: - copy: - success: '&aCopy the values with Success!' - reset: - success: '&aReset the values with Success!' - anvil: - title: Type a name! - previous-page: - name: '&fPrevious page' - click: '&7>> &bClick to go to the previous page! &7<<' - next-page: - name: '&fNext page' - click: '&7>> &bClick to go to the next page! &7<<' - back: - name: '&fBack' - click: '&7>> &bClick to go a step back! &7<<' - abort: - name: '&fAbort' - click: '&7>> &bClick to abort the copy action! &7<<' - info: - name: '&eInfo' - lore-world: ' &7> &fWorld: &d%world%' - lore-biome: ' &7> &fBiome: &d%%translation:[biome.%biome%]%' - lore-ore: ' &7> &fOre: &d%%translation:[ore.%ore%]%' - lore-setting: ' &7> &fSetting: &d%%translation:[setting.%setting%]%' - lore-current: ' &7> &fCurrently: &d%amount%' - lore-default: ' &7> &fDefault: &d%default%' - world: - name: Choose a World! - type: ' &7> &fType: &d%%translation:[config-type.%config-type%]%' - world: - click: '&7>> &bClick to edit this world! &7<<' - template: - create: - name: '&fNew template' - create: '&7>> &bClick to create a new template! &7<<' - click: '&7>> &bClick to edit this template! &7<<' - global: - click: '&7>> &bClick to edit the global config! &7<<' - config: - name: '&fConfig' - click: '&7>> &bClick to edit the config! &7<<' - reset-copy: - world: - click: '&7>> &bClick to select this world! &7<<' - template: - click: '&7>> &bClick to select this template! &7<<' - global: - click: '&7>> &bClick to select the global config! &7<<' - world-config: - name: Choose a Type! - biome: - name: '&fBiome specific' - click: '&7>> &bClick to edit a specific biome! &7<<' - ore: - name: '&fWhole world' - click: '&7>> &bClick to edit the whole world! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all settings! &7<<' - delete: - name: '&fDelete' - click: '&7>> &bClick to delete this world-config! &7<<' - reset-copy: - biome: - click: '&7>> &bClick to select biome! &7<<' - ore: - click: '&7>> &bClick to select whole word! &7<<' - biome: - name: Choose a Biome! - biome: - click: '&7>> &bClick to edit this biome! &7<<' - switch: - biome: - name: '&fBiome' - click: '&7>> &bClick to switch to biome selection! &7<<' - biome-group: - name: '&fBiome Group' - click: '&7>> &bClick to switch to biome group selection! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all biome settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all biome settings! &7<<' - reset-copy: - biome: - click: '&7>> &bClick to select this biome! &7<<' - ore: - name: Choose an Ore! - ore: - name: '&f%%translation:[ore.%ore%]%' - status: ' &7> &fStatus: &a%%translation:[gui.boolean.%status%]%' - click: '&7>> &bClick to edit this ore! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all ore settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all ore settings! &7<<' - reset-copy: - ore: - click: '&7>> &bClick to select this ore! &7<<' - ore-settings: - name: Choose a Setting! - setting: - click: '&7>> &bClick to edit this setting! &7<<' - status: - active: - name: '&fActivate / Deactivate' - current: ' &7> &fCurrently: &aActive' - click: '&7>> &bClick to deactivate this ore! &7<<' - inactive: - name: '&fActivate / Deactivate' - current: ' &7> &fCurrently: &cInactive' - click: '&7>> &bClick to activate this ore! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all settings! &7<<' - reset-copy: - setting: - click: '&7>> &bClick to select this setting! &7<<' - settings: - name: Set a value! - reset: - name: '&fReset' - click: '&7>> &bClick to reset this setting! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy this setting! &7<<' - add: - click: '&7>> &bClick to add %change-value%! &7<<' - remove: - click: '&7>> &bClick to remove %change-value%! &7<<' - verify: - name: Accept or Deny the Action! - accept: - name: '&fAccept' - click: '&7>> &bClick to accept! &7<<' - deny: - name: '&fDeny' - click: '&7>> &bClick to deny! &7<<' - config: - name: Select a config option! - back: - click: '&7>> &bClick to go back to world gui! &7<<' - reload: - name: '&fReload' - click: '&7>> &bClick to reload configs from disk &7<<' - language: - name: '&fLanguage' - description: ' &7> &cHelp to translate the plugin!%%new-line% &7> &fEvery bit - helps, simply%%new-line% &7> &ftranslate the &dmessages.yml%%new-line% &7> - &fin the plugins directory and%%new-line% &7> &fsend it to me.' - click: '&7>> &bClick to change the language! &7<<' - safe-mode: - name: '&fSafe mode' - description: ' &7> &fChoose if the plugin should warn%%new-line% &7> &fyou if - you set a unsafe value.' - click: '&7>> &bClick to turn safe mode on / off! &7<<' - translate-tab-compilation: - name: '&fTap translation' - description: ' &7> &fActivate, if you want to type%%new-line% &7> &fBiomes / - Ores / Settings in your%%new-line% &7> &fselected Language, in commands.' - click: '&7>> &bClick to turn tab translation on / off! &7<<' - verify: - copy-action: - name: '&fVerify copy actions' - description: ' &7> &fActivate, if you want to verify%%new-line% &7> &fcopy - actions.' - click: '&7>> &bClick to turn verification on / off! &7<<' - reset-action: - name: '&fVerify reset actions' - description: ' &7> &fActivate, if you want to verify%%new-line% &7> &freset - actions.' - click: '&7>> &bClick to turn verification on / off! &7<<' - language: - name: Choose a Language! - custom: - click: '&7>> &bClick to select custom as language! &7<<' - boolean: - true-click: '&7>> &bClick to Activate! &7<<' - false-click: '&7>> &bClick to Deactivate! &7<<' - set: - 'true': '&fActivate' - 'false': '&fDeactivate' - name: Activate or Deactivate - 'true': '&aActive' - 'false': '&cInactive' - -welcome: - button-open-string: "&4[" - button-close-string: "&4]" - header: "&bThanks for using Ore-Control! &4(This language file is not fully translated yet)" - found-bug: "If you found a bug, please report it on %%button%" - feature-request: "If you have a feature request, use also %%button%" - support: "Join my %%button% server, if you have questions about my plugin" - support-my-work: "If you like my work, please %%button:[rating]% it, or make a small %%button:[donation]%" - not-show-again: "Do not show again" - not-show-again-success: "&aThe welcome message won't show again" - click-me: "Click me" - rating: "rate" - donation: "donation" \ No newline at end of file diff --git a/ore-control/src/main/resources/messages.yml b/ore-control/src/main/resources/messages.yml deleted file mode 100644 index 33fb6a71..00000000 --- a/ore-control/src/main/resources/messages.yml +++ /dev/null @@ -1,391 +0,0 @@ -version: 10 -command: - player-only: This Command is only for Players! - set: - value: - usage: '&f/&9orecontrol set value &f<&9ore&f> <&9setting&f> <&9world&f> <&9amount&f(&9%&f)>' - description: Set a specific value to an ore type and world - not-enough-args: - - '&4Wrong amount of arguments!' - - '&cuse %%translation:[command.set.value.usage]%' - success: '&aThe value has been updated successfully!' - biome: - usage: '&f/&9orecontrol set biome &f<&9biome&f> <&9ore&f> <&9setting&f> <&9world&f> - <&9amount&f(&9%&f)>' - description: Set a specific value to an ore type in a specific biome and world - not-enough-args: - - '&4Wrong amount of arguments!' - - '&cuse %%translation:[command.set.biome.usage]%' - success: '&aThe value has been updated successfully!' - create: - usage: '&f/&9orecontrol create &f<&9name&f>' - description: Create a template file, in there you can set values before create - a new world - not-enough-args: - - '&4Wrong amount of arguments!' - - '&cuse %%translation:[command.create.usage]%' - success: '&aThe template &f''&9%world-config%&f'' &awas created successfully!' - reload: - usage: '&f/&9orecontrol reload' - description: Reload config, messages and gui settings - begin: '&aBegin with the reload!' - end: '&aReload finish!' - info: - usage: '&f/&9orecontrol info' - description: Shows you some infos about the plugin - help: - separator-format: ' ' - header-format: ~~~~~~~~~~~~~~~~~~~&9Commands&f~~~~~~~~~~~~~~~~~~~ - footer-format: ~~~~~~~~~~~~~~~~~~~&9Commands&f~~~~~~~~~~~~~~~~~~~ - permission-format: '-> &9permission&f: %permission%' - description-format: '-> &9description&f: %description%' - usage-format: '&9usage&f: %usage%' - short-format: '&9%command%&f: %description%' - usage: '&f/&9orecontrol help &f(<&9subcommand&f>)' - description: Displays all commands and if a subcommand is specified, more details - are displayed -world-config: - not-found: '&4The config &f''&9%world-config%&f''&4 does not exist!' - already-exists: '&4The Config &f''&9%world-config%&f'' &4already exist!' -ore: - not-found: - - '&4The ore &f''&9%ore%&f'' &4does not exist!, ' - - '&cuse &f''&9diamond&f'', ''&9coal&f'', ''&9lapis&f'', ''&9iron&f'', ''&9gold&f'', - ''&9gold_badlands&f'' &cor' - - '&f''&9redstone&f''' - not-valid: '&4The Ore &f''&9%ore%&f'' &4is not valid for the biome &f''&9%biome%&f''&4!' - DIAMOND: Diamond - COAL: Coal - GOLD: Gold - GOLD_BADLANDS: Badlands Gold - LAPIS: Lapis - IRON: Iron - REDSTONE: Redstone - EMERALD: Emerald - DIRT: Dirt - GRAVEL: Gravel - GRANITE: Granite - DIORITE: Diorite - ANDESITE: Andesite - NETHER_QUARTZ: Nether Quartz - INFESTED_STONE: Infested Stone - MAGMA: Magma - NETHER_GOLD: Nether Gold - ANCIENT_DEBRIS: Ancient Debris - ANCIENT_DEBRIS_2: Ancient Debris 2 - COPPER: "Copper" -setting: - not-found: '&4The setting &f''&9%setting%&f'' &4does not exist!' - not-valid: '&4The setting &f''&9%setting%&f'' &4is not valid with the ore &f''&9%ore%&f''&4!' - VEIN_SIZE: Vein Size - VEINS_PER_CHUNK: Veins per Chunk - HEIGHT_RANGE: Height Range - HEIGHT_CENTER: Height Center - MINIMUM_ORES_PER_CHUNK: Minimum Ores Per Chunk - ORES_PER_CHUNK_RANGE: Ores per Chunk Range - MINIMUM_HEIGHT: Minimum Height - HEIGHT_SUBTRACT_VALUE: Height Subtract Value - VEINS_PER_BIOME: Veins Per Biome - SEA_LEVEL_DIVIDER: Sea Level Divider - SEA_LEVEL_ADDER: Sea Level Adder -biome: - not-found: '&4The biome &f''&9%biome%&f'' &4does not exist!' - OCEAN: Ocean - PLAINS: Plains - DESERT: Desert - MOUNTAINS: Mountains - FOREST: Forest - TAIGA: Taiga - SWAMP: Swamp - RIVER: River - FROZEN_OCEAN: Frozen Ocean - FROZEN_RIVER: Frozen River - SNOWY_TUNDRA: Snowy Tundra - SNOWY_MOUNTAINS: Snowy Mountains - MUSHROOM_FIELDS: Mushroom Fields - MUSHROOM_FIELD_SHORE: Mushroom Field Shore - BEACH: Beach - DESERT_HILLS: Desert Hills - WOODED_HILLS: Wooded Hills - TAIGA_HILLS: Taiga Hills - MOUNTAIN_EDGE: Mountain Edge - JUNGLE: Jungle - JUNGLE_HILLS: Jungle Hills - JUNGLE_EDGE: Jungle Edge - DEEP_OCEAN: Deep Ocean - STONE_SHORE: Stone Shore - SNOWY_BEACH: Snowy Beach - BIRCH_FOREST: Birch Forest - BIRCH_FOREST_HILLS: Birch Forest Hills - DARK_FOREST: Dark Forest - SNOWY_TAIGA: Snowy Taiga - SNOWY_TAIGA_HILLS: Snowy Taiga Hills - GIANT_TREE_TAIGA: Giant Tree Taiga - GIANT_TREE_TAIGA_HILLS: Giant Tree Taiga Hills - WOODED_MOUNTAINS: Wooded Mountains - SAVANNA: Savanna - SAVANNA_PLATEAU: Savanna Plateau - BADLANDS: Badlands - WOODED_BADLANDS_PLATEAU: Wooded Badlands Plateau - BADLANDS_PLATEAU: Badlands Plateau - WARM_OCEAN: Warm Ocean - LUKEWARM_OCEAN: Lukewarm Ocean - COLD_OCEAN: Cold Ocean - DEEP_WARM_OCEAN: Deep Warm Ocean - DEEP_LUKEWARM_OCEAN: Deep Lukewarm Ocean - DEEP_COLD_OCEAN: Deep Cold Ocean - DEEP_FROZEN_OCEAN: Deep Frozen Ocean - SUNFLOWER_PLAINS: Sunflower Plains - DESERT_LAKES: Desert Lakes - GRAVELLY_MOUNTAINS: Gravelly Mountains - FLOWER_FOREST: Flower Forest - TAIGA_MOUNTAINS: Taiga Mountains - SWAMP_HILLS: Swamp Hills - ICE_SPIKES: Ice Spikes - MODIFIED_JUNGLE: Modified Jungle - MODIFIED_JUNGLE_EDGE: Modified Jungle Edge - TALL_BIRCH_FOREST: Tall Birch Forest - TALL_BIRCH_HILLS: Tall Birch Hills - DARK_FOREST_HILLS: Dark Forest Hills - SNOWY_TAIGA_MOUNTAINS: Snowy Taiga Mountains - GIANT_SPRUCE_TAIGA: Giant Spruce Taiga - GIANT_SPRUCE_TAIGA_HILLS: Giant Spruce Taiga Hills - MODIFIED_GRAVELLY_MOUNTAINS: Modified Gravelly Mountains - SHATTERED_SAVANNA: Shattered Savanna - SHATTERED_SAVANNA_PLATEAU: Shattered Savanna Plateau - ERODED_BADLANDS: Eroded Badlands - MODIFIED_WOODED_BADLANDS_PLATEAU: Modified Wooded Badlands Plateau - MODIFIED_BADLANDS_PLATEAU: Modified Badlands Plateau - BAMBOO_JUNGLE: Bamboo Jungle - BAMBOO_JUNGLE_HILLS: Bamboo Jungle Hills - HILLS: Hills - SNOWY: Snowy - NETHER: Nether - NETHER_WASTES: Nether Wastes - SOUL_SAND_VALLEY: Soul Sand Valley - CRIMSON_FOREST: Crimson Forest - WARPED_FOREST: Warped Forest - BASALT_DELTAS: Basalt Deltas -config-type: - GLOBAL: Global - TEMPLATE: Template - OVERWORLD: Overworld - NETHER: Nether -number: - not-valid: '&f''&9%value%&f'' &4is not a valid number!' - not-safe: - - '&4The number &f''&9%value%&f'' &4is not safe!' - - '&4If you want to use it anyway,' - - '&4set &f''&9safe-mode&f'' &4in the config to &f''&9false&f''' - - '&4And execute the &f''&9/orecontrol reload&f'' &4command' - not-safe-warning: '&eWarn: The number &f''&9%value%&f'' &eis not safe!' - not-safe-see-also: "&eFor more infos visit this %%button%&e wiki post" -gui: - copy: - success: '&aCopy the values with Success!' - reset: - success: '&aReset the values with Success!' - anvil: - title: Type a name! - previous-page: - name: '&fPrevious page' - click: '&7>> &bClick to go to the previous page! &7<<' - next-page: - name: '&fNext page' - click: '&7>> &bClick to go to the next page! &7<<' - back: - name: '&fBack' - click: '&7>> &bClick to go a step back! &7<<' - abort: - name: '&fAbort' - click: '&7>> &bClick to abort the copy action! &7<<' - info: - name: '&eInfo' - lore-world: ' &7> &fWorld: &d%world%' - lore-biome: ' &7> &fBiome: &d%%translation:[biome.%biome%]%' - lore-ore: ' &7> &fOre: &d%%translation:[ore.%ore%]%' - lore-setting: ' &7> &fSetting: &d%%translation:[setting.%setting%]%' - lore-current: ' &7> &fCurrently: &d%amount%' - lore-default: ' &7> &fDefault: &d%default%' - world: - name: Choose a World! - type: ' &7> &fType: &d%%translation:[config-type.%config-type%]%' - world: - click: '&7>> &bClick to edit this world! &7<<' - template: - create: - name: '&fNew template' - create: '&7>> &bClick to create a new template! &7<<' - click: '&7>> &bClick to edit this template! &7<<' - global: - click: '&7>> &bClick to edit the global config! &7<<' - config: - name: '&fConfig' - click: '&7>> &bClick to edit the config! &7<<' - reset-copy: - world: - click: '&7>> &bClick to select this world! &7<<' - template: - click: '&7>> &bClick to select this template! &7<<' - global: - click: '&7>> &bClick to select the global config! &7<<' - world-config: - name: Choose a Type! - biome: - name: '&fBiome specific' - click: '&7>> &bClick to edit a specific biome! &7<<' - ore: - name: '&fWhole world' - click: '&7>> &bClick to edit the whole world! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all settings! &7<<' - delete: - name: '&fDelete' - click: '&7>> &bClick to delete this world-config! &7<<' - reset-copy: - biome: - click: '&7>> &bClick to select biome! &7<<' - ore: - click: '&7>> &bClick to select whole word! &7<<' - biome: - name: Choose a Biome! - biome: - click: '&7>> &bClick to edit this biome! &7<<' - switch: - biome: - name: '&fBiome' - click: '&7>> &bClick to switch to biome selection! &7<<' - biome-group: - name: '&fBiome Group' - click: '&7>> &bClick to switch to biome group selection! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all biome settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all biome settings! &7<<' - reset-copy: - biome: - click: '&7>> &bClick to select this biome! &7<<' - ore: - name: Choose an Ore! - ore: - name: '&f%%translation:[ore.%ore%]%' - status: ' &7> &fStatus: &a%%translation:[gui.boolean.%status%]%' - click: '&7>> &bClick to edit this ore! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all ore settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all ore settings! &7<<' - reset-copy: - ore: - click: '&7>> &bClick to select this ore! &7<<' - ore-settings: - name: Choose a Setting! - setting: - click: '&7>> &bClick to edit this setting! &7<<' - status: - active: - name: '&fActivate / Deactivate' - current: ' &7> &fCurrently: &aActive' - click: '&7>> &bClick to deactivate this ore! &7<<' - inactive: - name: '&fActivate / Deactivate' - current: ' &7> &fCurrently: &cInactive' - click: '&7>> &bClick to activate this ore! &7<<' - reset: - name: '&fReset' - click: '&7>> &bClick to reset all settings! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy all settings! &7<<' - reset-copy: - setting: - click: '&7>> &bClick to select this setting! &7<<' - settings: - name: Set a value! - reset: - name: '&fReset' - click: '&7>> &bClick to reset this setting! &7<<' - copy: - name: '&fCopy' - click: '&7>> &bClick to copy this setting! &7<<' - add: - click: '&7>> &bClick to add %change-value%! &7<<' - remove: - click: '&7>> &bClick to remove %change-value%! &7<<' - verify: - name: Accept or Deny the Action! - accept: - name: '&fAccept' - click: '&7>> &bClick to accept! &7<<' - deny: - name: '&fDeny' - click: '&7>> &bClick to deny! &7<<' - config: - name: Select a config option! - back: - click: '&7>> &bClick to go back to world gui! &7<<' - reload: - name: '&fReload' - click: '&7>> &bClick to reload configs from disk &7<<' - language: - name: '&fLanguage' - description: ' &7> &cHelp to translate the plugin!%%new-line% &7> &fEvery bit - helps, simply%%new-line% &7> &ftranslate the &dmessages.yml%%new-line% &7> - &fin the plugins directory and%%new-line% &7> &fsend it to me.' - click: '&7>> &bClick to change the language! &7<<' - safe-mode: - name: '&fSafe mode' - description: ' &7> &fChoose if the plugin should warn%%new-line% &7> &fyou if - you set a unsafe value.' - click: '&7>> &bClick to turn safe mode on / off! &7<<' - translate-tab-compilation: - name: '&fTap translation' - description: ' &7> &fActivate, if you want to type%%new-line% &7> &fBiomes / - Ores / Settings in your%%new-line% &7> &fselected Language, in commands.' - click: '&7>> &bClick to turn tab translation on / off! &7<<' - verify: - copy-action: - name: '&fVerify copy actions' - description: ' &7> &fActivate, if you want to verify%%new-line% &7> &fcopy - actions.' - click: '&7>> &bClick to turn verification on / off! &7<<' - reset-action: - name: '&fVerify reset actions' - description: ' &7> &fActivate, if you want to verify%%new-line% &7> &freset - actions.' - click: '&7>> &bClick to turn verification on / off! &7<<' - language: - name: Choose a Language! - custom: - click: '&7>> &bClick to select custom as language! &7<<' - boolean: - true-click: '&7>> &bClick to Activate! &7<<' - false-click: '&7>> &bClick to Deactivate! &7<<' - set: - 'true': '&fActivate' - 'false': '&fDeactivate' - name: Activate or Deactivate - 'true': '&aActive' - 'false': '&cInactive' -welcome: - button-open-string: '&4[' - button-close-string: '&4]' - header: '&bThanks for using Ore-Control!' - found-bug: If you found a bug, please report it on %%button% - feature-request: If you have a feature request, use also %%button% - support: Join my %%button% server, if you have questions about my plugin - support-my-work: If you like my work, please %%button:[rating]% it, or make a small - %%button:[donation]% - not-show-again: Do not show again - not-show-again-success: '&aThe welcome message won''t show again' - click-me: Click me - rating: rate - donation: donation diff --git a/ore-control/src/main/resources/plugin.yml b/ore-control/src/main/resources/plugin.yml index ac8bd5a0..74f89f3a 100644 --- a/ore-control/src/main/resources/plugin.yml +++ b/ore-control/src/main/resources/plugin.yml @@ -7,112 +7,4 @@ authors: [${project.authors}] # @formatter:on main: de.derfrzocker.ore.control.OreControl api-version: "1.13" -load: STARTUP -commands: - orecontrol: - permission: "ore.control" - -permissions: - ore.control: - description: "Base permission" - default: op - ore.control.*: - description: "Gives access to all Ore Control commands and functions" - default: op - children: - ore.control: true - ore.control.set.*: true - ore.control.reload: true - ore.control.gui: true - ore.control.template.*: true - ore.control.value.*: true - ore.control.config.edit: true - ore.control.set.*: - description: "Gives access to the subcommand 'set' and 'setbiome' and to set normal and biome values via gui" - default: op - children: - ore.control: true - ore.control.set: true - ore.control.set.biome: true - ore.control.set: - description: "Gives access to the subcommand 'set' and to set normal values via gui" - default: op - children: - ore.control: true - ore.control.gui: true - ore.control.set.value: - description: "Gives access to the subcommand 'set value' and to set normal values via gui" - default: op - children: - ore.control.set: true - ore.control.gui: true - ore.control.set.biome: - description: "Gives access to the subcommand 'set biome' and to set biome values via gui" - default: op - children: - ore.control.set: true - ore.control.gui: true - ore.control.reload: - description: "Gives access to the subcommand 'reload'" - default: op - children: - ore.control: true - ore.control.gui: - description: "Gives access to the gui" - default: op - children: - ore.control: true - ore.control.template: - description: "Base template permission" - default: op - children: - ore.control: true - ore.control.template.*: - description: "Gives access to the subcommand 'create' and to create and delete templates via the gui" - default: op - children: - ore.control.template: true - ore.control.template.create: true - ore.control.template.delete: true - ore.control.template.create: - description: "Gives access to the subcommand 'create' and to create templates via the gui" - default: op - children: - ore.control.template: true - ore.control.gui: true - ore.control.template.delete: - description: "Gives access to delete templates via the gui" - default: op - children: - ore.control.template: true - ore.control.gui: true - ore.control.value: - description: "Base value permission" - default: op - children: - ore.control: true - ore.control.value.*: - description: "Gives access to reset and copy values via the gui" - default: op - children: - ore.control.value: true - ore.control.value.reset: true - ore.control.value.copy: true - ore.control.value.reset: - description: "Gives access to reset values via the gui" - default: op - children: - ore.control.value: true - ore.control.gui: true - ore.control.value.copy: - description: "Gives access to copy values via the gui" - default: op - children: - ore.control.value: true - ore.control.gui: true - ore.control.config.edit: - description: "Gives access to edit the config via the gui" - default: op - children: - ore.control: true - ore.control.gui: true \ No newline at end of file +load: STARTUP \ No newline at end of file diff --git a/pom.xml b/pom.xml index 23ee45fa..dc17be29 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,7 @@ api impl ore-control - ore-control-lite - metrics + common pom @@ -23,8 +22,8 @@ dev-SNAPSHOT UTF-8 - 1.8 - 1.8 + 17 + 17 yyyy.MM.d DerFrZocker Pings @@ -47,13 +46,24 @@ CodeMC https://repo.codemc.org/repository/maven-public + + minecraft-libraries + Minecraft Libraries + https://libraries.minecraft.net + org.spigotmc spigot-api - 1.14.4-R0.1-SNAPSHOT + 1.18.1-R0.1-SNAPSHOT + provided + + + com.mojang + datafixerupper + 4.0.26 provided