diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/Main.java b/Plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java similarity index 89% rename from Plugin/src/main/java/com/willfp/ecoenchants/Main.java rename to Plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java index bbe9f3ed..da6e60b2 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/Main.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java @@ -9,8 +9,8 @@ import java.util.HashMap; /** * The Main class for EcoEnchants */ -public class Main extends JavaPlugin { - private static Main instance; +public class EcoEnchantsPlugin extends JavaPlugin { + private static EcoEnchantsPlugin instance; /** * Config versions for config.yml and lang.yml @@ -65,7 +65,7 @@ public class Main extends JavaPlugin { * Get plugin instance * @return Plugin instance */ - public static Main getInstance() { + public static EcoEnchantsPlugin getInstance() { return instance; } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/anvil/AnvilListeners.java b/Plugin/src/main/java/com/willfp/ecoenchants/anvil/AnvilListeners.java index 414afba7..f065b996 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/anvil/AnvilListeners.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/anvil/AnvilListeners.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.anvil; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.util.Pair; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -42,7 +42,7 @@ public class AnvilListeners implements Listener { final int cost = modCost + event.getInventory().getRepairCost(); - Bukkit.getScheduler().runTask(Main.getInstance(), () -> { + Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), () -> { event.getInventory().setRepairCost(cost); event.setResult(newOut.getKey()); event.getInventory().setItem(2, newOut.getKey()); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcodebug.java b/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcodebug.java index 31b66f6b..b3b00fed 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcodebug.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcodebug.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.commands; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.enchantments.EcoEnchants; import org.bukkit.Bukkit; @@ -29,7 +29,7 @@ public class CommandEcodebug implements CommandExecutor { Bukkit.getLogger().info("--------------- BEGIN DEBUG ----------------"); Player player = (Player) sender; - Bukkit.getLogger().info("Running Version: " + Main.getInstance().getDescription().getVersion()); + Bukkit.getLogger().info("Running Version: " + EcoEnchantsPlugin.getInstance().getDescription().getVersion()); Bukkit.getLogger().info("Held Item: " + player.getInventory().getItemInMainHand().toString()); Bukkit.getLogger().info("EcoEnchants.getAll(): " + EcoEnchants.getAll().toString()); Bukkit.getLogger().info("Enchantment.values(): " + Arrays.toString(Enchantment.values())); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java b/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java index 5cbb609e..b1e53e0c 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/commands/CommandEcoreload.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.commands; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.display.EnchantDisplay; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -37,9 +37,9 @@ public class CommandEcoreload implements CommandExecutor { EcoEnchants.getAll().forEach((ecoEnchant -> { HandlerList.unregisterAll(ecoEnchant); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { if(!ecoEnchant.isDisabled()) { - Bukkit.getPluginManager().registerEvents(ecoEnchant, Main.getInstance()); + Bukkit.getPluginManager().registerEvents(ecoEnchant, EcoEnchantsPlugin.getInstance()); } }, 1); })); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java b/Plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java index 12f76189..447c8da0 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.config; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import org.bukkit.Bukkit; import org.bukkit.configuration.InvalidConfigurationException; @@ -21,7 +21,7 @@ public abstract class EnchantmentYamlConfig { private File configFile; private final File directory; private final double latestVersion; - private final JavaPlugin plugin = Main.getInstance(); + private final JavaPlugin plugin = EcoEnchantsPlugin.getInstance(); private final Class plugin2; private final EcoEnchant.EnchantmentType type; private File basedir = new File(this.plugin.getDataFolder(), "enchants/"); @@ -67,9 +67,9 @@ public abstract class EnchantmentYamlConfig { InputStream in = plugin2.getResourceAsStream(resourcePath); - File outFile = new File(Main.getInstance().getDataFolder(), resourcePath); + File outFile = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), resourcePath); int lastIndex = resourcePath.lastIndexOf('/'); - File outDir = new File(Main.getInstance().getDataFolder(), resourcePath.substring(0, Math.max(lastIndex, 0))); + File outDir = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), resourcePath.substring(0, Math.max(lastIndex, 0))); if (!outDir.exists()) { outDir.mkdirs(); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/config/YamlConfig.java b/Plugin/src/main/java/com/willfp/ecoenchants/config/YamlConfig.java index d5a3211d..2ccfd6bc 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/config/YamlConfig.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/config/YamlConfig.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.config; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.bukkit.Bukkit; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; @@ -24,22 +24,22 @@ public abstract class YamlConfig { } private void init() { - if (!new File(Main.getInstance().getDataFolder(), name + ".yml").exists()) { + if (!new File(EcoEnchantsPlugin.getInstance().getDataFolder(), name + ".yml").exists()) { createFile(); } - this.configFile = new File(Main.getInstance().getDataFolder(), name + ".yml"); + this.configFile = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), name + ".yml"); this.config = YamlConfiguration.loadConfiguration(configFile); checkVersion(); } private void createFile() { - Main.getInstance().saveResource(name + ".yml", false); + EcoEnchantsPlugin.getInstance().saveResource(name + ".yml", false); } private void replaceFile() { - Main.getInstance().saveResource(name + ".yml", true); + EcoEnchantsPlugin.getInstance().saveResource(name + ".yml", true); } public void reload() { @@ -52,7 +52,7 @@ public abstract class YamlConfig { } private void checkVersion() { - double latestVersion = Main.configVersions.get(this.name); + double latestVersion = EcoEnchantsPlugin.configVersions.get(this.name); if (latestVersion != config.getDouble("config-version")) { Bukkit.getLogger().warning("EcoEnchants detected an older or invalid " + name + ".yml. Replacing it with the default config..."); Bukkit.getLogger().warning("If you've edited the config, copy over your changes!"); @@ -66,11 +66,11 @@ public abstract class YamlConfig { LocalDateTime now = LocalDateTime.now(); String dateTime = dtf.format(now); try { - File backupDir = new File(Main.getInstance().getDataFolder(), "backup/"); + File backupDir = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), "backup/"); if(!backupDir.exists()) backupDir.mkdirs(); File oldConf = new File(backupDir, name + "_" + dateTime + ".yml"); oldConf.createNewFile(); - FileInputStream fis = new FileInputStream(Main.getInstance().getDataFolder() + "/" + name + ".yml"); + FileInputStream fis = new FileInputStream(EcoEnchantsPlugin.getInstance().getDataFolder() + "/" + name + ".yml"); FileOutputStream fos = new FileOutputStream(oldConf); byte[] buffer = new byte[1024]; int length; diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/DisplayPacketAdapter.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/DisplayPacketAdapter.java index 7e6571cc..2ec3dc3f 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/DisplayPacketAdapter.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/DisplayPacketAdapter.java @@ -3,7 +3,7 @@ package com.willfp.ecoenchants.display; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketEvent; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.bukkit.inventory.MerchantRecipe; import java.util.Arrays; @@ -19,7 +19,7 @@ public class DisplayPacketAdapter extends PacketAdapter { ); public DisplayPacketAdapter() { - super(Main.getInstance(), packets); + super(EcoEnchantsPlugin.getInstance(), packets); } @Override diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java index 81a94781..b20ccacf 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java @@ -1,7 +1,7 @@ package com.willfp.ecoenchants.display; import com.google.common.collect.Lists; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -30,12 +30,12 @@ public class EnchantDisplay { /** * The meta key of the length of enchantments in lore */ - private static final NamespacedKey key = new NamespacedKey(Main.getInstance(), "ecoenchantlore-len"); + private static final NamespacedKey key = new NamespacedKey(EcoEnchantsPlugin.getInstance(), "ecoenchantlore-len"); /** * The meta key to hide enchantments in lore */ - public static final NamespacedKey keySkip = new NamespacedKey(Main.getInstance(), "ecoenchantlore-skip"); + public static final NamespacedKey keySkip = new NamespacedKey(EcoEnchantsPlugin.getInstance(), "ecoenchantlore-skip"); private static String normalColor; diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/Artifact.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/Artifact.java index 8ea0459d..c0f41083 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/Artifact.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/Artifact.java @@ -1,7 +1,7 @@ package com.willfp.ecoenchants.enchantments; import com.google.common.util.concurrent.AtomicDouble; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.nms.Target; import com.willfp.ecoenchants.nms.TridentStack; import com.willfp.ecoenchants.util.HasEnchant; @@ -110,7 +110,7 @@ public abstract class Artifact extends EcoEnchant { entity.getWorld().spawnParticle(particle, particleLocation, 1, 0, 0, 0, 0, extra, false); } } - }.runTaskTimer(Main.getInstance(), 0, 1); + }.runTaskTimer(EcoEnchantsPlugin.getInstance(), 0, 1); } @EventHandler @@ -145,6 +145,6 @@ public abstract class Artifact extends EcoEnchant { if(entity.isOnGround() || entity.isInBlock() || entity.isDead()) this.cancel(); entity.getLocation().getWorld().spawnParticle(particle, entity.getLocation(), 1, 0, 0, 0, finalColor, extra, true); } - }.runTaskTimer(Main.getInstance(), 4, ticks); + }.runTaskTimer(EcoEnchantsPlugin.getInstance(), 4, ticks); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java index 71db65f4..dba851ad 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java @@ -1,7 +1,7 @@ package com.willfp.ecoenchants.enchantments; import com.earth2me.essentials.Enchantments; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.config.configs.EnchantmentConfig; import com.willfp.ecoenchants.nms.Target; @@ -101,7 +101,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener { Enchantment.registerEnchantment(this); - if(Main.hasEssentials) { + if(EcoEnchantsPlugin.hasEssentials) { ((Map) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(this.getKey().getKey(), this); } } catch (NoSuchFieldException | IllegalAccessException ignored) {} diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchantBuilder.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchantBuilder.java index 70e3a524..e78e40ca 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchantBuilder.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchantBuilder.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.config.configs.EnchantmentConfig; import com.willfp.ecoenchants.nms.Target; @@ -58,7 +58,7 @@ public class EcoEnchantBuilder { * @param version The config version */ public EcoEnchantBuilder(String key, EcoEnchant.EnchantmentType type, Target.Applicable[] applicable, double version) { - this(key, type, applicable, version, Main.class); + this(key, type, applicable, version, EcoEnchantsPlugin.class); } /** diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java index 219d1392..c2efc661 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.curse; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -21,7 +21,7 @@ public class CallingCurse extends EcoEnchant implements EcoRunnable { @Override public void run() { - Main.getInstance().getServer().getOnlinePlayers().stream().filter(player -> HasEnchant.getArmorPoints(player, EcoEnchants.CALLING_CURSE, false) > 0).forEach((player -> { + EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().stream().filter(player -> HasEnchant.getArmorPoints(player, EcoEnchants.CALLING_CURSE, false) > 0).forEach((player -> { double distance = EcoEnchants.CALLING_CURSE.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance"); for (Entity e : player.getWorld().getNearbyEntities(player.getLocation(), distance, distance, distance)) { diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java index c20cd7d3..c22e5d8a 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.curse; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -21,7 +21,7 @@ public class DecayCurse extends EcoEnchant implements EcoRunnable { @Override public void run() { - Main.getInstance().getServer().getOnlinePlayers().forEach((player -> { + EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().forEach((player -> { if(Arrays.stream(player.getInventory().getContents()).parallel().noneMatch(item2 -> HasEnchant.item(item2, EcoEnchants.DECAY_CURSE))) return; diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java index 7bccd062..68e67b4a 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -40,7 +40,7 @@ public class Aerial extends EcoEnchant { if (!(event.getEntity() instanceof Arrow)) return; Arrow a = (Arrow) event.getEntity(); - a.setMetadata("from-aerial", new FixedMetadataValue(Main.getInstance(), level)); + a.setMetadata("from-aerial", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), level)); } @EventHandler diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java index c5eb2626..167e35d6 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -50,7 +50,7 @@ public class BlastMining extends EcoEnchant { for (int z = -1; z <= 1; z++) { if(x == 0 && y == 0 && z == 0) continue; Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z)); - block1.setMetadata("from-blastmining", new FixedMetadataValue(Main.getInstance(), true)); + block1.setMetadata("from-blastmining", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); if(this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { continue; @@ -65,7 +65,7 @@ public class BlastMining extends EcoEnchant { block.getWorld().createExplosion(block.getLocation().clone().add(0.5, 0.5, 0.5), 0, false); hasExploded = true; } - block1.removeMetadata("from-blastmining", Main.getInstance()); + block1.removeMetadata("from-blastmining", EcoEnchantsPlugin.getInstance()); } } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java index afa1d7e9..9270f745 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -65,6 +65,6 @@ public class Bleed extends EcoEnchant { if(currentBleedCount.get() >= finalBleedCount) this.cancel(); } - }.runTaskTimer(Main.getInstance(), 0, 10); + }.runTaskTimer(EcoEnchantsPlugin.getInstance(), 0, 10); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java index 5d4c6a41..d9e28b70 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -55,9 +55,9 @@ public class Cleave extends EcoEnchant { .filter(entity -> entity instanceof LivingEntity) .filter(entity -> !entity.equals(player)) .forEach(entity -> { - entity.setMetadata("cleaved", new FixedMetadataValue(Main.getInstance(), true)); + entity.setMetadata("cleaved", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); ((LivingEntity) entity).damage(damage, player); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> entity.removeMetadata("cleaved", Main.getInstance()), 5); + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> entity.removeMetadata("cleaved", EcoEnchantsPlugin.getInstance()), 5); }); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java index 3a945989..37ae7677 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -26,7 +26,7 @@ public class Disappear extends EcoEnchant { if (!(event.getEntity() instanceof Player)) return; - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { Player player = (Player) event.getEntity(); if(player.getHealth() > EcoEnchants.DISAPPEAR.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "threshold")) diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java index 15fa3093..d97f5fe2 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -51,7 +51,7 @@ public class Drill extends EcoEnchant { for(int i = 1; i <= level; i++) { Vector simplified = SimplifyVector.simplifyVector(player.getLocation().getDirection().normalize()).multiply(i); Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(simplified)); - block1.setMetadata("from-drill", new FixedMetadataValue(Main.getInstance(), true)); + block1.setMetadata("from-drill", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); if(this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { continue; @@ -62,7 +62,7 @@ public class Drill extends EcoEnchant { if(!AntigriefManager.canBreakBlock(player, block1)) continue; BlockBreak.breakBlock(player, block1); - block1.removeMetadata("from-drill", Main.getInstance()); + block1.removeMetadata("from-drill", EcoEnchantsPlugin.getInstance()); } AnticheatManager.unexemptPlayer(player); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java index 18093997..6909cfd8 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -18,7 +18,7 @@ public class Forcefield extends EcoEnchant implements EcoRunnable { @Override public void run() { - Main.getInstance().getServer().getOnlinePlayers().stream().filter(player -> HasEnchant.getArmorPoints(player, EcoEnchants.FORCEFIELD, false) > 0).forEach((player -> { + EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().stream().filter(player -> HasEnchant.getArmorPoints(player, EcoEnchants.FORCEFIELD, false) > 0).forEach((player -> { int level = HasEnchant.getArmorPoints(player, EcoEnchants.FORCEFIELD, false); double initialDistance = EcoEnchants.FORCEFIELD.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance"); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java index 305f4420..c6345d3b 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -45,7 +45,7 @@ public class Frozen extends EcoEnchant { int divisor = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "points-per-level"); final int level = (int) Math.ceil((double) points / divisor); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, points * 5, level)); victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, points * 5, level)); }, 1); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java index 3ca1169a..6ae5a088 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -36,7 +36,7 @@ public class Incandescence extends EcoEnchant { if (totalIncandescencePoints == 0) return; - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { victim.setFireTicks(totalIncandescencePoints * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-point") + this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-ticks")); }, 1); } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java index ac5680f5..0c7d8b1a 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -41,6 +41,6 @@ public class Launch extends EcoEnchant { double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); double boost = 1 + (multiplier * level); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> player.setVelocity(player.getVelocity().multiply(boost)), 1); + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> player.setVelocity(player.getVelocity().multiply(boost)), 1); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java index 80bcef1a..a3c20f49 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -64,12 +64,12 @@ public class Lumberjack extends EcoEnchant { AnticheatManager.exemptPlayer(player); for(Block treeBlock : treeBlocks) { - treeBlock.setMetadata("from-lumberjack", new FixedMetadataValue(Main.getInstance(), true)); + treeBlock.setMetadata("from-lumberjack", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); if(!AntigriefManager.canBreakBlock(player, treeBlock)) continue; BlockBreak.breakBlock(player, treeBlock); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> treeBlock.removeMetadata("from-lumberjack", Main.getInstance()),1); + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> treeBlock.removeMetadata("from-lumberjack", EcoEnchantsPlugin.getInstance()),1); } AnticheatManager.unexemptPlayer(player); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java index 64899554..2c13c741 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -58,7 +58,7 @@ public class MagmaWalker extends EcoEnchant { block.setType(Material.OBSIDIAN); - block.setMetadata("byMagmaWalker", new FixedMetadataValue(Main.getInstance(), true)); + block.setMetadata("byMagmaWalker", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); long afterTicks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "remove-after-ticks"); @@ -68,20 +68,20 @@ public class MagmaWalker extends EcoEnchant { if (block.getType().equals(Material.OBSIDIAN)) { if(!player.getWorld().getBlockAt(player.getLocation().add(0, -1, 0)).equals(block)) { block.setType(Material.LAVA); - block.removeMetadata("byMagmaWalker", Main.getInstance()); + block.removeMetadata("byMagmaWalker", EcoEnchantsPlugin.getInstance()); this.cancel(); } } } }; - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { if (block.getType().equals(Material.OBSIDIAN)) { if(!player.getWorld().getBlockAt(player.getLocation().add(0, -1, 0)).equals(block)) { block.setType(Material.LAVA); - block.removeMetadata("byMagmaWalker", Main.getInstance()); + block.removeMetadata("byMagmaWalker", EcoEnchantsPlugin.getInstance()); } else { - replace.runTaskTimer(Main.getInstance(), afterTicks, afterTicks); + replace.runTaskTimer(EcoEnchantsPlugin.getInstance(), afterTicks, afterTicks); } } }, afterTicks); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java index 39ae95d8..e3e674ab 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -21,7 +21,7 @@ public class Magnetic extends EcoEnchant implements EcoRunnable { @Override public void run() { - Main.getInstance().getServer().getOnlinePlayers().stream().filter(player -> HasEnchant.getArmorPoints(player, EcoEnchants.MAGNETIC, false) > 0).forEach((player -> { + EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().stream().filter(player -> HasEnchant.getArmorPoints(player, EcoEnchants.MAGNETIC, false) > 0).forEach((player -> { int level = HasEnchant.getArmorPoints(player, EcoEnchants.MAGNETIC, false); double initialDistance = EcoEnchants.MAGNETIC.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance"); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java index 848e66e1..d49ab7f4 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -46,6 +46,6 @@ public class Marksman extends EcoEnchant { a.remove(); } } - }.runTaskLater(Main.getInstance(), ticks); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), ticks); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java index 0cb97c11..ef529ce2 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager; @@ -47,6 +47,6 @@ public class Replenish extends EcoEnchant { block.setType(type); block.setBlockData(data); } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java index 3fbfabd4..b667c604 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -59,13 +59,13 @@ public class Shockwave extends EcoEnchant { .filter(entity1 -> !entity1.hasMetadata("shockwaved")) .forEach((mob -> { ((LivingEntity) mob).damage(finalDamage, player); - mob.setMetadata("shockwaved", new FixedMetadataValue(Main.getInstance(), true)); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { - mob.removeMetadata("shockwaved", Main.getInstance()); + mob.setMetadata("shockwaved", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { + mob.removeMetadata("shockwaved", EcoEnchantsPlugin.getInstance()); }, 10); } )); } - }.runTaskTimer(Main.getInstance(), 4, ticks); + }.runTaskTimer(EcoEnchantsPlugin.getInstance(), 4, ticks); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java index 1bc93932..9657c0d5 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -51,7 +51,7 @@ public class Slicing extends EcoEnchant { victim.damage(level * damage, player); entities.add(victim); - Bukkit.getServer().getScheduler().runTaskLater(Main.getInstance(), new Runnable() { + Bukkit.getServer().getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), new Runnable() { public void run() { entities.remove(victim); } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java index a8f38918..ece5b717 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -42,7 +42,7 @@ public class Succession extends EcoEnchant { for (int i = 1; i <= number; i++) { - Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> { + Bukkit.getScheduler().scheduleSyncDelayedTask(EcoEnchantsPlugin.getInstance(), () -> { Arrow arrow = player.launchProjectile(Arrow.class, event.getProjectile().getVelocity()); arrow.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED); if(fire) arrow.setFireTicks(Integer.MAX_VALUE); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java index 212dd70d..c6fed48a 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -51,8 +51,8 @@ public class Thrive extends EcoEnchant { player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 255, false, false, false)); } } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java index 959f57a8..889d2b1e 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -48,7 +48,7 @@ public class Tornado extends EcoEnchant { Vector toAdd = new Vector(0, yVelocity, 0); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { victim.setVelocity(victim.getVelocity().clone().add(toAdd)); }, 1); } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java index 5804ff74..5c1318ce 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -64,12 +64,12 @@ public class Vein extends EcoEnchant { AnticheatManager.exemptPlayer(player); for(Block veinBlock : blockSet) { - veinBlock.setMetadata("from-vein", new FixedMetadataValue(Main.getInstance(), true)); + veinBlock.setMetadata("from-vein", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); if(!AntigriefManager.canBreakBlock(player, veinBlock)) continue; BlockBreak.breakBlock(player, veinBlock); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> veinBlock.removeMetadata("from-vein", Main.getInstance()),1); + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> veinBlock.removeMetadata("from-vein", EcoEnchantsPlugin.getInstance()),1); } AnticheatManager.unexemptPlayer(player); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java index 0f393ad1..9b42631c 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -55,7 +55,7 @@ public class Weakening extends EcoEnchant { weakened.add(victim); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { weakened.remove(victim); }, ticks); } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java index c37464f8..a6f9a3e1 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -97,8 +97,8 @@ public class Aiming extends EcoEnchant { @Override public void run() { if(arrow.isDead() || arrow.isInBlock() || arrow.isOnGround()) this.cancel(); - Bukkit.getScheduler().runTask(Main.getInstance(), runnable); + Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), runnable); } - }.runTaskTimer(Main.getInstance(), 3, 5); + }.runTaskTimer(EcoEnchantsPlugin.getInstance(), 3, 5); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java index 8e179ebb..67db1d2b 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -55,9 +55,9 @@ public class Carve extends EcoEnchant { .filter(entity -> entity instanceof LivingEntity) .filter(entity -> !entity.equals(player)) .forEach(entity -> { - entity.setMetadata("carved", new FixedMetadataValue(Main.getInstance(), true)); + entity.setMetadata("carved", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true)); ((LivingEntity) entity).damage(damage, player); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> entity.removeMetadata("carved", Main.getInstance()), 5); + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> entity.removeMetadata("carved", EcoEnchantsPlugin.getInstance()), 5); }); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java index fb1d25c2..b0dd06e5 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -21,7 +21,7 @@ public class Repairing extends EcoEnchant implements EcoRunnable { @Override public void run() { - Main.getInstance().getServer().getOnlinePlayers().parallelStream().forEach((player -> { + EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().parallelStream().forEach((player -> { if(Arrays.stream(player.getInventory().getContents()).parallel().noneMatch(item2 -> HasEnchant.item(item2, EcoEnchants.REPAIRING))) return; diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java index 81ad5685..d729841f 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -35,7 +35,7 @@ public class Streamlining extends EcoEnchant { player.setWalkSpeed((float) (0.2 + (level * EcoEnchants.STREAMLINING.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "speed-per-level")))); } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/events/entitydeathbyentity/EntityDeathByEntityListeners.java b/Plugin/src/main/java/com/willfp/ecoenchants/events/entitydeathbyentity/EntityDeathByEntityListeners.java index 976cbe63..87e20748 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/events/entitydeathbyentity/EntityDeathByEntityListeners.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/events/entitydeathbyentity/EntityDeathByEntityListeners.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.events.entitydeathbyentity; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.bukkit.entity.LivingEntity; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -38,7 +38,7 @@ public class EntityDeathByEntityListeners implements Listener { if(events.contains(builtEvent)) events.remove(builtEvent); } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); } @EventHandler diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/events/naturalexpgainevent/NaturalExpGainListeners.java b/Plugin/src/main/java/com/willfp/ecoenchants/events/naturalexpgainevent/NaturalExpGainListeners.java index b790c6b8..b1531043 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/events/naturalexpgainevent/NaturalExpGainListeners.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/events/naturalexpgainevent/NaturalExpGainListeners.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.events.naturalexpgainevent; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.ExpBottleEvent; @@ -43,7 +43,7 @@ public class NaturalExpGainListeners implements Listener { public void run() { events.remove(builtEvent); } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); } @EventHandler diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java b/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java index cfb1a52d..25c42a55 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/extensions/ExtensionManager.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.extensions; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; @@ -23,7 +23,7 @@ public class ExtensionManager { * Load all extensions */ public static void loadExtensions() { - File dir = new File(Main.getInstance().getDataFolder(), "/extensions"); + File dir = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), "/extensions"); if (!dir.exists()) { dir.mkdirs(); } @@ -37,7 +37,7 @@ public class ExtensionManager { URL url = extensionJar.toURI().toURL(); URL[] urls = {url}; - ClassLoader cl = new URLClassLoader(urls, Main.class.getClassLoader()); + ClassLoader cl = new URLClassLoader(urls, EcoEnchantsPlugin.class.getClassLoader()); InputStream ymlIn = cl.getResourceAsStream("extension.yml"); URL extensionYmlUrl = cl.getResource("extension.yml"); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/grindstone/GrindstoneListeners.java b/Plugin/src/main/java/com/willfp/ecoenchants/grindstone/GrindstoneListeners.java index d2c3dae3..9756f3d3 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/grindstone/GrindstoneListeners.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/grindstone/GrindstoneListeners.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.grindstone; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.bukkit.Bukkit; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; @@ -28,7 +28,7 @@ public class GrindstoneListeners implements Listener { GrindstoneInventory inventory = (GrindstoneInventory) player.getOpenInventory().getTopInventory(); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { ItemStack top = inventory.getItem(0); ItemStack bottom = inventory.getItem(1); @@ -58,13 +58,13 @@ public class GrindstoneListeners implements Listener { final ItemStack finalOut = newOut; - Bukkit.getScheduler().runTask(Main.getInstance(), () -> { + Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), () -> { inventory.setItem(2, finalOut); }); }, 1); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { for(Entity entity : player.getNearbyEntities(8, 8, 8)) { if(entity.getType().equals(EntityType.EXPERIENCE_ORB)) ((ExperienceOrb) entity).setExperience(2); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatManager.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatManager.java index 954a4a37..0c0d1afd 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatManager.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatManager.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.integrations.anticheat; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Listener; @@ -13,7 +13,7 @@ public class AnticheatManager { public static void registerAnticheat(AnticheatWrapper anticheat) { if(anticheat instanceof Listener) { - Bukkit.getPluginManager().registerEvents((Listener) anticheat, Main.getInstance()); + Bukkit.getPluginManager().registerEvents((Listener) anticheat, EcoEnchantsPlugin.getInstance()); } anticheats.add(anticheat); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefLands.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefLands.java index 136df768..9ae1f0c8 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefLands.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefLands.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.integrations.antigrief.plugins; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.integrations.antigrief.AntigriefWrapper; import me.angeschossen.lands.api.integration.LandsIntegration; import me.angeschossen.lands.api.land.Area; @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; public class AntigriefLands implements AntigriefWrapper { @Override public boolean canBreakBlock(Player player, Block block) { - LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance()); + LandsIntegration landsIntegration = new LandsIntegration(EcoEnchantsPlugin.getInstance()); Area area = landsIntegration.getAreaByLoc(block.getLocation()); if (area != null) { return area.canSetting(player, RoleSetting.BLOCK_BREAK, false); @@ -23,7 +23,7 @@ public class AntigriefLands implements AntigriefWrapper { @Override public boolean canCreateExplosion(Player player, Location location) { - LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance()); + LandsIntegration landsIntegration = new LandsIntegration(EcoEnchantsPlugin.getInstance()); Area area = landsIntegration.getAreaByLoc(location); if (area != null) { return area.canSetting(player, RoleSetting.BLOCK_IGNITE, false); @@ -33,7 +33,7 @@ public class AntigriefLands implements AntigriefWrapper { @Override public boolean canPlaceBlock(Player player, Block block) { - LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance()); + LandsIntegration landsIntegration = new LandsIntegration(EcoEnchantsPlugin.getInstance()); Area area = landsIntegration.getAreaByLoc(block.getLocation()); if (area != null) { return area.canSetting(player, RoleSetting.BLOCK_PLACE, false); @@ -43,7 +43,7 @@ public class AntigriefLands implements AntigriefWrapper { @Override public boolean canInjure(Player player, LivingEntity victim) { - LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance()); + LandsIntegration landsIntegration = new LandsIntegration(EcoEnchantsPlugin.getInstance()); Area area = landsIntegration.getAreaByLoc(victim.getLocation()); if(victim instanceof Player) { if (area != null) { diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/listeners/EnchantingListeners.java b/Plugin/src/main/java/com/willfp/ecoenchants/listeners/EnchantingListeners.java index 56ab8f88..0c0671e0 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/listeners/EnchantingListeners.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/listeners/EnchantingListeners.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.listeners; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -49,7 +49,7 @@ public class EnchantingListeners implements Listener { ItemStack item = event.getInventory().getItem(0); event.getInventory().setItem(0, item); } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); return; } @@ -164,7 +164,7 @@ public class EnchantingListeners implements Listener { } event.getInventory().setItem(0, item); } - }.runTaskLater(Main.getInstance(), 1); + }.runTaskLater(EcoEnchantsPlugin.getInstance(), 1); } @EventHandler diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/listeners/PlayerJoinListener.java b/Plugin/src/main/java/com/willfp/ecoenchants/listeners/PlayerJoinListener.java index 1277c1f4..5f4c5ea6 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/listeners/PlayerJoinListener.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/listeners/PlayerJoinListener.java @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.listeners; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.config.ConfigManager; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -9,10 +9,10 @@ import org.bukkit.event.player.PlayerJoinEvent; public class PlayerJoinListener implements Listener { @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { - if (Main.outdated) { + if (EcoEnchantsPlugin.outdated) { if (event.getPlayer().hasPermission("ecoenchants.updateannounce")) { - event.getPlayer().sendMessage(ConfigManager.getLang().getMessage("outdated").replace("%ver%", Main.getInstance().getDescription().getVersion()) - .replace("%newver%", Main.newVersion)); + event.getPlayer().sendMessage(ConfigManager.getLang().getMessage("outdated").replace("%ver%", EcoEnchantsPlugin.getInstance().getDescription().getVersion()) + .replace("%newver%", EcoEnchantsPlugin.newVersion)); } } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java index cb85413a..d957508d 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java @@ -1,7 +1,7 @@ package com.willfp.ecoenchants.loader; import com.comphenix.protocol.ProtocolLibrary; -import com.willfp.ecoenchants.Main; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.anvil.AnvilListeners; import com.willfp.ecoenchants.bstats.Metrics; import com.willfp.ecoenchants.commands.CommandEcodebug; @@ -49,7 +49,7 @@ import java.util.List; public class Loader { /** - * Called by {@link Main#onEnable()} + * Called by {@link EcoEnchantsPlugin#onEnable()} */ public static void load() { Bukkit.getLogger().info("=========================================="); @@ -95,8 +95,8 @@ public class Loader { */ Bukkit.getLogger().info("Loading ProtocolLib..."); - Main.getInstance().protocolManager = ProtocolLibrary.getProtocolManager(); - Main.getInstance().protocolManager.addPacketListener(new DisplayPacketAdapter()); + EcoEnchantsPlugin.getInstance().protocolManager = ProtocolLibrary.getProtocolManager(); + EcoEnchantsPlugin.getInstance().protocolManager.addPacketListener(new DisplayPacketAdapter()); /* Load land management support @@ -104,7 +104,7 @@ public class Loader { Bukkit.getLogger().info("Scheduling Integration Loading..."); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { Bukkit.getLogger().info("Loading Integrations..."); @@ -143,8 +143,8 @@ public class Loader { Bukkit.getLogger().info("Lands: §9DISABLED"); } - Main.hasEssentials = Bukkit.getPluginManager().isPluginEnabled("Essentials"); - if(Main.hasEssentials) Bukkit.getLogger().info("Essentials: §aENABLED"); + EcoEnchantsPlugin.hasEssentials = Bukkit.getPluginManager().isPluginEnabled("Essentials"); + if(EcoEnchantsPlugin.hasEssentials) Bukkit.getLogger().info("Essentials: §aENABLED"); else Bukkit.getLogger().info("Essentials: §9DISABLED"); Bukkit.getLogger().info(""); @@ -195,7 +195,7 @@ public class Loader { } else { Bukkit.getLogger().info("Targets: §cFAILURE"); Bukkit.getLogger().severe("§cAborting..."); - Bukkit.getPluginManager().disablePlugin(Main.getInstance()); + Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance()); } if(Cooldown.init()) { @@ -203,7 +203,7 @@ public class Loader { } else { Bukkit.getLogger().info("Cooldown: §cFAILURE"); Bukkit.getLogger().severe("§cAborting..."); - Bukkit.getPluginManager().disablePlugin(Main.getInstance()); + Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance()); } if(TridentStack.init()) { @@ -211,7 +211,7 @@ public class Loader { } else { Bukkit.getLogger().info("Trident API: §cFAILURE"); Bukkit.getLogger().severe("§cAborting..."); - Bukkit.getPluginManager().disablePlugin(Main.getInstance()); + Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance()); } if(BlockBreak.init()) { @@ -219,7 +219,7 @@ public class Loader { } else { Bukkit.getLogger().info("Block Break: §cFAILURE"); Bukkit.getLogger().severe("§cAborting..."); - Bukkit.getPluginManager().disablePlugin(Main.getInstance()); + Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance()); } Bukkit.getLogger().info(""); @@ -229,15 +229,15 @@ public class Loader { */ Bukkit.getLogger().info("Registering Events..."); - Bukkit.getPluginManager().registerEvents(new ArmorListener(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new DispenserArmorListener(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new EnchantingListeners(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new GrindstoneListeners(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new AnvilListeners(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new EntityDeathByEntityListeners(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new NaturalExpGainListeners(), Main.getInstance()); - Bukkit.getPluginManager().registerEvents(new VillagerListeners(), Main.getInstance()); + Bukkit.getPluginManager().registerEvents(new ArmorListener(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new DispenserArmorListener(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new EnchantingListeners(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new GrindstoneListeners(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new AnvilListeners(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new EntityDeathByEntityListeners(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new NaturalExpGainListeners(), EcoEnchantsPlugin.getInstance()); + Bukkit.getPluginManager().registerEvents(new VillagerListeners(), EcoEnchantsPlugin.getInstance()); Bukkit.getLogger().info(""); /* @@ -245,7 +245,7 @@ public class Loader { */ Bukkit.getLogger().info("Scheduling Adding Block Populators..."); - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { Bukkit.getServer().getWorlds().forEach((world -> { world.getPopulators().add(new LootPopulator()); })); @@ -285,7 +285,7 @@ public class Loader { EnchantmentRarity.update(); if(EnchantmentRarity.getAll().size() == 0) { Bukkit.getLogger().severe("§cError loading rarities! Aborting..."); - Bukkit.getPluginManager().disablePlugin(Main.getInstance()); + Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance()); return; } else { Bukkit.getLogger().info(EnchantmentRarity.getAll().size() + " Rarities Loaded:"); @@ -297,7 +297,7 @@ public class Loader { if (EcoEnchants.getAll().size() == 0) { Bukkit.getLogger().severe("§cError adding enchantments! Aborting..."); - Bukkit.getPluginManager().disablePlugin(Main.getInstance()); + Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance()); return; } else { Bukkit.getLogger().info(EcoEnchants.getAll().size() + " Enchantments Loaded:"); @@ -350,7 +350,7 @@ public class Loader { Bukkit.getLogger().info("Registering Enchantment Listeners..."); EcoEnchants.getAll().forEach((ecoEnchant -> { if(!ecoEnchant.isDisabled()) { - Bukkit.getPluginManager().registerEvents(ecoEnchant, Main.getInstance()); + Bukkit.getPluginManager().registerEvents(ecoEnchant, EcoEnchantsPlugin.getInstance()); } })); Bukkit.getLogger().info(""); @@ -362,7 +362,7 @@ public class Loader { Bukkit.getLogger().info("Registering Enchantment Tasks..."); EcoEnchants.getAll().forEach((ecoEnchant -> { if(ecoEnchant instanceof EcoRunnable) { - Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), (Runnable) ecoEnchant, 5, ((EcoRunnable) ecoEnchant).getTime()); + Bukkit.getScheduler().scheduleSyncRepeatingTask(EcoEnchantsPlugin.getInstance(), (Runnable) ecoEnchant, 5, ((EcoRunnable) ecoEnchant).getTime()); } })); Bukkit.getLogger().info(""); @@ -384,7 +384,7 @@ public class Loader { */ Bukkit.getLogger().info("Hooking into bStats..."); - new Metrics(Main.getInstance(), 7666); + new Metrics(EcoEnchantsPlugin.getInstance(), 7666); Bukkit.getLogger().info(""); /* @@ -392,21 +392,21 @@ public class Loader { */ - new UpdateChecker(Main.getInstance(), 79573).getVersion((version) -> { - DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(Main.getInstance().getDescription().getVersion()); + new UpdateChecker(EcoEnchantsPlugin.getInstance(), 79573).getVersion((version) -> { + DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(EcoEnchantsPlugin.getInstance().getDescription().getVersion()); DefaultArtifactVersion mostRecentVersion = new DefaultArtifactVersion(version); Bukkit.getLogger().info("----------------------------"); Bukkit.getLogger().info(""); Bukkit.getLogger().info("EcoEnchants Updater"); Bukkit.getLogger().info(""); if (currentVersion.compareTo(mostRecentVersion) > 0 || currentVersion.equals(mostRecentVersion)) { - Bukkit.getLogger().info("§aEcoEnchants is up to date! (Version " + Main.getInstance().getDescription().getVersion() + ")"); + Bukkit.getLogger().info("§aEcoEnchants is up to date! (Version " + EcoEnchantsPlugin.getInstance().getDescription().getVersion() + ")"); } else { - Main.outdated = true; - Main.newVersion = version; + EcoEnchantsPlugin.outdated = true; + EcoEnchantsPlugin.newVersion = version; - Bukkit.getScheduler().runTaskTimer(Main.getInstance(), () -> { - Bukkit.getLogger().info("§6EcoEnchants is out of date! (Version " + Main.getInstance().getDescription().getVersion() + ")"); + Bukkit.getScheduler().runTaskTimer(EcoEnchantsPlugin.getInstance(), () -> { + Bukkit.getLogger().info("§6EcoEnchants is out of date! (Version " + EcoEnchantsPlugin.getInstance().getDescription().getVersion() + ")"); Bukkit.getLogger().info("§6The newest version is §f" + version); Bukkit.getLogger().info("§6Download the new version here: §fhttps://www.spigotmc.org/resources/ecoenchants.79573/"); }, 0, 36000); @@ -419,7 +419,7 @@ public class Loader { Reload Data */ - Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> { + Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> { Bukkit.getLogger().info("Reloading..."); CommandEcoreload.reload(); }, 2); @@ -432,7 +432,7 @@ public class Loader { } /** - * Called by {@link Main#onDisable()} + * Called by {@link EcoEnchantsPlugin#onDisable()} */ public static void unload() { Bukkit.getLogger().info("§cDisabling EcoEnchants..."); diff --git a/Plugin/src/main/resources/plugin.yml b/Plugin/src/main/resources/plugin.yml index 7ec84989..a696aea8 100644 --- a/Plugin/src/main/resources/plugin.yml +++ b/Plugin/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: EcoEnchants version: ${project.parent.version} -main: com.willfp.ecoenchants.Main +main: com.willfp.ecoenchants.EcoEnchantsPlugin api-version: 1.15 authors: [Auxilor] website: willfp.com