Continued refactor
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.internal.arrows;
|
package com.willfp.eco.internal.arrows;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
@@ -20,10 +20,10 @@ public class ArrowDataListener extends PluginDependent implements Listener {
|
|||||||
/**
|
/**
|
||||||
* Listener to add metadata to arrows about the enchantments on the bow that shot them.
|
* Listener to add metadata to arrows about the enchantments on the bow that shot them.
|
||||||
*
|
*
|
||||||
* @param plugin The {@link AbstractEcoPlugin} that registered the listener.
|
* @param plugin The {@link EcoPlugin} that registered the listener.
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public ArrowDataListener(@NotNull final AbstractEcoPlugin plugin) {
|
public ArrowDataListener(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.willfp.eco.internal.bukkit.events;
|
|||||||
|
|
||||||
import com.willfp.eco.util.bukkit.events.EventManager;
|
import com.willfp.eco.util.bukkit.events.EventManager;
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -13,10 +13,10 @@ public class EcoEventManager extends PluginDependent implements EventManager {
|
|||||||
/**
|
/**
|
||||||
* Manager class for event management.
|
* Manager class for event management.
|
||||||
*
|
*
|
||||||
* @param plugin The {@link AbstractEcoPlugin} that this manages the events of.
|
* @param plugin The {@link EcoPlugin} that this manages the events of.
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public EcoEventManager(@NotNull final AbstractEcoPlugin plugin) {
|
public EcoEventManager(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
package com.willfp.eco.internal.bukkit.logging;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.StringUtils;
|
|
||||||
import com.willfp.eco.util.bukkit.logging.Logger;
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class EcoLogger extends PluginDependent implements Logger {
|
|
||||||
/**
|
|
||||||
* Implementation of {@link Logger}.
|
|
||||||
* Manages logging for an {@link AbstractEcoPlugin}.
|
|
||||||
*
|
|
||||||
* @param plugin The {@link AbstractEcoPlugin} for the logger to manage.
|
|
||||||
*/
|
|
||||||
public EcoLogger(@NotNull final AbstractEcoPlugin plugin) {
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log an informative/neutral message to console.
|
|
||||||
*
|
|
||||||
* @param message The message to log.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void info(@NotNull final String message) {
|
|
||||||
this.getPlugin().getLogger().info(StringUtils.translate(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log a warning to console.
|
|
||||||
*
|
|
||||||
* @param message The message to log.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void warn(@NotNull final String message) {
|
|
||||||
this.getPlugin().getLogger().warning(StringUtils.translate(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log an error to console.
|
|
||||||
*
|
|
||||||
* @param message The message to log.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void error(@NotNull final String message) {
|
|
||||||
this.getPlugin().getLogger().severe(StringUtils.translate(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@ package com.willfp.eco.internal.bukkit.scheduling;
|
|||||||
|
|
||||||
import com.willfp.eco.util.bukkit.scheduling.Scheduler;
|
import com.willfp.eco.util.bukkit.scheduling.Scheduler;
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
@@ -10,12 +10,12 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public class EcoScheduler extends PluginDependent implements Scheduler {
|
public class EcoScheduler extends PluginDependent implements Scheduler {
|
||||||
/**
|
/**
|
||||||
* Create a scheduler to manage the tasks of an {@link AbstractEcoPlugin}.
|
* Create a scheduler to manage the tasks of an {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin to manage.
|
* @param plugin The plugin to manage.
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public EcoScheduler(@NotNull final AbstractEcoPlugin plugin) {
|
public EcoScheduler(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ public class EcoScheduler extends PluginDependent implements Scheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel all running tasks from the linked {@link AbstractEcoPlugin}.
|
* Cancel all running tasks from the linked {@link EcoPlugin}.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cancelAll() {
|
public void cancelAll() {
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ package com.willfp.eco.internal.config;
|
|||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ConfigSection extends AbstractUndefinedConfig<ConfigurationSection> {
|
public class ConfigSection extends ConfigWrapper<ConfigurationSection> {
|
||||||
/**
|
/**
|
||||||
* Config section.
|
* Config section.
|
||||||
*
|
*
|
||||||
* @param section The section.
|
* @param section The section.
|
||||||
*/
|
*/
|
||||||
protected ConfigSection(@NotNull final ConfigurationSection section) {
|
protected ConfigSection(@NotNull final ConfigurationSection section) {
|
||||||
super("subsection");
|
|
||||||
this.init(section);
|
this.init(section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.willfp.eco.util.SerializationUtils;
|
|||||||
import com.willfp.eco.util.StringUtils;
|
import com.willfp.eco.util.StringUtils;
|
||||||
import com.willfp.eco.util.config.Config;
|
import com.willfp.eco.util.config.Config;
|
||||||
import com.willfp.eco.util.serialization.EcoSerializable;
|
import com.willfp.eco.util.serialization.EcoSerializable;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.MemorySection;
|
import org.bukkit.configuration.MemorySection;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -16,11 +18,12 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked", "unused", "DeprecatedIsStillUsed"})
|
@SuppressWarnings({"unchecked", "unused", "DeprecatedIsStillUsed"})
|
||||||
public abstract class AbstractUndefinedConfig<T extends ConfigurationSection> implements Config {
|
public abstract class ConfigWrapper<T extends ConfigurationSection> implements Config {
|
||||||
/**
|
/**
|
||||||
* The linked {@link MemorySection} where values are physically stored.
|
* The linked {@link MemorySection} where values are physically stored.
|
||||||
*/
|
*/
|
||||||
protected T config = null;
|
@Getter(AccessLevel.PROTECTED)
|
||||||
|
private T config = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached values for faster reading.
|
* Cached values for faster reading.
|
||||||
@@ -29,10 +32,8 @@ public abstract class AbstractUndefinedConfig<T extends ConfigurationSection> im
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract config.
|
* Abstract config.
|
||||||
*
|
|
||||||
* @param configName The name of the config
|
|
||||||
*/
|
*/
|
||||||
protected AbstractUndefinedConfig(@NotNull final String configName) {
|
protected ConfigWrapper() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.willfp.eco.internal.config;
|
package com.willfp.eco.internal.config;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -16,7 +17,7 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public abstract class AbstractConfig extends AbstractUndefinedConfig<YamlConfiguration> {
|
public abstract class LoadableYamlConfig extends ConfigWrapper<YamlConfiguration> {
|
||||||
/**
|
/**
|
||||||
* The physical config file, as stored on disk.
|
* The physical config file, as stored on disk.
|
||||||
*/
|
*/
|
||||||
@@ -27,7 +28,7 @@ public abstract class AbstractConfig extends AbstractUndefinedConfig<YamlConfigu
|
|||||||
* Plugin handle.
|
* Plugin handle.
|
||||||
*/
|
*/
|
||||||
@Getter(AccessLevel.PROTECTED)
|
@Getter(AccessLevel.PROTECTED)
|
||||||
private final AbstractEcoPlugin plugin;
|
private final EcoPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The full name of the config file (eg config.yml).
|
* The full name of the config file (eg config.yml).
|
||||||
@@ -55,11 +56,10 @@ public abstract class AbstractConfig extends AbstractUndefinedConfig<YamlConfigu
|
|||||||
* @param subDirectoryPath The subdirectory path.
|
* @param subDirectoryPath The subdirectory path.
|
||||||
* @param source The class that owns the resource.
|
* @param source The class that owns the resource.
|
||||||
*/
|
*/
|
||||||
protected AbstractConfig(@NotNull final String configName,
|
protected LoadableYamlConfig(@NotNull final String configName,
|
||||||
@NotNull final AbstractEcoPlugin plugin,
|
@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final String subDirectoryPath,
|
@NotNull final String subDirectoryPath,
|
||||||
@NotNull final Class<?> source) {
|
@NotNull final Class<?> source) {
|
||||||
super(configName);
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.name = configName + ".yml";
|
this.name = configName + ".yml";
|
||||||
this.source = source;
|
this.source = source;
|
||||||
@@ -151,8 +151,8 @@ public abstract class AbstractConfig extends AbstractUndefinedConfig<YamlConfigu
|
|||||||
*
|
*
|
||||||
* @return The config.
|
* @return The config.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@ApiStatus.Internal
|
||||||
public YamlConfiguration getConfig() {
|
public YamlConfiguration getConfig() {
|
||||||
return (YamlConfiguration) super.config;
|
return super.getConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.willfp.eco.internal.config;
|
package com.willfp.eco.internal.config;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -10,7 +10,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class AbstractUpdatableConfig extends AbstractConfig {
|
public abstract class UpdatableYamlConfig extends LoadableYamlConfig {
|
||||||
/**
|
/**
|
||||||
* Whether keys not in the base config should be removed on update.
|
* Whether keys not in the base config should be removed on update.
|
||||||
*/
|
*/
|
||||||
@@ -31,12 +31,12 @@ public abstract class AbstractUpdatableConfig extends AbstractConfig {
|
|||||||
* @param removeUnused Whether keys not present in the default config should be removed on update.
|
* @param removeUnused Whether keys not present in the default config should be removed on update.
|
||||||
* @param updateBlacklist Substring of keys to not add/remove keys for.
|
* @param updateBlacklist Substring of keys to not add/remove keys for.
|
||||||
*/
|
*/
|
||||||
protected AbstractUpdatableConfig(@NotNull final String configName,
|
protected UpdatableYamlConfig(@NotNull final String configName,
|
||||||
@NotNull final AbstractEcoPlugin plugin,
|
@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final String subDirectoryPath,
|
@NotNull final String subDirectoryPath,
|
||||||
@NotNull final Class<?> source,
|
@NotNull final Class<?> source,
|
||||||
final boolean removeUnused,
|
final boolean removeUnused,
|
||||||
@NotNull final String... updateBlacklist) {
|
@NotNull final String... updateBlacklist) {
|
||||||
super(configName, plugin, subDirectoryPath, source);
|
super(configName, plugin, subDirectoryPath, source);
|
||||||
this.removeUnused = removeUnused;
|
this.removeUnused = removeUnused;
|
||||||
this.updateBlacklist = new ArrayList<>(Arrays.asList(updateBlacklist));
|
this.updateBlacklist = new ArrayList<>(Arrays.asList(updateBlacklist));
|
||||||
@@ -53,33 +53,33 @@ public abstract class AbstractUpdatableConfig extends AbstractConfig {
|
|||||||
public void update() {
|
public void update() {
|
||||||
super.clearCache();
|
super.clearCache();
|
||||||
try {
|
try {
|
||||||
config.load(this.getConfigFile());
|
this.getConfig().load(this.getConfigFile());
|
||||||
|
|
||||||
YamlConfiguration newConfig = this.getConfigInJar();
|
YamlConfiguration newConfig = this.getConfigInJar();
|
||||||
|
|
||||||
if (newConfig.getKeys(true).equals(config.getKeys(true))) {
|
if (newConfig.getKeys(true).equals(this.getConfig().getKeys(true))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newConfig.getKeys(true).forEach((s -> {
|
newConfig.getKeys(true).forEach((s -> {
|
||||||
if (!config.getKeys(true).contains(s)) {
|
if (!this.getConfig().getKeys(true).contains(s)) {
|
||||||
if (updateBlacklist.stream().noneMatch(s::contains)) {
|
if (updateBlacklist.stream().noneMatch(s::contains)) {
|
||||||
config.set(s, newConfig.get(s));
|
this.getConfig().set(s, newConfig.get(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (this.removeUnused) {
|
if (this.removeUnused) {
|
||||||
config.getKeys(true).forEach((s -> {
|
this.getConfig().getKeys(true).forEach((s -> {
|
||||||
if (!newConfig.getKeys(true).contains(s)) {
|
if (!newConfig.getKeys(true).contains(s)) {
|
||||||
if (updateBlacklist.stream().noneMatch(s::contains)) {
|
if (updateBlacklist.stream().noneMatch(s::contains)) {
|
||||||
config.set(s, null);
|
this.getConfig().set(s, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
config.save(this.getConfigFile());
|
this.getConfig().save(this.getConfigFile());
|
||||||
} catch (IOException | InvalidConfigurationException e) {
|
} catch (IOException | InvalidConfigurationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import com.willfp.eco.util.extensions.Extension;
|
|||||||
import com.willfp.eco.util.extensions.MalformedExtensionException;
|
import com.willfp.eco.util.extensions.MalformedExtensionException;
|
||||||
import com.willfp.eco.util.extensions.ExtensionLoader;
|
import com.willfp.eco.util.extensions.ExtensionLoader;
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -31,11 +31,11 @@ public class EcoExtensionLoader extends PluginDependent implements ExtensionLoad
|
|||||||
private final Set<Extension> extensions = new HashSet<>();
|
private final Set<Extension> extensions = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new extension loader and link it to a specific {@link AbstractEcoPlugin}.
|
* Create a new extension loader and link it to a specific {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin to manage
|
* @param plugin The plugin to manage
|
||||||
*/
|
*/
|
||||||
public EcoExtensionLoader(@NotNull final AbstractEcoPlugin plugin) {
|
public EcoExtensionLoader(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public class EcoExtensionLoader extends PluginDependent implements ExtensionLoad
|
|||||||
try {
|
try {
|
||||||
loadExtension(extensionJar);
|
loadExtension(extensionJar);
|
||||||
} catch (MalformedExtensionException e) {
|
} catch (MalformedExtensionException e) {
|
||||||
this.getPlugin().getLog().error(extensionJar.getName() + " caused MalformedExtensionException: " + e.getMessage());
|
this.getPlugin().getLogger().severe(extensionJar.getName() + " caused MalformedExtensionException: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ public class EcoExtensionLoader extends PluginDependent implements ExtensionLoad
|
|||||||
Object object = null;
|
Object object = null;
|
||||||
try {
|
try {
|
||||||
cls = cl.loadClass(mainClass);
|
cls = cl.loadClass(mainClass);
|
||||||
object = cls.getConstructor(AbstractEcoPlugin.class).newInstance(this.getPlugin());
|
object = cls.getConstructor(EcoPlugin.class).newInstance(this.getPlugin());
|
||||||
} catch (ReflectiveOperationException e) {
|
} catch (ReflectiveOperationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
package com.willfp.eco.util.bukkit.keys;
|
package com.willfp.eco.util.bukkit.keys;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class NamespacedKeyFactory extends PluginDependent {
|
public class NamespacedKeyFactory extends PluginDependent {
|
||||||
/**
|
/**
|
||||||
* Factory class to produce {@link NamespacedKey}s associated with an {@link AbstractEcoPlugin}.
|
* Factory class to produce {@link NamespacedKey}s associated with an {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin that this factory creates keys for.
|
* @param plugin The plugin that this factory creates keys for.
|
||||||
*/
|
*/
|
||||||
public NamespacedKeyFactory(@NotNull final AbstractEcoPlugin plugin) {
|
public NamespacedKeyFactory(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an {@link NamespacedKey} associated with an {@link AbstractEcoPlugin}.
|
* Create an {@link NamespacedKey} associated with an {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param key The key in the {@link NamespacedKey}.
|
* @param key The key in the {@link NamespacedKey}.
|
||||||
* @return The created {@link NamespacedKey}.
|
* @return The created {@link NamespacedKey}.
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.willfp.eco.util.bukkit.logging;
|
|
||||||
|
|
||||||
public interface Logger {
|
|
||||||
/**
|
|
||||||
* Log an informative/neutral message to console.
|
|
||||||
*
|
|
||||||
* @param message The message to log.
|
|
||||||
*/
|
|
||||||
void info(String message);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log a warning to console.
|
|
||||||
*
|
|
||||||
* @param message The message to log.
|
|
||||||
*/
|
|
||||||
void warn(String message);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log an error to console.
|
|
||||||
*
|
|
||||||
* @param message The message to log.
|
|
||||||
*/
|
|
||||||
void error(String message);
|
|
||||||
}
|
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
package com.willfp.eco.util.bukkit.meta;
|
package com.willfp.eco.util.bukkit.meta;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MetadataValueFactory extends PluginDependent {
|
public class MetadataValueFactory extends PluginDependent {
|
||||||
/**
|
/**
|
||||||
* Factory class to produce {@link FixedMetadataValue}s associated with an {@link AbstractEcoPlugin}.
|
* Factory class to produce {@link FixedMetadataValue}s associated with an {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin that this factory creates values for.
|
* @param plugin The plugin that this factory creates values for.
|
||||||
*/
|
*/
|
||||||
public MetadataValueFactory(@NotNull final AbstractEcoPlugin plugin) {
|
public MetadataValueFactory(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an {@link FixedMetadataValue} associated with an {@link AbstractEcoPlugin} with a specified value.
|
* Create an {@link FixedMetadataValue} associated with an {@link EcoPlugin} with a specified value.
|
||||||
*
|
*
|
||||||
* @param value The value of meta key.
|
* @param value The value of meta key.
|
||||||
* @return The created {@link FixedMetadataValue}.
|
* @return The created {@link FixedMetadataValue}.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.willfp.eco.util.bukkit.scheduling;
|
package com.willfp.eco.util.bukkit.scheduling;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
@@ -8,28 +8,28 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public abstract class EcoBukkitRunnable extends BukkitRunnable {
|
public abstract class EcoBukkitRunnable extends BukkitRunnable {
|
||||||
/**
|
/**
|
||||||
* The linked {@link AbstractEcoPlugin} to associate runnables with.
|
* The linked {@link EcoPlugin} to associate runnables with.
|
||||||
*/
|
*/
|
||||||
private final AbstractEcoPlugin plugin;
|
private final EcoPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link EcoBukkitRunnable}.
|
* Creates a new {@link EcoBukkitRunnable}.
|
||||||
* <p>
|
* <p>
|
||||||
* Cannot be instantiated normally, use {@link RunnableFactory}.
|
* Cannot be instantiated normally, use {@link RunnableFactory}.
|
||||||
*
|
*
|
||||||
* @param plugin The {@link AbstractEcoPlugin} to associate runnables with.
|
* @param plugin The {@link EcoPlugin} to associate runnables with.
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
EcoBukkitRunnable(@NotNull final AbstractEcoPlugin plugin) {
|
EcoBukkitRunnable(@NotNull final EcoPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link AbstractEcoPlugin} that created this runnable.
|
* Get the {@link EcoPlugin} that created this runnable.
|
||||||
*
|
*
|
||||||
* @return The linked plugin.
|
* @return The linked plugin.
|
||||||
*/
|
*/
|
||||||
protected final AbstractEcoPlugin getPlugin() {
|
protected final EcoPlugin getPlugin() {
|
||||||
return this.plugin;
|
return this.plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
package com.willfp.eco.util.bukkit.scheduling;
|
package com.willfp.eco.util.bukkit.scheduling;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class RunnableFactory extends PluginDependent {
|
public class RunnableFactory extends PluginDependent {
|
||||||
/**
|
/**
|
||||||
* Factory class to produce {@link EcoBukkitRunnable}s associated with an {@link AbstractEcoPlugin}.
|
* Factory class to produce {@link EcoBukkitRunnable}s associated with an {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin that this factory creates runnables for.
|
* @param plugin The plugin that this factory creates runnables for.
|
||||||
*/
|
*/
|
||||||
public RunnableFactory(@NotNull final AbstractEcoPlugin plugin) {
|
public RunnableFactory(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.willfp.eco.util.bukkit.scheduling;
|
package com.willfp.eco.util.bukkit.scheduling;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ public interface Scheduler {
|
|||||||
long repeat);
|
long repeat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel all running tasks from the linked {@link AbstractEcoPlugin}.
|
* Cancel all running tasks from the linked {@link EcoPlugin}.
|
||||||
*/
|
*/
|
||||||
void cancelAll();
|
void cancelAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.util.command;
|
package com.willfp.eco.util.command;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@@ -43,12 +43,12 @@ public abstract class AbstractCommand extends PluginDependent implements Command
|
|||||||
* <p>
|
* <p>
|
||||||
* The name cannot be the same as an existing command as this will conflict.
|
* The name cannot be the same as an existing command as this will conflict.
|
||||||
*
|
*
|
||||||
* @param plugin The owning {@link AbstractEcoPlugin}.
|
* @param plugin The owning {@link EcoPlugin}.
|
||||||
* @param name The name used in execution.
|
* @param name The name used in execution.
|
||||||
* @param permission The permission required to execute the command.
|
* @param permission The permission required to execute the command.
|
||||||
* @param playersOnly If only players should be able to execute this command.
|
* @param playersOnly If only players should be able to execute this command.
|
||||||
*/
|
*/
|
||||||
protected AbstractCommand(@NotNull final AbstractEcoPlugin plugin,
|
protected AbstractCommand(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final String name,
|
@NotNull final String name,
|
||||||
@NotNull final String permission,
|
@NotNull final String permission,
|
||||||
final boolean playersOnly) {
|
final boolean playersOnly) {
|
||||||
@@ -98,7 +98,7 @@ public abstract class AbstractCommand extends PluginDependent implements Command
|
|||||||
* @param command The bukkit command.
|
* @param command The bukkit command.
|
||||||
* @param label The name of the executed command.
|
* @param label The name of the executed command.
|
||||||
* @param args The arguments of the command (anything after the physical command name)
|
* @param args The arguments of the command (anything after the physical command name)
|
||||||
* @return If the command was processed by the linked {@link AbstractEcoPlugin}
|
* @return If the command was processed by the linked {@link EcoPlugin}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final boolean onCommand(@NotNull final CommandSender sender,
|
public final boolean onCommand(@NotNull final CommandSender sender,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.willfp.eco.util.config;
|
package com.willfp.eco.util.config;
|
||||||
|
|
||||||
import com.willfp.eco.internal.config.AbstractUpdatableConfig;
|
import com.willfp.eco.internal.config.UpdatableYamlConfig;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class BaseConfig extends AbstractUpdatableConfig {
|
public abstract class BaseConfig extends UpdatableYamlConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config implementation for configs present in the plugin's base directory (eg config.yml, lang.yml).
|
* Config implementation for configs present in the plugin's base directory (eg config.yml, lang.yml).
|
||||||
@@ -18,7 +18,7 @@ public abstract class BaseConfig extends AbstractUpdatableConfig {
|
|||||||
*/
|
*/
|
||||||
protected BaseConfig(@NotNull final String configName,
|
protected BaseConfig(@NotNull final String configName,
|
||||||
final boolean removeUnused,
|
final boolean removeUnused,
|
||||||
@NotNull final AbstractEcoPlugin plugin,
|
@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final String... updateBlacklist) {
|
@NotNull final String... updateBlacklist) {
|
||||||
super(configName, plugin, "", plugin.getClass(), removeUnused, updateBlacklist);
|
super(configName, plugin, "", plugin.getClass(), removeUnused, updateBlacklist);
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ public abstract class BaseConfig extends AbstractUpdatableConfig {
|
|||||||
*/
|
*/
|
||||||
protected BaseConfig(@NotNull final String configName,
|
protected BaseConfig(@NotNull final String configName,
|
||||||
final boolean removeUnused,
|
final boolean removeUnused,
|
||||||
@NotNull final AbstractEcoPlugin plugin) {
|
@NotNull final EcoPlugin plugin) {
|
||||||
super(configName, plugin, "", plugin.getClass(), removeUnused, "");
|
super(configName, plugin, "", plugin.getClass(), removeUnused, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.willfp.eco.util.config;
|
package com.willfp.eco.util.config;
|
||||||
|
|
||||||
import com.willfp.eco.internal.config.AbstractUpdatableConfig;
|
import com.willfp.eco.internal.config.UpdatableYamlConfig;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class ExtendableConfig extends AbstractUpdatableConfig {
|
public abstract class ExtendableConfig extends UpdatableYamlConfig {
|
||||||
/**
|
/**
|
||||||
* Config implementation for configs present in the plugin's base directory (eg config.yml, lang.yml).
|
* Config implementation for configs present in the plugin's base directory (eg config.yml, lang.yml).
|
||||||
* <p>
|
* <p>
|
||||||
@@ -19,7 +19,7 @@ public abstract class ExtendableConfig extends AbstractUpdatableConfig {
|
|||||||
*/
|
*/
|
||||||
protected ExtendableConfig(@NotNull final String configName,
|
protected ExtendableConfig(@NotNull final String configName,
|
||||||
final boolean removeUnused,
|
final boolean removeUnused,
|
||||||
@NotNull final AbstractEcoPlugin plugin,
|
@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final Class<?> source,
|
@NotNull final Class<?> source,
|
||||||
@NotNull final String subDirectoryPath,
|
@NotNull final String subDirectoryPath,
|
||||||
@NotNull final String... updateBlacklist) {
|
@NotNull final String... updateBlacklist) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.willfp.eco.util.config;
|
package com.willfp.eco.util.config;
|
||||||
|
|
||||||
import com.willfp.eco.internal.config.AbstractConfig;
|
import com.willfp.eco.internal.config.LoadableYamlConfig;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class StaticBaseConfig extends AbstractConfig {
|
public abstract class StaticBaseConfig extends LoadableYamlConfig {
|
||||||
/**
|
/**
|
||||||
* Config implementation for configs present in the plugin's base directory (eg config.yml, lang.yml).
|
* Config implementation for configs present in the plugin's base directory (eg config.yml, lang.yml).
|
||||||
* <p>
|
* <p>
|
||||||
@@ -14,7 +14,7 @@ public abstract class StaticBaseConfig extends AbstractConfig {
|
|||||||
* @param plugin The plugin.
|
* @param plugin The plugin.
|
||||||
*/
|
*/
|
||||||
protected StaticBaseConfig(@NotNull final String configName,
|
protected StaticBaseConfig(@NotNull final String configName,
|
||||||
@NotNull final AbstractEcoPlugin plugin) {
|
@NotNull final EcoPlugin plugin) {
|
||||||
super(configName, plugin, "", plugin.getClass());
|
super(configName, plugin, "", plugin.getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.willfp.eco.util.config;
|
|
||||||
|
|
||||||
import com.willfp.eco.internal.config.AbstractUndefinedConfig;
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public abstract class StaticOptionalConfig extends AbstractUndefinedConfig<YamlConfiguration> {
|
|
||||||
/**
|
|
||||||
* Config implementation for passing YamlConfigurations.
|
|
||||||
* <p>
|
|
||||||
* Does not automatically update.
|
|
||||||
*
|
|
||||||
* @param configName The name of the config
|
|
||||||
* @param plugin The plugin.
|
|
||||||
* @param config The YamlConfiguration handle.
|
|
||||||
* @deprecated Plugin not required.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public StaticOptionalConfig(@NotNull final String configName,
|
|
||||||
@NotNull final AbstractEcoPlugin plugin,
|
|
||||||
@NotNull final YamlConfiguration config) {
|
|
||||||
this(configName, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Config implementation for passing YamlConfigurations.
|
|
||||||
* <p>
|
|
||||||
* Does not automatically update.
|
|
||||||
*
|
|
||||||
* @param configName The name of the config
|
|
||||||
* @param config The YamlConfiguration handle.
|
|
||||||
*/
|
|
||||||
public StaticOptionalConfig(@NotNull final String configName,
|
|
||||||
@NotNull final YamlConfiguration config) {
|
|
||||||
super(configName);
|
|
||||||
|
|
||||||
init(config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.willfp.eco.util.config;
|
||||||
|
|
||||||
|
import com.willfp.eco.internal.config.ConfigWrapper;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public abstract class YamlConfig extends ConfigWrapper<YamlConfiguration> {
|
||||||
|
/**
|
||||||
|
* Config implementation for passing YamlConfigurations.
|
||||||
|
* <p>
|
||||||
|
* Does not automatically update.
|
||||||
|
*
|
||||||
|
* @param config The YamlConfiguration handle.
|
||||||
|
*/
|
||||||
|
public YamlConfig(@NotNull final YamlConfiguration config) {
|
||||||
|
init(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.util.config.configs;
|
package com.willfp.eco.util.config.configs;
|
||||||
|
|
||||||
import com.willfp.eco.util.config.BaseConfig;
|
import com.willfp.eco.util.config.BaseConfig;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ public class Config extends BaseConfig {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin.
|
* @param plugin The plugin.
|
||||||
*/
|
*/
|
||||||
public Config(@NotNull final AbstractEcoPlugin plugin) {
|
public Config(@NotNull final EcoPlugin plugin) {
|
||||||
super("config", true, plugin);
|
super("config", true, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.util.config.configs;
|
package com.willfp.eco.util.config.configs;
|
||||||
|
|
||||||
import com.willfp.eco.util.config.BaseConfig;
|
import com.willfp.eco.util.config.BaseConfig;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Lang extends BaseConfig {
|
public class Lang extends BaseConfig {
|
||||||
@@ -10,7 +10,7 @@ public class Lang extends BaseConfig {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin.
|
* @param plugin The plugin.
|
||||||
*/
|
*/
|
||||||
public Lang(@NotNull final AbstractEcoPlugin plugin) {
|
public Lang(@NotNull final EcoPlugin plugin) {
|
||||||
super("lang", false, plugin);
|
super("lang", false, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
|
|||||||
import com.willfp.eco.util.config.updating.exceptions.InvalidUpdatableClassException;
|
import com.willfp.eco.util.config.updating.exceptions.InvalidUpdatableClassException;
|
||||||
import com.willfp.eco.util.config.updating.exceptions.InvalidUpdateMethodException;
|
import com.willfp.eco.util.config.updating.exceptions.InvalidUpdateMethodException;
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@@ -21,11 +21,11 @@ public class ConfigHandler extends PluginDependent {
|
|||||||
private final Set<Class<?>> updatableClasses = new HashSet<>();
|
private final Set<Class<?>> updatableClasses = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new config handler and links it to an {@link AbstractEcoPlugin}.
|
* Creates a new config handler and links it to an {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin to manage.
|
* @param plugin The plugin to manage.
|
||||||
*/
|
*/
|
||||||
public ConfigHandler(@NotNull final AbstractEcoPlugin plugin) {
|
public ConfigHandler(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.util.display;
|
package com.willfp.eco.util.display;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -19,7 +19,7 @@ public abstract class DisplayModule extends PluginDependent {
|
|||||||
* @param plugin The plugin that the display is for.
|
* @param plugin The plugin that the display is for.
|
||||||
* @param priority The priority of the module.
|
* @param priority The priority of the module.
|
||||||
*/
|
*/
|
||||||
protected DisplayModule(@NotNull final AbstractEcoPlugin plugin,
|
protected DisplayModule(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final DisplayPriority priority) {
|
@NotNull final DisplayPriority priority) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.util.extensions;
|
package com.willfp.eco.util.extensions;
|
||||||
|
|
||||||
import com.willfp.eco.internal.extensions.ExtensionMetadata;
|
import com.willfp.eco.internal.extensions.ExtensionMetadata;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
@@ -9,17 +9,17 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public abstract class Extension {
|
public abstract class Extension {
|
||||||
/**
|
/**
|
||||||
* The {@link AbstractEcoPlugin} that this extension is for.
|
* The {@link EcoPlugin} that this extension is for.
|
||||||
*/
|
*/
|
||||||
@Getter(AccessLevel.PROTECTED)
|
@Getter(AccessLevel.PROTECTED)
|
||||||
private final AbstractEcoPlugin plugin;
|
private final EcoPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new extension for a plugin.
|
* Create a new extension for a plugin.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin.
|
* @param plugin The plugin.
|
||||||
*/
|
*/
|
||||||
protected Extension(@NotNull final AbstractEcoPlugin plugin) {
|
protected Extension(@NotNull final EcoPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.willfp.eco.util.integrations.anticheat;
|
package com.willfp.eco.util.integrations.anticheat;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -22,7 +22,7 @@ public class AnticheatManager {
|
|||||||
* @param plugin The plugin.
|
* @param plugin The plugin.
|
||||||
* @param anticheat The anticheat to register.
|
* @param anticheat The anticheat to register.
|
||||||
*/
|
*/
|
||||||
public void register(@NotNull final AbstractEcoPlugin plugin,
|
public void register(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final AnticheatWrapper anticheat) {
|
@NotNull final AnticheatWrapper anticheat) {
|
||||||
if (anticheat instanceof Listener) {
|
if (anticheat instanceof Listener) {
|
||||||
plugin.getEventManager().registerListener((Listener) anticheat);
|
plugin.getEventManager().registerListener((Listener) anticheat);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.willfp.eco.util.integrations.placeholder.plugins;
|
|||||||
|
|
||||||
import com.willfp.eco.util.integrations.placeholder.PlaceholderIntegration;
|
import com.willfp.eco.util.integrations.placeholder.PlaceholderIntegration;
|
||||||
import com.willfp.eco.util.integrations.placeholder.PlaceholderManager;
|
import com.willfp.eco.util.integrations.placeholder.PlaceholderManager;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -13,14 +13,14 @@ public class PlaceholderIntegrationPAPI extends PlaceholderExpansion implements
|
|||||||
/**
|
/**
|
||||||
* The linked plugin.
|
* The linked plugin.
|
||||||
*/
|
*/
|
||||||
private final AbstractEcoPlugin plugin;
|
private final EcoPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PlaceholderAPI integration.
|
* Create a new PlaceholderAPI integration.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin to manage placeholders for.
|
* @param plugin The plugin to manage placeholders for.
|
||||||
*/
|
*/
|
||||||
public PlaceholderIntegrationPAPI(@NotNull final AbstractEcoPlugin plugin) {
|
public PlaceholderIntegrationPAPI(@NotNull final EcoPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
package com.willfp.eco.util.internal;
|
package com.willfp.eco.util.internal;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class PluginDependent {
|
public abstract class PluginDependent {
|
||||||
/**
|
/**
|
||||||
* The {@link AbstractEcoPlugin} that is stored.
|
* The {@link EcoPlugin} that is stored.
|
||||||
*/
|
*/
|
||||||
@Getter(AccessLevel.PROTECTED)
|
@Getter(AccessLevel.PROTECTED)
|
||||||
private final AbstractEcoPlugin plugin;
|
private final EcoPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass an {@link AbstractEcoPlugin} in order to interface with it.
|
* Pass an {@link EcoPlugin} in order to interface with it.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin to manage.
|
* @param plugin The plugin to manage.
|
||||||
*/
|
*/
|
||||||
protected PluginDependent(@NotNull final AbstractEcoPlugin plugin) {
|
protected PluginDependent(@NotNull final EcoPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ package com.willfp.eco.util.plugin;
|
|||||||
|
|
||||||
import com.willfp.eco.internal.arrows.ArrowDataListener;
|
import com.willfp.eco.internal.arrows.ArrowDataListener;
|
||||||
import com.willfp.eco.internal.bukkit.events.EcoEventManager;
|
import com.willfp.eco.internal.bukkit.events.EcoEventManager;
|
||||||
import com.willfp.eco.internal.bukkit.logging.EcoLogger;
|
|
||||||
import com.willfp.eco.internal.bukkit.scheduling.EcoScheduler;
|
import com.willfp.eco.internal.bukkit.scheduling.EcoScheduler;
|
||||||
import com.willfp.eco.internal.extensions.EcoExtensionLoader;
|
import com.willfp.eco.internal.extensions.EcoExtensionLoader;
|
||||||
import com.willfp.eco.util.bukkit.events.EventManager;
|
import com.willfp.eco.util.bukkit.events.EventManager;
|
||||||
import com.willfp.eco.util.bukkit.keys.NamespacedKeyFactory;
|
import com.willfp.eco.util.bukkit.keys.NamespacedKeyFactory;
|
||||||
import com.willfp.eco.util.bukkit.logging.Logger;
|
|
||||||
import com.willfp.eco.util.bukkit.meta.MetadataValueFactory;
|
import com.willfp.eco.util.bukkit.meta.MetadataValueFactory;
|
||||||
import com.willfp.eco.util.bukkit.scheduling.RunnableFactory;
|
import com.willfp.eco.util.bukkit.scheduling.RunnableFactory;
|
||||||
import com.willfp.eco.util.bukkit.scheduling.Scheduler;
|
import com.willfp.eco.util.bukkit.scheduling.Scheduler;
|
||||||
@@ -41,7 +39,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class AbstractEcoPlugin extends JavaPlugin {
|
public abstract class EcoPlugin extends JavaPlugin {
|
||||||
/**
|
/**
|
||||||
* Loaded eco plugins.
|
* Loaded eco plugins.
|
||||||
*/
|
*/
|
||||||
@@ -93,12 +91,6 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
private final List<Class<?>> updatableClasses = new ArrayList<>();
|
private final List<Class<?>> updatableClasses = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
|
||||||
* The internal plugin logger.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final Logger log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The internal plugin scheduler.
|
* The internal plugin scheduler.
|
||||||
*/
|
*/
|
||||||
@@ -176,18 +168,17 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
* @param proxyPackage The package where proxy implementations are stored.
|
* @param proxyPackage The package where proxy implementations are stored.
|
||||||
* @param color The color of the plugin (used in messages, such as &a, &b)
|
* @param color The color of the plugin (used in messages, such as &a, &b)
|
||||||
*/
|
*/
|
||||||
protected AbstractEcoPlugin(@NotNull final String pluginName,
|
protected EcoPlugin(@NotNull final String pluginName,
|
||||||
final int resourceId,
|
final int resourceId,
|
||||||
final int bStatsId,
|
final int bStatsId,
|
||||||
@NotNull final String proxyPackage,
|
@NotNull final String proxyPackage,
|
||||||
@NotNull final String color) {
|
@NotNull final String color) {
|
||||||
this.pluginName = pluginName;
|
this.pluginName = pluginName;
|
||||||
this.resourceId = resourceId;
|
this.resourceId = resourceId;
|
||||||
this.bStatsId = bStatsId;
|
this.bStatsId = bStatsId;
|
||||||
this.proxyPackage = proxyPackage;
|
this.proxyPackage = proxyPackage;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|
||||||
this.log = new EcoLogger(this);
|
|
||||||
this.scheduler = new EcoScheduler(this);
|
this.scheduler = new EcoScheduler(this);
|
||||||
this.eventManager = new EcoEventManager(this);
|
this.eventManager = new EcoEventManager(this);
|
||||||
this.namespacedKeyFactory = new NamespacedKeyFactory(this);
|
this.namespacedKeyFactory = new NamespacedKeyFactory(this);
|
||||||
@@ -209,8 +200,8 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
public final void onEnable() {
|
public final void onEnable() {
|
||||||
super.onLoad();
|
super.onLoad();
|
||||||
|
|
||||||
this.getLog().info("");
|
this.getLogger().info("");
|
||||||
this.getLog().info("Loading " + this.color + this.pluginName);
|
this.getLogger().info("Loading " + this.color + this.pluginName);
|
||||||
|
|
||||||
this.getEventManager().registerListener(new ArrowDataListener(this));
|
this.getEventManager().registerListener(new ArrowDataListener(this));
|
||||||
|
|
||||||
@@ -220,9 +211,9 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
if (!(currentVersion.compareTo(mostRecentVersion) > 0 || currentVersion.equals(mostRecentVersion))) {
|
if (!(currentVersion.compareTo(mostRecentVersion) > 0 || currentVersion.equals(mostRecentVersion))) {
|
||||||
this.outdated = true;
|
this.outdated = true;
|
||||||
this.getScheduler().runTimer(() -> {
|
this.getScheduler().runTimer(() -> {
|
||||||
this.getLog().info("&c " + this.pluginName + " is out of date! (Version " + this.getDescription().getVersion() + ")");
|
this.getLogger().info("&c " + this.pluginName + " is out of date! (Version " + this.getDescription().getVersion() + ")");
|
||||||
this.getLog().info("&cThe newest version is &f" + version);
|
this.getLogger().info("&cThe newest version is &f" + version);
|
||||||
this.getLog().info("&cDownload the new version!");
|
this.getLogger().info("&cDownload the new version!");
|
||||||
}, 0, 864000);
|
}, 0, 864000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -243,7 +234,7 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.getLog().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));
|
this.getLogger().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));
|
||||||
|
|
||||||
Prerequisite.update();
|
Prerequisite.update();
|
||||||
|
|
||||||
@@ -265,7 +256,7 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
this.enable();
|
this.enable();
|
||||||
|
|
||||||
this.getLog().info("");
|
this.getLogger().info("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -308,23 +299,23 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!Prerequisite.HAS_PAPER.isMet()) {
|
if (!Prerequisite.HAS_PAPER.isMet()) {
|
||||||
this.getLog().error("");
|
this.getLogger().severe("");
|
||||||
this.getLog().error("----------------------------");
|
this.getLogger().severe("----------------------------");
|
||||||
this.getLog().error("");
|
this.getLogger().severe("");
|
||||||
this.getLog().error("You don't seem to be running paper!");
|
this.getLogger().severe("You don't seem to be running paper!");
|
||||||
this.getLog().error("Paper is strongly recommended for all servers,");
|
this.getLogger().severe("Paper is strongly recommended for all servers,");
|
||||||
this.getLog().error("and some things may not function properly without it");
|
this.getLogger().severe("and some things may not function properly without it");
|
||||||
this.getLog().error("Download Paper from &fhttps://papermc.io");
|
this.getLogger().severe("Download Paper from &fhttps://papermc.io");
|
||||||
this.getLog().error("");
|
this.getLogger().severe("");
|
||||||
this.getLog().error("----------------------------");
|
this.getLogger().severe("----------------------------");
|
||||||
this.getLog().error("");
|
this.getLogger().severe("");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.postLoad();
|
this.postLoad();
|
||||||
|
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|
||||||
this.getLog().info("Loaded " + this.color + this.pluginName);
|
this.getLogger().info("Loaded " + this.color + this.pluginName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6,7 +6,7 @@ import com.comphenix.protocol.events.ListenerPriority;
|
|||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -35,7 +35,7 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
|
|||||||
* @param priority The priority at which the adapter should be ran on packet send/receive.
|
* @param priority The priority at which the adapter should be ran on packet send/receive.
|
||||||
* @param postLoad If the packet adapter should be registered after the server has loaded.
|
* @param postLoad If the packet adapter should be registered after the server has loaded.
|
||||||
*/
|
*/
|
||||||
protected AbstractPacketAdapter(@NotNull final AbstractEcoPlugin plugin,
|
protected AbstractPacketAdapter(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final PacketType type,
|
@NotNull final PacketType type,
|
||||||
@NotNull final ListenerPriority priority,
|
@NotNull final ListenerPriority priority,
|
||||||
final boolean postLoad) {
|
final boolean postLoad) {
|
||||||
@@ -51,7 +51,7 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
|
|||||||
* @param type The {@link PacketType} to listen for.
|
* @param type The {@link PacketType} to listen for.
|
||||||
* @param postLoad If the packet adapter should be registered after the server has loaded.
|
* @param postLoad If the packet adapter should be registered after the server has loaded.
|
||||||
*/
|
*/
|
||||||
protected AbstractPacketAdapter(@NotNull final AbstractEcoPlugin plugin,
|
protected AbstractPacketAdapter(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final PacketType type,
|
@NotNull final PacketType type,
|
||||||
final boolean postLoad) {
|
final boolean postLoad) {
|
||||||
this(plugin, type, ListenerPriority.NORMAL, postLoad);
|
this(plugin, type, ListenerPriority.NORMAL, postLoad);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.util.recipe.recipes;
|
package com.willfp.eco.util.recipe.recipes;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.recipe.Recipes;
|
import com.willfp.eco.util.recipe.Recipes;
|
||||||
import com.willfp.eco.util.recipe.parts.EmptyRecipePart;
|
import com.willfp.eco.util.recipe.parts.EmptyRecipePart;
|
||||||
import com.willfp.eco.util.recipe.parts.RecipePart;
|
import com.willfp.eco.util.recipe.parts.RecipePart;
|
||||||
@@ -38,7 +38,7 @@ public final class EcoShapedRecipe extends PluginDependent {
|
|||||||
@Getter
|
@Getter
|
||||||
private final ItemStack output;
|
private final ItemStack output;
|
||||||
|
|
||||||
private EcoShapedRecipe(@NotNull final AbstractEcoPlugin plugin,
|
private EcoShapedRecipe(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final String key,
|
@NotNull final String key,
|
||||||
@NotNull final RecipePart[] parts,
|
@NotNull final RecipePart[] parts,
|
||||||
@NotNull final ItemStack output) {
|
@NotNull final ItemStack output) {
|
||||||
@@ -110,7 +110,7 @@ public final class EcoShapedRecipe extends PluginDependent {
|
|||||||
* @param key The recipe key.
|
* @param key The recipe key.
|
||||||
* @return A new builder.
|
* @return A new builder.
|
||||||
*/
|
*/
|
||||||
public static Builder builder(@NotNull final AbstractEcoPlugin plugin,
|
public static Builder builder(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final String key) {
|
@NotNull final String key) {
|
||||||
return new Builder(plugin, key);
|
return new Builder(plugin, key);
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ public final class EcoShapedRecipe extends PluginDependent {
|
|||||||
/**
|
/**
|
||||||
* The plugin that created the recipe.
|
* The plugin that created the recipe.
|
||||||
*/
|
*/
|
||||||
private final AbstractEcoPlugin plugin;
|
private final EcoPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new recipe builder.
|
* Create a new recipe builder.
|
||||||
@@ -142,7 +142,7 @@ public final class EcoShapedRecipe extends PluginDependent {
|
|||||||
* @param plugin The plugin that owns the recipe.
|
* @param plugin The plugin that owns the recipe.
|
||||||
* @param key The recipe key.
|
* @param key The recipe key.
|
||||||
*/
|
*/
|
||||||
private Builder(@NotNull final AbstractEcoPlugin plugin,
|
private Builder(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final String key) {
|
@NotNull final String key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.util.updater;
|
package com.willfp.eco.util.updater;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.util.Consumer;
|
import org.bukkit.util.Consumer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ public class UpdateChecker extends PluginDependent {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin to check.
|
* @param plugin The plugin to check.
|
||||||
*/
|
*/
|
||||||
public UpdateChecker(@NotNull final AbstractEcoPlugin plugin) {
|
public UpdateChecker(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import com.willfp.eco.util.integrations.IntegrationLoader;
|
|||||||
import com.willfp.eco.util.integrations.anticheat.AnticheatManager;
|
import com.willfp.eco.util.integrations.anticheat.AnticheatManager;
|
||||||
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
|
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
|
||||||
import com.willfp.eco.util.integrations.mcmmo.McmmoManager;
|
import com.willfp.eco.util.integrations.mcmmo.McmmoManager;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -49,7 +48,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class EcoPlugin extends AbstractEcoPlugin {
|
public class EcoPlugin extends com.willfp.eco.util.plugin.EcoPlugin {
|
||||||
/**
|
/**
|
||||||
* Instance of eco.
|
* Instance of eco.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.comphenix.protocol.ProtocolLibrary;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.proxy.proxies.AutoCraftProxy;
|
import com.willfp.eco.proxy.proxies.AutoCraftProxy;
|
||||||
import com.willfp.eco.spigot.InternalProxyUtils;
|
import com.willfp.eco.spigot.InternalProxyUtils;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -18,14 +18,14 @@ public class PacketAutoRecipe extends AbstractPacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin to listen through.
|
* @param plugin The plugin to listen through.
|
||||||
*/
|
*/
|
||||||
public PacketAutoRecipe(@NotNull final AbstractEcoPlugin plugin) {
|
public PacketAutoRecipe(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.AUTO_RECIPE, false);
|
super(plugin, PacketType.Play.Server.AUTO_RECIPE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSend(@NotNull final PacketContainer packet,
|
public void onSend(@NotNull final PacketContainer packet,
|
||||||
@NotNull final Player player) {
|
@NotNull final Player player) {
|
||||||
if (!AbstractEcoPlugin.LOADED_ECO_PLUGINS.contains(packet.getMinecraftKeys().getValues().get(0).getFullKey().split(":")[0])) {
|
if (!EcoPlugin.LOADED_ECO_PLUGINS.contains(packet.getMinecraftKeys().getValues().get(0).getFullKey().split(":")[0])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import com.willfp.eco.proxy.proxies.ChatComponentProxy;
|
import com.willfp.eco.proxy.proxies.ChatComponentProxy;
|
||||||
import com.willfp.eco.spigot.InternalProxyUtils;
|
import com.willfp.eco.spigot.InternalProxyUtils;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -17,7 +17,7 @@ public class PacketChat extends AbstractPacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin to listen through.
|
* @param plugin The plugin to listen through.
|
||||||
*/
|
*/
|
||||||
public PacketChat(@NotNull final AbstractEcoPlugin plugin) {
|
public PacketChat(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.CHAT, ListenerPriority.MONITOR, true);
|
super(plugin, PacketType.Play.Server.CHAT, ListenerPriority.MONITOR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.comphenix.protocol.PacketType;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.proxy.proxies.VillagerTradeProxy;
|
import com.willfp.eco.proxy.proxies.VillagerTradeProxy;
|
||||||
import com.willfp.eco.spigot.InternalProxyUtils;
|
import com.willfp.eco.spigot.InternalProxyUtils;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.MerchantRecipe;
|
import org.bukkit.inventory.MerchantRecipe;
|
||||||
@@ -19,7 +19,7 @@ public class PacketOpenWindowMerchant extends AbstractPacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin to listen through.
|
* @param plugin The plugin to listen through.
|
||||||
*/
|
*/
|
||||||
public PacketOpenWindowMerchant(@NotNull final AbstractEcoPlugin plugin) {
|
public PacketOpenWindowMerchant(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.OPEN_WINDOW_MERCHANT, false);
|
super(plugin, PacketType.Play.Server.OPEN_WINDOW_MERCHANT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.willfp.eco.spigot.display;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.util.display.Display;
|
import com.willfp.eco.util.display.Display;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -14,7 +14,7 @@ public class PacketSetCreativeSlot extends AbstractPacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin to listen through.
|
* @param plugin The plugin to listen through.
|
||||||
*/
|
*/
|
||||||
public PacketSetCreativeSlot(@NotNull final AbstractEcoPlugin plugin) {
|
public PacketSetCreativeSlot(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Client.SET_CREATIVE_SLOT, false);
|
super(plugin, PacketType.Play.Client.SET_CREATIVE_SLOT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.willfp.eco.spigot.display;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.util.display.Display;
|
import com.willfp.eco.util.display.Display;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -14,7 +14,7 @@ public class PacketSetSlot extends AbstractPacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin to listen through.
|
* @param plugin The plugin to listen through.
|
||||||
*/
|
*/
|
||||||
public PacketSetSlot(@NotNull final AbstractEcoPlugin plugin) {
|
public PacketSetSlot(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.SET_SLOT, false);
|
super(plugin, PacketType.Play.Server.SET_SLOT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.willfp.eco.spigot.display;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.util.display.Display;
|
import com.willfp.eco.util.display.Display;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -14,7 +14,7 @@ public class PacketWindowItems extends AbstractPacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param plugin The plugin to listen through.
|
* @param plugin The plugin to listen through.
|
||||||
*/
|
*/
|
||||||
public PacketWindowItems(@NotNull final AbstractEcoPlugin plugin) {
|
public PacketWindowItems(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.WINDOW_ITEMS, false);
|
super(plugin, PacketType.Play.Server.WINDOW_ITEMS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.willfp.eco.spigot.drops;
|
|||||||
|
|
||||||
import com.willfp.eco.internal.drops.impl.FastCollatedDropQueue;
|
import com.willfp.eco.internal.drops.impl.FastCollatedDropQueue;
|
||||||
import com.willfp.eco.internal.drops.impl.InternalDropQueue;
|
import com.willfp.eco.internal.drops.impl.InternalDropQueue;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
@@ -21,9 +21,9 @@ public class CollatedRunnable {
|
|||||||
/**
|
/**
|
||||||
* Create and run a new runnable to process collated drops.
|
* Create and run a new runnable to process collated drops.
|
||||||
*
|
*
|
||||||
* @param plugin The {@link AbstractEcoPlugin} that manages the processing.
|
* @param plugin The {@link EcoPlugin} that manages the processing.
|
||||||
*/
|
*/
|
||||||
public CollatedRunnable(@NotNull final AbstractEcoPlugin plugin) {
|
public CollatedRunnable(@NotNull final EcoPlugin plugin) {
|
||||||
runnableTask = plugin.getScheduler().runTimer(() -> {
|
runnableTask = plugin.getScheduler().runTimer(() -> {
|
||||||
for (Map.Entry<Player, FastCollatedDropQueue.CollatedDrops> entry : FastCollatedDropQueue.COLLATED_MAP.entrySet()) {
|
for (Map.Entry<Player, FastCollatedDropQueue.CollatedDrops> entry : FastCollatedDropQueue.COLLATED_MAP.entrySet()) {
|
||||||
new InternalDropQueue(entry.getKey())
|
new InternalDropQueue(entry.getKey())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.spigot.eventlisteners;
|
package com.willfp.eco.spigot.eventlisteners;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -24,12 +24,12 @@ public class EntityDeathByEntityListeners extends PluginDependent implements Lis
|
|||||||
private final Set<EntityDeathByEntityBuilder> events = new HashSet<>();
|
private final Set<EntityDeathByEntityBuilder> events = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a listener associated with an {@link AbstractEcoPlugin}.
|
* Create a listener associated with an {@link EcoPlugin}.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin to associate with.
|
* @param plugin The plugin to associate with.
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public EntityDeathByEntityListeners(@NotNull final AbstractEcoPlugin plugin) {
|
public EntityDeathByEntityListeners(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.willfp.eco.spigot.integrations.antigrief;
|
|||||||
|
|
||||||
import com.willfp.eco.util.integrations.antigrief.AntigriefWrapper;
|
import com.willfp.eco.util.integrations.antigrief.AntigriefWrapper;
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import me.angeschossen.lands.api.integration.LandsIntegration;
|
import me.angeschossen.lands.api.integration.LandsIntegration;
|
||||||
import me.angeschossen.lands.api.land.Area;
|
import me.angeschossen.lands.api.land.Area;
|
||||||
import me.angeschossen.lands.api.role.enums.RoleSetting;
|
import me.angeschossen.lands.api.role.enums.RoleSetting;
|
||||||
@@ -23,7 +23,7 @@ public class AntigriefLands extends PluginDependent implements AntigriefWrapper
|
|||||||
*
|
*
|
||||||
* @param plugin The integration provider.
|
* @param plugin The integration provider.
|
||||||
*/
|
*/
|
||||||
public AntigriefLands(@NotNull final AbstractEcoPlugin plugin) {
|
public AntigriefLands(@NotNull final EcoPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.willfp.eco.spigot.recipes;
|
package com.willfp.eco.spigot.recipes;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.recipe.RecipeParts;
|
import com.willfp.eco.util.recipe.RecipeParts;
|
||||||
import com.willfp.eco.util.recipe.Recipes;
|
import com.willfp.eco.util.recipe.Recipes;
|
||||||
import com.willfp.eco.util.recipe.parts.RecipePart;
|
import com.willfp.eco.util.recipe.parts.RecipePart;
|
||||||
@@ -31,7 +31,7 @@ public class RecipeListener implements Listener {
|
|||||||
|
|
||||||
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
||||||
|
|
||||||
if (!AbstractEcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
if (!EcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public class RecipeListener implements Listener {
|
|||||||
|
|
||||||
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
||||||
|
|
||||||
if (!AbstractEcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
if (!EcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ public class RecipeListener implements Listener {
|
|||||||
|
|
||||||
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
||||||
|
|
||||||
if (AbstractEcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
if (EcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ public class RecipeListener implements Listener {
|
|||||||
|
|
||||||
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
ShapedRecipe recipe = (ShapedRecipe) event.getRecipe();
|
||||||
|
|
||||||
if (AbstractEcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
if (EcoPlugin.LOADED_ECO_PLUGINS.contains(recipe.getKey().getNamespace())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ public class RecipeListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preventLearningDisplayedRecipes(@NotNull final PlayerRecipeDiscoverEvent event) {
|
public void preventLearningDisplayedRecipes(@NotNull final PlayerRecipeDiscoverEvent event) {
|
||||||
if (!AbstractEcoPlugin.LOADED_ECO_PLUGINS.contains(event.getRecipe().getNamespace())) {
|
if (!EcoPlugin.LOADED_ECO_PLUGINS.contains(event.getRecipe().getNamespace())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.eco.proxy.util;
|
package com.willfp.eco.proxy.util;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.EcoPlugin;
|
||||||
import com.willfp.eco.util.proxy.AbstractProxy;
|
import com.willfp.eco.util.proxy.AbstractProxy;
|
||||||
import com.willfp.eco.util.proxy.ProxyConstants;
|
import com.willfp.eco.util.proxy.ProxyConstants;
|
||||||
import com.willfp.eco.util.proxy.UnsupportedVersionException;
|
import com.willfp.eco.util.proxy.UnsupportedVersionException;
|
||||||
@@ -27,7 +27,7 @@ public class ProxyFactory<T extends AbstractProxy> extends PluginDependent {
|
|||||||
* @param plugin The plugin to create proxies for.
|
* @param plugin The plugin to create proxies for.
|
||||||
* @param proxyClass The class of the proxy interface.
|
* @param proxyClass The class of the proxy interface.
|
||||||
*/
|
*/
|
||||||
public ProxyFactory(@NotNull final AbstractEcoPlugin plugin,
|
public ProxyFactory(@NotNull final EcoPlugin plugin,
|
||||||
@NotNull final Class<T> proxyClass) {
|
@NotNull final Class<T> proxyClass) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.proxyClass = proxyClass;
|
this.proxyClass = proxyClass;
|
||||||
|
|||||||
Reference in New Issue
Block a user