Fixed remaining this.plugin calls

This commit is contained in:
Auxilor 2020-12-22 19:52:53 +00:00
parent d096296958
commit 70671d521f
3 changed files with 9 additions and 8 deletions

View File

@ -39,6 +39,6 @@ public class ArrowDataListener extends PluginDependent implements Listener {
if (item.getItemMeta() == null) return; if (item.getItemMeta() == null) return;
Map<Enchantment, Integer> enchantments = item.getItemMeta().getEnchants(); Map<Enchantment, Integer> enchantments = item.getItemMeta().getEnchants();
arrow.setMetadata("enchantments", plugin.getMetadataValueFactory().create(enchantments)); arrow.setMetadata("enchantments", this.getPlugin().getMetadataValueFactory().create(enchantments));
} }
} }

View File

@ -23,27 +23,27 @@ public abstract class BaseConfig extends PluginDependent {
this.name = configName + ".yml"; this.name = configName + ".yml";
this.removeUnused = removeUnused; this.removeUnused = removeUnused;
if (!new File(plugin.getDataFolder(), this.name).exists()) { if (!new File(this.getPlugin().getDataFolder(), this.name).exists()) {
createFile(); createFile();
} }
this.configFile = new File(plugin.getDataFolder(), this.name); this.configFile = new File(this.getPlugin().getDataFolder(), this.name);
this.config = YamlConfiguration.loadConfiguration(configFile); this.config = YamlConfiguration.loadConfiguration(configFile);
update(); update();
} }
private void createFile() { private void createFile() {
plugin.saveResource(name, false); this.getPlugin().saveResource(name, false);
} }
public void update() { public void update() {
try { try {
config.load(configFile); config.load(configFile);
InputStream newIn = plugin.getResource(name); InputStream newIn = this.getPlugin().getResource(name);
if (newIn == null) { if (newIn == null) {
plugin.getLog().error(name + " is null?"); this.getPlugin().getLog().error(name + " is null?");
return; return;
} }
BufferedReader reader = new BufferedReader(new InputStreamReader(newIn, StandardCharsets.UTF_8)); BufferedReader reader = new BufferedReader(new InputStreamReader(newIn, StandardCharsets.UTF_8));

View File

@ -11,6 +11,7 @@ import java.util.Set;
* Utility class for Anticheat Integrations * Utility class for Anticheat Integrations
*/ */
public class AnticheatManager { public class AnticheatManager {
private static final AbstractEcoPlugin plugin = AbstractEcoPlugin.getInstance();
private static final Set<AnticheatWrapper> anticheats = new HashSet<>(); private static final Set<AnticheatWrapper> anticheats = new HashSet<>();
/** /**
@ -20,7 +21,7 @@ public class AnticheatManager {
*/ */
public static void register(AnticheatWrapper anticheat) { public static void register(AnticheatWrapper anticheat) {
if (anticheat instanceof Listener) { if (anticheat instanceof Listener) {
AbstractEcoPlugin.getInstance().getEventManager().registerEvents((Listener) anticheat); plugin.getEventManager().registerEvents((Listener) anticheat);
} }
anticheats.add(anticheat); anticheats.add(anticheat);
} }
@ -41,7 +42,7 @@ public class AnticheatManager {
* @param player The player to remove the exemption * @param player The player to remove the exemption
*/ */
public static void unexemptPlayer(Player player) { public static void unexemptPlayer(Player player) {
AbstractEcoPlugin.getInstance().getScheduler().runLater(() -> { plugin.getScheduler().runLater(() -> {
anticheats.forEach(anticheat -> anticheat.unexempt(player)); anticheats.forEach(anticheat -> anticheat.unexempt(player));
}, 1); }, 1);
} }