Cleaning up after Handler

This commit is contained in:
Auxilor
2022-10-02 02:08:22 +01:00
parent 2b2406a4d0
commit 13b3e1e440
7 changed files with 60 additions and 92 deletions

View File

@@ -25,7 +25,6 @@ import com.willfp.eco.core.integrations.placeholder.PlaceholderIntegration;
import com.willfp.eco.core.items.TestableItem;
import com.willfp.eco.core.placeholder.AdditionalPlayer;
import com.willfp.eco.core.placeholder.PlaceholderInjectable;
import com.willfp.eco.core.proxy.Cleaner;
import com.willfp.eco.core.proxy.ProxyFactory;
import com.willfp.eco.core.scheduling.Scheduler;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
@@ -269,12 +268,11 @@ public interface Eco {
@NotNull Menu additional);
/**
* Get cleaner.
* Clean up ClassLoader (etc.) to allow PlugMan support.
*
* @return The cleaner.
* @param plugin The plugin to clean up.
*/
@NotNull
Cleaner getCleaner();
void clean(@NotNull EcoPlugin plugin);
/**
* Add new plugin.

View File

@@ -81,12 +81,12 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
private final Set<String> loadedIntegrations = new HashSet<>();
/**
* The internal plugin scheduler.
* The plugin scheduler.
*/
private final Scheduler scheduler;
/**
* The internal plugin Event Manager.
* The plugin Event Manager.
*/
private final EventManager eventManager;
@@ -101,17 +101,17 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
private final LangYml langYml;
/**
* The internal factory to produce {@link org.bukkit.NamespacedKey}s.
* The factory to produce {@link org.bukkit.NamespacedKey}s.
*/
private final NamespacedKeyFactory namespacedKeyFactory;
/**
* The internal factory to produce {@link org.bukkit.metadata.FixedMetadataValue}s.
* The factory to produce {@link org.bukkit.metadata.FixedMetadataValue}s.
*/
private final MetadataValueFactory metadataValueFactory;
/**
* The internal factory to produce {@link com.willfp.eco.core.scheduling.RunnableTask}s.
* The factory to produce {@link com.willfp.eco.core.scheduling.RunnableTask}s.
*/
private final RunnableFactory runnableFactory;
@@ -283,11 +283,11 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
if (Eco.get() == null && this instanceof Eco) {
/*
This code is only ever called by EcoSpigotPlugin (EcoHandler)
as it's the first plugin to load, and it is a handler.
This code is only ever called by EcoSpigotPlugin (EcoImpl)
as it's the first plugin to load, and it's an instance of eco.
Any other plugins will never call this code as the handler
will have already been initialized.
Any other plugins will never call this code as eco will have already
been initialized.
*/
Eco.Instance.set((Eco) this);
@@ -435,7 +435,7 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
}
this.getLogger().info("Cleaning up...");
Eco.get().getCleaner().clean(this);
Eco.get().clean(this);
}
/**

View File

@@ -3,7 +3,7 @@ package com.willfp.eco.core.extensions;
import java.util.Set;
/**
* Internal component to manage loading and unloading extensions.
* Manages the loading and unloading of extensions for a particular plugin.
*/
public interface ExtensionLoader {
/**

View File

@@ -7,7 +7,10 @@ import org.jetbrains.annotations.NotNull;
* A cleaner is an internal component to fix classloader errors.
* <p>
* Important to allow for PlugMan/ServerUtils support.
*
* @deprecated No reason for this to be in the API.
*/
@Deprecated(since = "6.43.0", forRemoval = true)
public interface Cleaner {
/**
* Clean up classes left over from plugin.