Skip to content

Commit

Permalink
Updated libreforge to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 12, 2022
1 parent b17b3ec commit 9762fe8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ allprojects {

shadowJar {
relocate('com.willfp.libreforge', 'com.willfp.ecoenchants.libreforge')
relocate('redempt.crunch', 'com.willfp.ecoenchants.libreforge.crunch')
}

compileJava {
Expand All @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -44,7 +43,7 @@
import java.util.Objects;

@SuppressWarnings("unused")
public class EcoEnchantsPlugin extends EcoPlugin {
public class EcoEnchantsPlugin extends LibReforgePlugin {
/**
* Instance of the plugin.
*/
Expand Down Expand Up @@ -74,37 +73,33 @@ 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);
targetYml = new TargetYml(this);
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);
Expand Down Expand Up @@ -137,15 +132,12 @@ protected void handleAfterLoad() {
}

@Override
protected List<IntegrationLoader> loadIntegrationLoaders() {
List<IntegrationLoader> loaders = new ArrayList<>(Arrays.asList(
@NotNull
public List<IntegrationLoader> 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
Expand Down

0 comments on commit 9762fe8

Please sign in to comment.