From 9762fe8b173791e83b03d189b3826172a6788815 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 12 Jan 2022 12:45:02 +0000 Subject: [PATCH] Updated libreforge to 3.0.0 --- build.gradle | 3 +- .../willfp/ecoenchants/EcoEnchantsPlugin.java | 30 +++++++------------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/build.gradle b/build.gradle index bfbf3dbdb6..b697de6a17 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,6 @@ allprojects { shadowJar { relocate('com.willfp.libreforge', 'com.willfp.ecoenchants.libreforge') - relocate('redempt.crunch', 'com.willfp.ecoenchants.libreforge.crunch') } compileJava { @@ -57,7 +56,7 @@ allprojects { dependencies { compileOnly 'com.willfp:eco:6.17.1' - implementation 'com.willfp:libreforge:2.18.1' + implementation 'com.willfp:libreforge:3.0.0' compileOnly 'org.jetbrains:annotations:19.0.0' diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java index 19a20d2838..4cf2a8fb88 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java @@ -1,6 +1,5 @@ package com.willfp.ecoenchants; -import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.command.impl.PluginCommand; import com.willfp.eco.core.display.DisplayModule; import com.willfp.eco.core.fast.FastItemStack; @@ -30,7 +29,7 @@ import com.willfp.ecoenchants.integrations.mythicmobs.plugins.IntegrationMythicMobs; import com.willfp.ecoenchants.integrations.registration.RegistrationManager; import com.willfp.ecoenchants.integrations.registration.plugins.IntegrationEssentials; -import com.willfp.libreforge.LibReforge; +import com.willfp.libreforge.LibReforgePlugin; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.event.HandlerList; @@ -44,7 +43,7 @@ import java.util.Objects; @SuppressWarnings("unused") -public class EcoEnchantsPlugin extends EcoPlugin { +public class EcoEnchantsPlugin extends LibReforgePlugin { /** * Instance of the plugin. */ @@ -74,8 +73,7 @@ public class EcoEnchantsPlugin extends EcoPlugin { * Internal constructor called by bukkit on plugin load. */ public EcoEnchantsPlugin() { - super(490, 7666, "com.willfp.ecoenchants.proxy", "&a", true); - LibReforge.init(this); + super(490, 7666, "&a", "com.willfp.ecoenchants.proxy"); instance = this; rarityYml = new RarityYml(this); @@ -83,28 +81,25 @@ public EcoEnchantsPlugin() { vanillaEnchantsYml = new VanillaEnchantsYml(this); customEnchantsYml = new CustomEnchantsYml(this); - LibReforge.registerJavaHolderProvider(player -> new ArrayList<>(CustomEnchantLookup.provideLevels(player))); + this.registerJavaHolderProvider(player -> new ArrayList<>(CustomEnchantLookup.provideLevels(player))); } @Override - protected void handleEnable() { - LibReforge.enable(this); + public void handleEnableAdditional() { this.getLogger().info(EcoEnchants.values().size() + " Enchantments Loaded"); TelekinesisUtils.registerTest(player -> FastItemStack.wrap(player.getInventory().getItemInMainHand()).getLevelOnItem(EcoEnchants.TELEKINESIS, false) > 0); } @Override - protected void handleDisable() { - LibReforge.disable(this); + public void handleDisableAdditional() { for (World world : Bukkit.getServer().getWorlds()) { world.getPopulators().removeIf(blockPopulator -> blockPopulator instanceof LootPopulator); } } @Override - protected void handleReload() { - LibReforge.reload(this); + public void handleReloadAdditional() { this.getDisplayModule().update(); for (EcoEnchant enchant : EcoEnchants.values()) { HandlerList.unregisterAll(enchant); @@ -137,15 +132,12 @@ protected void handleAfterLoad() { } @Override - protected List loadIntegrationLoaders() { - List loaders = new ArrayList<>(Arrays.asList( + @NotNull + public List loadAdditionalIntegrations() { + return Arrays.asList( new IntegrationLoader("Essentials", () -> RegistrationManager.register(new IntegrationEssentials())), new IntegrationLoader("MythicMobs", () -> MythicMobsManager.register(new IntegrationMythicMobs())) - )); - - loaders.addAll(LibReforge.getIntegrationLoaders()); - - return loaders; + ); } @Override