From 8052ffa706fb68eb74a6e947c3f97f4d11ea6541 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Sun, 20 Aug 2023 17:39:22 +0300 Subject: [PATCH 1/4] Added ability to specify local storage usage individually for each persistent data key via a constructor parameter --- .../eco/core/data/keys/PersistentDataKey.java | 28 +++++++++++++++++++ .../eco/internal/spigot/data/EcoProfile.kt | 1 + 2 files changed, 29 insertions(+) diff --git a/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java b/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java index 44ce98c98..00f0aa8b2 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java +++ b/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java @@ -29,6 +29,31 @@ public final class PersistentDataKey { */ private final PersistentDataKeyType type; + /** + * If the key uses local storage. + */ + private final boolean local; + + /** + * Create a new Persistent Data Key. + * + * @param key The key. + * @param type The data type. + * @param defaultValue The default value. + * @param local If the key uses local storage. + */ + public PersistentDataKey(@NotNull final NamespacedKey key, + @NotNull final PersistentDataKeyType type, + @NotNull final T defaultValue, + final boolean local) { + this.key = key; + this.defaultValue = defaultValue; + this.type = type; + this.local = local; + + Eco.get().registerPersistentKey(this); + } + /** * Create a new Persistent Data Key. * @@ -42,6 +67,7 @@ public PersistentDataKey(@NotNull final NamespacedKey key, this.key = key; this.defaultValue = defaultValue; this.type = type; + this.local = false; Eco.get().registerPersistentKey(this); } @@ -82,6 +108,8 @@ public PersistentDataKeyType getType() { return this.type; } + public boolean isLocalStorage() { return this.local; } + /** * Get all persistent data keys. * diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt index 7de71c377..72ba1062f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt @@ -106,3 +106,4 @@ class EcoServerProfile( private val PersistentDataKey<*>.isLocal: Boolean get() = this == localServerIDKey || EcoPlugin.getPlugin(this.key.namespace)?.isUsingLocalStorage == true + || this.isLocalStorage From 510034af0d3d602cc3a2c705fe7edea2e0acbb73 Mon Sep 17 00:00:00 2001 From: Sen2000 <18487475+SenPr@users.noreply.github.com> Date: Sun, 3 Sep 2023 18:03:19 +0700 Subject: [PATCH 2/4] Fix RoyaleEconomy integration --- .../com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt index 519b6ae34..af1ee650d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt @@ -367,8 +367,10 @@ abstract class EcoSpigotPlugin : EcoPlugin() { }, IntegrationLoader("PlayerPoints") { Prices.registerPriceFactory(PriceFactoryPlayerPoints()) }, IntegrationLoader("RoyaleEconomy") { - for (currency in MultiCurrencyHandler.getCurrencies()) { - Prices.registerPriceFactory(PriceFactoryRoyaleEconomy(currency)) + if (!MultiCurrencyHandler.getCurrencies().isNullOrEmpty()) { + for (currency in MultiCurrencyHandler.getCurrencies()) { + Prices.registerPriceFactory(PriceFactoryRoyaleEconomy(currency)) + } } }, From 67d70098ef67d0af629f56f289f693653ef2c43e Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Sun, 3 Dec 2023 05:34:00 +0300 Subject: [PATCH 3/4] - Added CustomBiomesManager to add support for custom world generators and their biomes - Added a Terra generator integration for Custom Biomes - Added an entity arg parser to set entity type for spawners (`item: spawner entity:zombie`) --- build.gradle.kts | 3 + .../custombiomes/CustomBiome.java | 13 ++++ .../custombiomes/CustomBiomesIntegration.java | 20 ++++++ .../custombiomes/CustomBiomesManager.java | 58 ++++++++++++++++ .../eco/internal/items/ArgParserEntity.kt | 64 +++++++++++++++++ eco-core/core-plugin/build.gradle.kts | 2 + .../eco/internal/spigot/EcoSpigotPlugin.kt | 69 +++---------------- .../custombiomes/CustomBiomesTerra.kt | 25 +++++++ .../src/main/resources/paper-plugin.yml | 4 ++ .../core-plugin/src/main/resources/plugin.yml | 1 + 10 files changed, 201 insertions(+), 58 deletions(-) create mode 100644 eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java create mode 100644 eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java create mode 100644 eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java create mode 100644 eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEntity.kt create mode 100644 eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt diff --git a/build.gradle.kts b/build.gradle.kts index c4cc1ccb5..196779bc6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -86,6 +86,9 @@ allprojects { // Denizen maven("https://maven.citizensnpcs.co/repo") + + // FoliaLib + maven("https://nexuslite.gcnt.net/repos/other/") } dependencies { diff --git a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java new file mode 100644 index 000000000..c9f167edd --- /dev/null +++ b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java @@ -0,0 +1,13 @@ +package com.willfp.eco.core.integrations.custombiomes; + +public class CustomBiome { + private final String name; + + public CustomBiome(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} diff --git a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java new file mode 100644 index 000000000..b9e767e2b --- /dev/null +++ b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java @@ -0,0 +1,20 @@ +package com.willfp.eco.core.integrations.custombiomes; + +import com.willfp.eco.core.integrations.Integration; +import org.bukkit.Location; + +import javax.annotation.Nullable; + +/** + * Wrapper class for custom biome integrations. + */ +public interface CustomBiomesIntegration extends Integration { + /** + * Get a biome at given location. (Supports vanilla biomes as well) + * + * @param location The location to get the biome at. + * @return The found biome, null otherwise + */ + @Nullable + CustomBiome getBiome(Location location); +} diff --git a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java new file mode 100644 index 000000000..ef58c959e --- /dev/null +++ b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java @@ -0,0 +1,58 @@ +package com.willfp.eco.core.integrations.custombiomes; + +import com.willfp.eco.core.Eco; +import com.willfp.eco.core.integrations.IntegrationRegistry; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Biome; +import org.bukkit.event.Listener; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public final class CustomBiomesManager { + /** + * A set of all registered biomes. + */ + private static final IntegrationRegistry REGISTRY = new IntegrationRegistry<>(); + + /** + * Register a new biomes integration. + * + * @param biomesIntegration The biomes integration to register. + */ + public static void register(@NotNull final CustomBiomesIntegration biomesIntegration) { + if (biomesIntegration instanceof Listener) { + Eco.get().getEcoPlugin().getEventManager().registerListener((Listener) biomesIntegration); + } + REGISTRY.register(biomesIntegration); + } + + @Nullable + public static CustomBiome getBiomeAt(@NotNull Location location) { + World world = location.getWorld(); + + if (world == null) { + return null; + } + + Biome vanilla = world.getBiome(location); + + if (vanilla.name().equalsIgnoreCase("custom")) { + for (CustomBiomesIntegration integration : REGISTRY) { + CustomBiome biome = integration.getBiome(location); + + if (biome != null) { + return biome; + } + } + + return null; + } else { + return new CustomBiome(vanilla.name()); + } + } + + private CustomBiomesManager() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } +} diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEntity.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEntity.kt new file mode 100644 index 000000000..05387c11b --- /dev/null +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEntity.kt @@ -0,0 +1,64 @@ +package com.willfp.eco.internal.items + +import com.willfp.eco.core.items.args.LookupArgParser +import org.bukkit.block.CreatureSpawner +import org.bukkit.entity.EntityType +import org.bukkit.inventory.ItemStack +import org.bukkit.inventory.meta.BlockStateMeta +import org.bukkit.inventory.meta.ItemMeta +import java.util.function.Predicate + +object ArgParserEntity : LookupArgParser { + override fun parseArguments(args: Array, meta: ItemMeta): Predicate? { + if (meta !is BlockStateMeta) { + return null + } + + if (meta.hasBlockState() || meta.blockState !is CreatureSpawner) { + return null + } + + val state = meta.blockState as CreatureSpawner + + var type: String? = null + + for (arg in args) { + val argSplit = arg.split(":") + if (!argSplit[0].equals("entity", ignoreCase = true)) { + continue + } + if (argSplit.size < 2) { + continue + } + type = argSplit[1] + } + + type ?: return null + + val entityType = runCatching { EntityType.valueOf(type.uppercase()) }.getOrNull() ?: return null + + state.spawnedType = entityType + + meta.blockState = state + + return Predicate { + val testMeta = ((it.itemMeta as? BlockStateMeta) as? CreatureSpawner) ?: return@Predicate false + + testMeta.spawnedType?.name?.equals(type, true) == true + } + } + + override fun serializeBack(meta: ItemMeta): String? { + if (meta !is BlockStateMeta) { + return null + } + + if (meta.hasBlockState() || meta.blockState !is CreatureSpawner) { + return null + } + + val state = meta.blockState as CreatureSpawner + + return state.spawnedType?.let { "entity:${state.spawnedType!!.name}" } ?: return null + } +} \ No newline at end of file diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index 47f4a1cec..e8b05ee3b 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -61,6 +61,8 @@ dependencies { compileOnly("com.denizenscript:denizen:1.2.7-SNAPSHOT") { exclude(group = "*", module = "*") } + compileOnly("com.dfsek.terra:common:6.4.1-BETA+3aef97738") + compileOnly(fileTree("../../lib") { include("*.jar") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt index af1ee650d..b4d7e5552 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt @@ -9,6 +9,7 @@ import com.willfp.eco.core.integrations.IntegrationLoader import com.willfp.eco.core.integrations.afk.AFKManager import com.willfp.eco.core.integrations.anticheat.AnticheatManager import com.willfp.eco.core.integrations.antigrief.AntigriefManager +import com.willfp.eco.core.integrations.custombiomes.CustomBiomesManager import com.willfp.eco.core.integrations.customentities.CustomEntitiesManager import com.willfp.eco.core.integrations.customitems.CustomItemsManager import com.willfp.eco.core.integrations.economy.EconomyManager @@ -22,34 +23,8 @@ import com.willfp.eco.core.particle.Particles import com.willfp.eco.core.price.Prices import com.willfp.eco.internal.data.MavenVersionToStringAdapter import com.willfp.eco.internal.data.VersionToStringAdapter -import com.willfp.eco.internal.entities.EntityArgParserAdult -import com.willfp.eco.internal.entities.EntityArgParserAttackDamage -import com.willfp.eco.internal.entities.EntityArgParserAttackSpeed -import com.willfp.eco.internal.entities.EntityArgParserBaby -import com.willfp.eco.internal.entities.EntityArgParserCharged -import com.willfp.eco.internal.entities.EntityArgParserEquipment -import com.willfp.eco.internal.entities.EntityArgParserExplosionRadius -import com.willfp.eco.internal.entities.EntityArgParserFlySpeed -import com.willfp.eco.internal.entities.EntityArgParserFollowRange -import com.willfp.eco.internal.entities.EntityArgParserHealth -import com.willfp.eco.internal.entities.EntityArgParserJumpStrength -import com.willfp.eco.internal.entities.EntityArgParserKnockback -import com.willfp.eco.internal.entities.EntityArgParserKnockbackResistance -import com.willfp.eco.internal.entities.EntityArgParserName -import com.willfp.eco.internal.entities.EntityArgParserNoAI -import com.willfp.eco.internal.entities.EntityArgParserSilent -import com.willfp.eco.internal.entities.EntityArgParserSize -import com.willfp.eco.internal.entities.EntityArgParserSpawnReinforcements -import com.willfp.eco.internal.entities.EntityArgParserSpeed -import com.willfp.eco.internal.items.ArgParserColor -import com.willfp.eco.internal.items.ArgParserCustomModelData -import com.willfp.eco.internal.items.ArgParserEnchantment -import com.willfp.eco.internal.items.ArgParserFlag -import com.willfp.eco.internal.items.ArgParserHead -import com.willfp.eco.internal.items.ArgParserName -import com.willfp.eco.internal.items.ArgParserTexture -import com.willfp.eco.internal.items.ArgParserTrim -import com.willfp.eco.internal.items.ArgParserUnbreakable +import com.willfp.eco.internal.entities.* +import com.willfp.eco.internal.items.* import com.willfp.eco.internal.lookup.SegmentParserGroup import com.willfp.eco.internal.lookup.SegmentParserUseIfPresent import com.willfp.eco.internal.particle.ParticleFactoryRGB @@ -69,37 +44,11 @@ import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorListener import com.willfp.eco.internal.spigot.gui.GUIListener import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationCMI import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationEssentials -import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatAAC -import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatAlice -import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatMatrix -import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatNCP -import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatSpartan -import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatVulcan -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefBentoBox -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCombatLogXV10 -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCombatLogXV11 -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCrashClaim -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefDeluxeCombat -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefFabledSkyBlock -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefFactionsUUID -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefGriefPrevention -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefIridiumSkyblock -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefKingdoms -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefLands -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefPvPManager -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefRPGHorses -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefSuperiorSkyblock2 -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefTowny -import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefWorldGuard +import com.willfp.eco.internal.spigot.integrations.anticheat.* +import com.willfp.eco.internal.spigot.integrations.antigrief.* +import com.willfp.eco.internal.spigot.integrations.custombiomes.CustomBiomesTerra import com.willfp.eco.internal.spigot.integrations.customentities.CustomEntitiesMythicMobs -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsCustomCrafting -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsDenizen -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsExecutableItems -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsHeadDatabase -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsItemsAdder -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsMythicMobs -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsOraxen -import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsScyther +import com.willfp.eco.internal.spigot.integrations.customitems.* import com.willfp.eco.internal.spigot.integrations.customrecipes.CustomRecipeCustomCrafting import com.willfp.eco.internal.spigot.integrations.economy.EconomyVault import com.willfp.eco.internal.spigot.integrations.entitylookup.EntityLookupModelEngine @@ -149,6 +98,7 @@ abstract class EcoSpigotPlugin : EcoPlugin() { Items.registerArgParser(ArgParserUnbreakable) Items.registerArgParser(ArgParserName) Items.registerArgParser(ArgParserHead) + Items.registerArgParser(ArgParserEntity) if (Prerequisite.HAS_1_20.isMet) { Items.registerArgParser(ArgParserTrim) } @@ -374,6 +324,9 @@ abstract class EcoSpigotPlugin : EcoPlugin() { } }, + // Biomes + IntegrationLoader("Terra") { CustomBiomesManager.register(CustomBiomesTerra()) }, + // Placeholder IntegrationLoader("PlaceholderAPI") { PlaceholderManager.addIntegration(PlaceholderIntegrationPAPI()) }, diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt new file mode 100644 index 000000000..1348a838c --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt @@ -0,0 +1,25 @@ +package com.willfp.eco.internal.spigot.integrations.custombiomes + +import com.dfsek.terra.bukkit.world.BukkitAdapter +import com.willfp.eco.core.integrations.custombiomes.CustomBiome +import com.willfp.eco.core.integrations.custombiomes.CustomBiomesIntegration +import org.bukkit.Location + +class CustomBiomesTerra: CustomBiomesIntegration { + override fun getPluginName(): String { + return "Terra" + } + + override fun getBiome(location: Location?): CustomBiome? { + if (location == null || location.world == null) { + return null + } + + val terraLocation = BukkitAdapter.adapt(location) ?: return null + val terraWorld = BukkitAdapter.adapt(location.world!!) ?: return null + val biomeProvider = terraWorld.biomeProvider ?: return null + val biome = biomeProvider.getBiome(terraLocation, terraWorld.seed) ?: return null + + return CustomBiome(biome.id) + } +} \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/paper-plugin.yml b/eco-core/core-plugin/src/main/resources/paper-plugin.yml index cd6a32065..1280303e7 100644 --- a/eco-core/core-plugin/src/main/resources/paper-plugin.yml +++ b/eco-core/core-plugin/src/main/resources/paper-plugin.yml @@ -5,6 +5,10 @@ api-version: 1.19 load: STARTUP dependencies: + - name: Terra + required: false + bootstrap: false + - name: ProtocolLib required: false bootstrap: false diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index ed993213a..d81192a21 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -6,6 +6,7 @@ authors: [ Auxilor ] website: willfp.com load: STARTUP softdepend: + - Terra - ProtocolLib - WorldGuard - GriefPrevention From 6248dafc700314451dd858e8d7e1c5179760b11a Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 4 Dec 2023 01:29:06 +0300 Subject: [PATCH 4/4] Removed the custom biomes manager (moved to libreforge) --- build.gradle.kts | 3 - .../custombiomes/CustomBiome.java | 13 ----- .../custombiomes/CustomBiomesIntegration.java | 20 ------- .../custombiomes/CustomBiomesManager.java | 58 ------------------- eco-core/core-plugin/build.gradle.kts | 2 - .../eco/internal/spigot/EcoSpigotPlugin.kt | 5 -- .../custombiomes/CustomBiomesTerra.kt | 25 -------- 7 files changed, 126 deletions(-) delete mode 100644 eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java delete mode 100644 eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java delete mode 100644 eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java delete mode 100644 eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt diff --git a/build.gradle.kts b/build.gradle.kts index 196779bc6..c4cc1ccb5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -86,9 +86,6 @@ allprojects { // Denizen maven("https://maven.citizensnpcs.co/repo") - - // FoliaLib - maven("https://nexuslite.gcnt.net/repos/other/") } dependencies { diff --git a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java deleted file mode 100644 index c9f167edd..000000000 --- a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiome.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.eco.core.integrations.custombiomes; - -public class CustomBiome { - private final String name; - - public CustomBiome(String name) { - this.name = name; - } - - public String getName() { - return name; - } -} diff --git a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java deleted file mode 100644 index b9e767e2b..000000000 --- a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesIntegration.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.eco.core.integrations.custombiomes; - -import com.willfp.eco.core.integrations.Integration; -import org.bukkit.Location; - -import javax.annotation.Nullable; - -/** - * Wrapper class for custom biome integrations. - */ -public interface CustomBiomesIntegration extends Integration { - /** - * Get a biome at given location. (Supports vanilla biomes as well) - * - * @param location The location to get the biome at. - * @return The found biome, null otherwise - */ - @Nullable - CustomBiome getBiome(Location location); -} diff --git a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java b/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java deleted file mode 100644 index ef58c959e..000000000 --- a/eco-api/src/main/java/com/willfp/eco/core/integrations/custombiomes/CustomBiomesManager.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.willfp.eco.core.integrations.custombiomes; - -import com.willfp.eco.core.Eco; -import com.willfp.eco.core.integrations.IntegrationRegistry; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.Biome; -import org.bukkit.event.Listener; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public final class CustomBiomesManager { - /** - * A set of all registered biomes. - */ - private static final IntegrationRegistry REGISTRY = new IntegrationRegistry<>(); - - /** - * Register a new biomes integration. - * - * @param biomesIntegration The biomes integration to register. - */ - public static void register(@NotNull final CustomBiomesIntegration biomesIntegration) { - if (biomesIntegration instanceof Listener) { - Eco.get().getEcoPlugin().getEventManager().registerListener((Listener) biomesIntegration); - } - REGISTRY.register(biomesIntegration); - } - - @Nullable - public static CustomBiome getBiomeAt(@NotNull Location location) { - World world = location.getWorld(); - - if (world == null) { - return null; - } - - Biome vanilla = world.getBiome(location); - - if (vanilla.name().equalsIgnoreCase("custom")) { - for (CustomBiomesIntegration integration : REGISTRY) { - CustomBiome biome = integration.getBiome(location); - - if (biome != null) { - return biome; - } - } - - return null; - } else { - return new CustomBiome(vanilla.name()); - } - } - - private CustomBiomesManager() { - throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); - } -} diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index e8b05ee3b..47f4a1cec 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -61,8 +61,6 @@ dependencies { compileOnly("com.denizenscript:denizen:1.2.7-SNAPSHOT") { exclude(group = "*", module = "*") } - compileOnly("com.dfsek.terra:common:6.4.1-BETA+3aef97738") - compileOnly(fileTree("../../lib") { include("*.jar") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt index b4d7e5552..b427a3d9e 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt @@ -9,7 +9,6 @@ import com.willfp.eco.core.integrations.IntegrationLoader import com.willfp.eco.core.integrations.afk.AFKManager import com.willfp.eco.core.integrations.anticheat.AnticheatManager import com.willfp.eco.core.integrations.antigrief.AntigriefManager -import com.willfp.eco.core.integrations.custombiomes.CustomBiomesManager import com.willfp.eco.core.integrations.customentities.CustomEntitiesManager import com.willfp.eco.core.integrations.customitems.CustomItemsManager import com.willfp.eco.core.integrations.economy.EconomyManager @@ -46,7 +45,6 @@ import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationCMI import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationEssentials import com.willfp.eco.internal.spigot.integrations.anticheat.* import com.willfp.eco.internal.spigot.integrations.antigrief.* -import com.willfp.eco.internal.spigot.integrations.custombiomes.CustomBiomesTerra import com.willfp.eco.internal.spigot.integrations.customentities.CustomEntitiesMythicMobs import com.willfp.eco.internal.spigot.integrations.customitems.* import com.willfp.eco.internal.spigot.integrations.customrecipes.CustomRecipeCustomCrafting @@ -324,9 +322,6 @@ abstract class EcoSpigotPlugin : EcoPlugin() { } }, - // Biomes - IntegrationLoader("Terra") { CustomBiomesManager.register(CustomBiomesTerra()) }, - // Placeholder IntegrationLoader("PlaceholderAPI") { PlaceholderManager.addIntegration(PlaceholderIntegrationPAPI()) }, diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt deleted file mode 100644 index 1348a838c..000000000 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/custombiomes/CustomBiomesTerra.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.willfp.eco.internal.spigot.integrations.custombiomes - -import com.dfsek.terra.bukkit.world.BukkitAdapter -import com.willfp.eco.core.integrations.custombiomes.CustomBiome -import com.willfp.eco.core.integrations.custombiomes.CustomBiomesIntegration -import org.bukkit.Location - -class CustomBiomesTerra: CustomBiomesIntegration { - override fun getPluginName(): String { - return "Terra" - } - - override fun getBiome(location: Location?): CustomBiome? { - if (location == null || location.world == null) { - return null - } - - val terraLocation = BukkitAdapter.adapt(location) ?: return null - val terraWorld = BukkitAdapter.adapt(location.world!!) ?: return null - val biomeProvider = terraWorld.biomeProvider ?: return null - val biome = biomeProvider.getBiome(terraLocation, terraWorld.seed) ?: return null - - return CustomBiome(biome.id) - } -} \ No newline at end of file