Renamed EssentialsManager to RegistrationManager

This commit is contained in:
Auxilor 2021-08-18 17:23:44 +01:00
parent ba758312c0
commit f7d47fa624
5 changed files with 24 additions and 23 deletions

View File

@ -22,8 +22,8 @@ import com.willfp.ecoenchants.enchantments.support.obtaining.VillagerListeners;
import com.willfp.ecoenchants.enchantments.util.ItemConversions;
import com.willfp.ecoenchants.enchantments.util.TimedRunnable;
import com.willfp.ecoenchants.enchantments.util.WatcherTriggers;
import com.willfp.ecoenchants.integrations.essentials.EssentialsManager;
import com.willfp.ecoenchants.integrations.essentials.plugins.IntegrationEssentials;
import com.willfp.ecoenchants.integrations.registration.RegistrationManager;
import com.willfp.ecoenchants.integrations.registration.plugins.IntegrationEssentials;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.World;
@ -111,13 +111,14 @@ public class EcoEnchantsPlugin extends EcoPlugin {
world.getPopulators().add(new LootPopulator(this));
}
}
EssentialsManager.registerEnchantments();
RegistrationManager.registerEnchantments();
}
@Override
protected List<IntegrationLoader> loadIntegrationLoaders() {
return Arrays.asList(
new IntegrationLoader("Essentials", () -> EssentialsManager.register(new IntegrationEssentials()))
new IntegrationLoader("Essentials", () -> RegistrationManager.register(new IntegrationEssentials())),
new IntegrationLoader("ShopGUIPlus", () -> RegistrationManager.register(new IntegrationShopGUIPlus()))
);
}

View File

@ -1,11 +0,0 @@
package com.willfp.ecoenchants.integrations.essentials;
import com.willfp.eco.core.integrations.Integration;
public interface EssentialsWrapper extends Integration {
/**
* @see EssentialsManager#registerEnchantments();
*/
void registerAllEnchantments();
}

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.integrations.essentials;
package com.willfp.ecoenchants.integrations.registration;
import lombok.experimental.UtilityClass;
import org.jetbrains.annotations.NotNull;
@ -7,18 +7,18 @@ import java.util.HashSet;
import java.util.Set;
@UtilityClass
public class EssentialsManager {
public class RegistrationManager {
/**
* All registered essentials integrations.
*/
private static final Set<EssentialsWrapper> REGISTERED = new HashSet<>();
private static final Set<RegistrationWrapper> REGISTERED = new HashSet<>();
/**
* Register a new essentials integration.
*
* @param essentials The integration to register.
*/
public static void register(@NotNull final EssentialsWrapper essentials) {
public static void register(@NotNull final RegistrationWrapper essentials) {
REGISTERED.add(essentials);
}
@ -26,6 +26,6 @@ public class EssentialsManager {
* Register all {@link com.willfp.ecoenchants.enchantments.EcoEnchant}s with Essentials.
*/
public static void registerEnchantments() {
REGISTERED.forEach(EssentialsWrapper::registerAllEnchantments);
REGISTERED.forEach(RegistrationWrapper::registerAllEnchantments);
}
}

View File

@ -0,0 +1,11 @@
package com.willfp.ecoenchants.integrations.registration;
import com.willfp.eco.core.integrations.Integration;
public interface RegistrationWrapper extends Integration {
/**
* @see RegistrationManager#registerEnchantments();
*/
void registerAllEnchantments();
}

View File

@ -1,16 +1,16 @@
package com.willfp.ecoenchants.integrations.essentials.plugins;
package com.willfp.ecoenchants.integrations.registration.plugins;
import com.earth2me.essentials.Enchantments;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.integrations.essentials.EssentialsWrapper;
import com.willfp.ecoenchants.integrations.registration.RegistrationWrapper;
import org.apache.commons.lang.reflect.FieldUtils;
import org.bukkit.enchantments.Enchantment;
import java.util.Map;
@SuppressWarnings("unchecked")
public class IntegrationEssentials implements EssentialsWrapper {
public class IntegrationEssentials implements RegistrationWrapper {
@Override
public void registerAllEnchantments() {
try {