mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-25 15:35:11 +01:00
Refactored Main to EcoEnchantsPlugin
This commit is contained in:
parent
0dd53c6fef
commit
87669de08a
@ -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;
|
||||
}
|
||||
}
|
@ -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());
|
||||
|
@ -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()));
|
||||
|
@ -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);
|
||||
}));
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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<String, Enchantment>) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(this.getKey().getKey(), this);
|
||||
}
|
||||
} catch (NoSuchFieldException | IllegalAccessException ignored) {}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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"))
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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...");
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user