From 70671d521fcc8db3e71e7861eb0d655bdb22b0d3 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 22 Dec 2020 19:52:53 +0000 Subject: [PATCH] Fixed remaining this.plugin calls --- .../com/willfp/eco/util/arrows/ArrowDataListener.java | 2 +- .../java/com/willfp/eco/util/config/BaseConfig.java | 10 +++++----- .../util/integrations/anticheat/AnticheatManager.java | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/eco-util/src/main/java/com/willfp/eco/util/arrows/ArrowDataListener.java b/eco-util/src/main/java/com/willfp/eco/util/arrows/ArrowDataListener.java index da6fea50..e2dd7855 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/arrows/ArrowDataListener.java +++ b/eco-util/src/main/java/com/willfp/eco/util/arrows/ArrowDataListener.java @@ -39,6 +39,6 @@ public class ArrowDataListener extends PluginDependent implements Listener { if (item.getItemMeta() == null) return; Map enchantments = item.getItemMeta().getEnchants(); - arrow.setMetadata("enchantments", plugin.getMetadataValueFactory().create(enchantments)); + arrow.setMetadata("enchantments", this.getPlugin().getMetadataValueFactory().create(enchantments)); } } diff --git a/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java b/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java index 66cb4465..09d3650a 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java +++ b/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java @@ -23,27 +23,27 @@ public abstract class BaseConfig extends PluginDependent { this.name = configName + ".yml"; this.removeUnused = removeUnused; - if (!new File(plugin.getDataFolder(), this.name).exists()) { + if (!new File(this.getPlugin().getDataFolder(), this.name).exists()) { createFile(); } - this.configFile = new File(plugin.getDataFolder(), this.name); + this.configFile = new File(this.getPlugin().getDataFolder(), this.name); this.config = YamlConfiguration.loadConfiguration(configFile); update(); } private void createFile() { - plugin.saveResource(name, false); + this.getPlugin().saveResource(name, false); } public void update() { try { config.load(configFile); - InputStream newIn = plugin.getResource(name); + InputStream newIn = this.getPlugin().getResource(name); if (newIn == null) { - plugin.getLog().error(name + " is null?"); + this.getPlugin().getLog().error(name + " is null?"); return; } BufferedReader reader = new BufferedReader(new InputStreamReader(newIn, StandardCharsets.UTF_8)); diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/AnticheatManager.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/AnticheatManager.java index b9e3e72a..b63b4822 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/AnticheatManager.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/AnticheatManager.java @@ -11,6 +11,7 @@ import java.util.Set; * Utility class for Anticheat Integrations */ public class AnticheatManager { + private static final AbstractEcoPlugin plugin = AbstractEcoPlugin.getInstance(); private static final Set anticheats = new HashSet<>(); /** @@ -20,7 +21,7 @@ public class AnticheatManager { */ public static void register(AnticheatWrapper anticheat) { if (anticheat instanceof Listener) { - AbstractEcoPlugin.getInstance().getEventManager().registerEvents((Listener) anticheat); + plugin.getEventManager().registerEvents((Listener) anticheat); } anticheats.add(anticheat); } @@ -41,7 +42,7 @@ public class AnticheatManager { * @param player The player to remove the exemption */ public static void unexemptPlayer(Player player) { - AbstractEcoPlugin.getInstance().getScheduler().runLater(() -> { + plugin.getScheduler().runLater(() -> { anticheats.forEach(anticheat -> anticheat.unexempt(player)); }, 1); }