Refactoring
This commit is contained in:
@@ -3,7 +3,6 @@ package com.willfp.ecoenchants.loader;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.anvil.AnvilListeners;
|
||||
import com.willfp.ecoenchants.bstats.Metrics;
|
||||
import com.willfp.ecoenchants.command.commands.CommandEcodebug;
|
||||
import com.willfp.ecoenchants.command.commands.CommandEcoreload;
|
||||
import com.willfp.ecoenchants.command.commands.CommandEcoskip;
|
||||
@@ -14,7 +13,11 @@ import com.willfp.ecoenchants.display.packets.PacketOpenWindowMerchant;
|
||||
import com.willfp.ecoenchants.display.packets.PacketSetCreativeSlot;
|
||||
import com.willfp.ecoenchants.display.packets.PacketSetSlot;
|
||||
import com.willfp.ecoenchants.display.packets.PacketWindowItems;
|
||||
import com.willfp.ecoenchants.enchantments.*;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.util.EcoRunnable;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
||||
import com.willfp.ecoenchants.events.armorequip.ArmorListener;
|
||||
import com.willfp.ecoenchants.events.armorequip.DispenserArmorListener;
|
||||
import com.willfp.ecoenchants.events.entitydeathbyentity.EntityDeathByEntityListeners;
|
||||
@@ -36,8 +39,10 @@ import com.willfp.ecoenchants.naturalloot.LootPopulator;
|
||||
import com.willfp.ecoenchants.nms.BlockBreak;
|
||||
import com.willfp.ecoenchants.nms.Cooldown;
|
||||
import com.willfp.ecoenchants.nms.TridentStack;
|
||||
import com.willfp.ecoenchants.util.Logger;
|
||||
import com.willfp.ecoenchants.util.UpdateChecker;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
@@ -54,12 +59,12 @@ public class Loader {
|
||||
* Called by {@link EcoEnchantsPlugin#onEnable()}
|
||||
*/
|
||||
public static void load() {
|
||||
Bukkit.getLogger().info("==========================================");
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().info("Loading §aEcoEnchants");
|
||||
Bukkit.getLogger().info("Made by §aAuxilor§f - willfp.com");
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().info("==========================================");
|
||||
Logger.info("==========================================");
|
||||
Logger.info("");
|
||||
Logger.info("Loading §aEcoEnchants");
|
||||
Logger.info("Made by §aAuxilor§f - willfp.com");
|
||||
Logger.info("");
|
||||
Logger.info("==========================================");
|
||||
|
||||
/*
|
||||
Check for paper
|
||||
@@ -72,16 +77,16 @@ public class Loader {
|
||||
|
||||
if (!isPapermc) {
|
||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> {
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().info("----------------------------");
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().severe("You don't seem to be running paper!");
|
||||
Bukkit.getLogger().severe("Paper is strongly recommended for all servers,");
|
||||
Bukkit.getLogger().severe("and enchantments like Drill may not function properly without it");
|
||||
Bukkit.getLogger().severe("Download Paper from §fhttps://papermc.io");
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().info("----------------------------");
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
Logger.info("----------------------------");
|
||||
Logger.info("");
|
||||
Logger.error("You don't seem to be running paper!");
|
||||
Logger.error("Paper is strongly recommended for all servers,");
|
||||
Logger.error("and enchantments like Drill may not function properly without it");
|
||||
Logger.error("Download Paper from §fhttps://papermc.io");
|
||||
Logger.info("");
|
||||
Logger.info("----------------------------");
|
||||
Logger.info("");
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@@ -89,15 +94,15 @@ public class Loader {
|
||||
Load Configs
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Loading Configs...");
|
||||
Logger.info("Loading Configs...");
|
||||
ConfigManager.updateConfigs();
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Load ProtocolLib
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Loading ProtocolLib...");
|
||||
Logger.info("Loading ProtocolLib...");
|
||||
EcoEnchantsPlugin.getInstance().protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
new PacketOpenWindowMerchant().register();
|
||||
new PacketSetCreativeSlot().register();
|
||||
@@ -108,125 +113,125 @@ public class Loader {
|
||||
Load land management support
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Scheduling Integration Loading...");
|
||||
Logger.info("Scheduling Integration Loading...");
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> {
|
||||
|
||||
Bukkit.getLogger().info("Loading Integrations...");
|
||||
Logger.info("Loading Integrations...");
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) {
|
||||
AntigriefManager.registerAntigrief(new AntigriefWorldGuard());
|
||||
Bukkit.getLogger().info("WorldGuard: §aENABLED");
|
||||
Logger.info("WorldGuard: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("WorldGuard: §9DISABLED");
|
||||
Logger.info("WorldGuard: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("GriefPrevention")) {
|
||||
AntigriefManager.registerAntigrief(new AntigriefGriefPrevention());
|
||||
Bukkit.getLogger().info("GriefPrevention: §aENABLED");
|
||||
Logger.info("GriefPrevention: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("GriefPrevention: §9DISABLED");
|
||||
Logger.info("GriefPrevention: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("FactionsUUID")) {
|
||||
AntigriefManager.registerAntigrief(new AntigriefFactionsUUID());
|
||||
Bukkit.getLogger().info("FactionsUUID: §aENABLED");
|
||||
Logger.info("FactionsUUID: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("FactionsUUID: §9DISABLED");
|
||||
Logger.info("FactionsUUID: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("Towny")) {
|
||||
AntigriefManager.registerAntigrief(new AntigriefTowny());
|
||||
Bukkit.getLogger().info("Towny: §aENABLED");
|
||||
Logger.info("Towny: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Towny: §9DISABLED");
|
||||
Logger.info("Towny: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("Lands")) {
|
||||
AntigriefManager.registerAntigrief(new AntigriefLands());
|
||||
Bukkit.getLogger().info("Lands: §aENABLED");
|
||||
Logger.info("Lands: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Lands: §9DISABLED");
|
||||
Logger.info("Lands: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("Essentials")) {
|
||||
EssentialsManager.registerAntigrief(new IntegrationEssentials());
|
||||
Bukkit.getLogger().info("Essentials: §aENABLED");
|
||||
Logger.info("Essentials: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Essentials: §9DISABLED");
|
||||
Logger.info("Essentials: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("AAC")) {
|
||||
AnticheatManager.registerAnticheat(new AnticheatAAC());
|
||||
Bukkit.getLogger().info("AAC: §aENABLED");
|
||||
Logger.info("AAC: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("AAC: §9DISABLED");
|
||||
Logger.info("AAC: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("Matrix")) {
|
||||
AnticheatManager.registerAnticheat(new AnticheatMatrix());
|
||||
Bukkit.getLogger().info("Matrix: §aENABLED");
|
||||
Logger.info("Matrix: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Matrix: §9DISABLED");
|
||||
Logger.info("Matrix: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
|
||||
AnticheatManager.registerAnticheat(new AnticheatAAC());
|
||||
Bukkit.getLogger().info("NCP: §aENABLED");
|
||||
Logger.info("NCP: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("NCP: §9DISABLED");
|
||||
Logger.info("NCP: §9DISABLED");
|
||||
}
|
||||
|
||||
if(Bukkit.getPluginManager().isPluginEnabled("Spartan")) {
|
||||
AnticheatManager.registerAnticheat(new AnticheatAAC());
|
||||
Bukkit.getLogger().info("Spartan: §aENABLED");
|
||||
Logger.info("Spartan: §aENABLED");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Spartan: §9DISABLED");
|
||||
Logger.info("Spartan: §9DISABLED");
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
}, 1);
|
||||
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Load NMS
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Loading NMS APIs...");
|
||||
Logger.info("Loading NMS APIs...");
|
||||
|
||||
if(Cooldown.init()) {
|
||||
Bukkit.getLogger().info("Cooldown: §aSUCCESS");
|
||||
Logger.info("Cooldown: §aSUCCESS");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Cooldown: §cFAILURE");
|
||||
Bukkit.getLogger().severe("§cAborting...");
|
||||
Logger.info("Cooldown: §cFAILURE");
|
||||
Logger.error("§cAborting...");
|
||||
Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance());
|
||||
}
|
||||
|
||||
if(TridentStack.init()) {
|
||||
Bukkit.getLogger().info("Trident API: §aSUCCESS");
|
||||
Logger.info("Trident API: §aSUCCESS");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Trident API: §cFAILURE");
|
||||
Bukkit.getLogger().severe("§cAborting...");
|
||||
Logger.info("Trident API: §cFAILURE");
|
||||
Logger.error("§cAborting...");
|
||||
Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance());
|
||||
}
|
||||
|
||||
if(BlockBreak.init()) {
|
||||
Bukkit.getLogger().info("Block Break: §aSUCCESS");
|
||||
Logger.info("Block Break: §aSUCCESS");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Block Break: §cFAILURE");
|
||||
Bukkit.getLogger().severe("§cAborting...");
|
||||
Logger.info("Block Break: §cFAILURE");
|
||||
Logger.error("§cAborting...");
|
||||
Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance());
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Register Events
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Registering Events...");
|
||||
Logger.info("Registering Events...");
|
||||
Bukkit.getPluginManager().registerEvents(new ArmorListener(), EcoEnchantsPlugin.getInstance());
|
||||
Bukkit.getPluginManager().registerEvents(new DispenserArmorListener(), EcoEnchantsPlugin.getInstance());
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(), EcoEnchantsPlugin.getInstance());
|
||||
@@ -237,162 +242,149 @@ public class Loader {
|
||||
Bukkit.getPluginManager().registerEvents(new NaturalExpGainListeners(), EcoEnchantsPlugin.getInstance());
|
||||
Bukkit.getPluginManager().registerEvents(new VillagerListeners(), EcoEnchantsPlugin.getInstance());
|
||||
Bukkit.getPluginManager().registerEvents(new ArrowListeners(), EcoEnchantsPlugin.getInstance());
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Add Block Populators
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Scheduling Adding Block Populators...");
|
||||
Logger.info("Scheduling Adding Block Populators...");
|
||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> {
|
||||
Bukkit.getServer().getWorlds().forEach((world -> {
|
||||
world.getPopulators().add(new LootPopulator());
|
||||
}));
|
||||
}, 1);
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Load Extensions
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Loading Extensions...");
|
||||
Logger.info("Loading Extensions...");
|
||||
|
||||
ExtensionManager.loadExtensions();
|
||||
if(ExtensionManager.getLoadedExtensions().isEmpty()) {
|
||||
Bukkit.getLogger().info("§cNo extensions found");
|
||||
Logger.info("§cNo extensions found");
|
||||
} else {
|
||||
Bukkit.getLogger().info("Extensions Loaded:");
|
||||
Logger.info("Extensions Loaded:");
|
||||
ExtensionManager.getLoadedExtensions().forEach((extension, name) -> {
|
||||
Bukkit.getLogger().info("- " + name);
|
||||
Logger.info("- " + name);
|
||||
});
|
||||
}
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Create enchantment config files (for first time use)
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Creating Enchantment Configs...");
|
||||
Logger.info("Creating Enchantment Configs...");
|
||||
ConfigManager.updateEnchantmentConfigs();
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Load all enchantments, rarities, and targets
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Adding Enchantments to API...");
|
||||
Logger.info("Adding Enchantments to API...");
|
||||
EnchantmentRarity.update();
|
||||
EnchantmentTarget.update();
|
||||
if(EnchantmentRarity.getAll().size() == 0 || EnchantmentTarget.getAll().size() == 0) {
|
||||
Bukkit.getLogger().severe("§cError loading rarities or targets! Aborting...");
|
||||
Logger.error("§cError loading rarities or targets! Aborting...");
|
||||
Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance());
|
||||
return;
|
||||
} else {
|
||||
Bukkit.getLogger().info(EnchantmentRarity.getAll().size() + " Rarities Loaded:");
|
||||
Logger.info(EnchantmentRarity.getAll().size() + " Rarities Loaded:");
|
||||
EnchantmentRarity.getAll().forEach((rarity -> {
|
||||
Bukkit.getLogger().info("- " + rarity.getName() + ": Table Probability=" + rarity.getProbability() + ", Minimum Level=" + rarity.getMinimumLevel() + ", Villager Probability=" + rarity.getVillagerProbability() + ", Loot Probability=" + rarity.getLootProbability() + ", Has Custom Color=" + rarity.hasCustomColor());
|
||||
Logger.info("- " + rarity.getName() + ": Table Probability=" + rarity.getProbability() + ", Minimum Level=" + rarity.getMinimumLevel() + ", Villager Probability=" + rarity.getVillagerProbability() + ", Loot Probability=" + rarity.getLootProbability() + ", Has Custom Color=" + rarity.hasCustomColor());
|
||||
}));
|
||||
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
Bukkit.getLogger().info(EnchantmentTarget.getAll().size() + " Targets Loaded:");
|
||||
Logger.info(EnchantmentTarget.getAll().size() + " Targets Loaded:");
|
||||
EnchantmentTarget.getAll().forEach((target) -> {
|
||||
Bukkit.getLogger().info("- " + target.getName() + ": Materials=" + target.getMaterials().toString());
|
||||
Logger.info("- " + target.getName() + ": Materials=" + target.getMaterials().toString());
|
||||
});
|
||||
}
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
if (EcoEnchants.getAll().size() == 0) {
|
||||
Bukkit.getLogger().severe("§cError adding enchantments! Aborting...");
|
||||
Logger.error("§cError adding enchantments! Aborting...");
|
||||
Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance());
|
||||
return;
|
||||
} else {
|
||||
Bukkit.getLogger().info(EcoEnchants.getAll().size() + " Enchantments Loaded:");
|
||||
Logger.info(EcoEnchants.getAll().size() + " Enchantments Loaded:");
|
||||
EcoEnchants.getAll().forEach((ecoEnchant -> {
|
||||
if(ecoEnchant.getType().equals(EcoEnchant.EnchantmentType.SPECIAL)) {
|
||||
Bukkit.getLogger().info(ChatColor.translateAlternateColorCodes('&', ConfigManager.getLang().getString("special-color")) + "- " + ecoEnchant.getName() + ": " + ecoEnchant.getKey().toString());
|
||||
Logger.info(ChatColor.translateAlternateColorCodes('&', ConfigManager.getLang().getString("special-color")) + "- " + ecoEnchant.getName() + ": " + ecoEnchant.getKey().toString());
|
||||
} else if(ecoEnchant.getType().equals(EcoEnchant.EnchantmentType.ARTIFACT)) {
|
||||
Bukkit.getLogger().info(ChatColor.translateAlternateColorCodes('&', ConfigManager.getLang().getString("artifact-color")) + "- " + ecoEnchant.getName() + ": " + ecoEnchant.getKey().toString());
|
||||
Logger.info(ChatColor.translateAlternateColorCodes('&', ConfigManager.getLang().getString("artifact-color")) + "- " + ecoEnchant.getName() + ": " + ecoEnchant.getKey().toString());
|
||||
} else {
|
||||
Bukkit.getLogger().info("- " + ecoEnchant.getName() + ": " + ecoEnchant.getKey().toString());
|
||||
Logger.info("- " + ecoEnchant.getName() + ": " + ecoEnchant.getKey().toString());
|
||||
}
|
||||
}));
|
||||
}
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Load enchantment configs
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Loading Enchantment Configs...");
|
||||
Logger.info("Loading Enchantment Configs...");
|
||||
ConfigManager.updateEnchantmentConfigs();
|
||||
Bukkit.getLogger().info("");
|
||||
|
||||
/*
|
||||
Plugin Conflicts
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Checking Plugin Conflicts...");
|
||||
|
||||
if(Bukkit.getPluginManager().getPlugin("EnchantmentNumbers") != null) {
|
||||
Bukkit.getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin("EnchantmentNumbers"));
|
||||
Bukkit.getLogger().severe("EnchantmentNumbers conflicts with EcoEnchants");
|
||||
Bukkit.getLogger().severe("It has been disabled. Please uninstall it!");
|
||||
}
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Register Enchantments
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Registering Enchantments...");
|
||||
Logger.info("Registering Enchantments...");
|
||||
EcoEnchants.update();
|
||||
EnchantDisplay.update();
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Register Enchantment Listeners
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Registering Enchantment Listeners...");
|
||||
Logger.info("Registering Enchantment Listeners...");
|
||||
EcoEnchants.getAll().forEach((ecoEnchant -> {
|
||||
if(ecoEnchant.isEnabled()) {
|
||||
Bukkit.getPluginManager().registerEvents(ecoEnchant, EcoEnchantsPlugin.getInstance());
|
||||
}
|
||||
}));
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Register Enchantment Tasks
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Registering Enchantment Tasks...");
|
||||
Logger.info("Registering Enchantment Tasks...");
|
||||
EcoEnchants.getAll().forEach((ecoEnchant -> {
|
||||
if(ecoEnchant instanceof EcoRunnable) {
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(EcoEnchantsPlugin.getInstance(), (Runnable) ecoEnchant, 5, ((EcoRunnable) ecoEnchant).getTime());
|
||||
}
|
||||
}));
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
|
||||
/*
|
||||
Load Commands
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Loading Commands...");
|
||||
Logger.info("Loading Commands...");
|
||||
Bukkit.getPluginCommand("ecoreload").setExecutor(new CommandEcoreload());
|
||||
Bukkit.getPluginCommand("ecodebug").setExecutor(new CommandEcodebug());
|
||||
Bukkit.getPluginCommand("enchantinfo").setExecutor(new CommandEnchantinfo());
|
||||
Bukkit.getPluginCommand("ecoskip").setExecutor(new CommandEcoskip());
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Start bStats
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Hooking into bStats...");
|
||||
Logger.info("Hooking into bStats...");
|
||||
new Metrics(EcoEnchantsPlugin.getInstance(), 7666);
|
||||
Bukkit.getLogger().info("");
|
||||
Logger.info("");
|
||||
|
||||
/*
|
||||
Start update checker
|
||||
@@ -402,39 +394,39 @@ public class Loader {
|
||||
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("");
|
||||
Logger.info("----------------------------");
|
||||
Logger.info("");
|
||||
Logger.info("EcoEnchants Updater");
|
||||
Logger.info("");
|
||||
if (currentVersion.compareTo(mostRecentVersion) > 0 || currentVersion.equals(mostRecentVersion)) {
|
||||
Bukkit.getLogger().info("§aEcoEnchants is up to date! (Version " + EcoEnchantsPlugin.getInstance().getDescription().getVersion() + ")");
|
||||
Logger.info("§aEcoEnchants is up to date! (Version " + EcoEnchantsPlugin.getInstance().getDescription().getVersion() + ")");
|
||||
} else {
|
||||
EcoEnchantsPlugin.outdated = true;
|
||||
EcoEnchantsPlugin.newVersion = version;
|
||||
|
||||
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/");
|
||||
Logger.info("§6EcoEnchants is out of date! (Version " + EcoEnchantsPlugin.getInstance().getDescription().getVersion() + ")");
|
||||
Logger.info("§6The newest version is §f" + version);
|
||||
Logger.info("§6Download the new version here: §fhttps://www.spigotmc.org/resources/ecoenchants.79573/");
|
||||
}, 0, 36000);
|
||||
}
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().info("----------------------------");
|
||||
Logger.info("");
|
||||
Logger.info("----------------------------");
|
||||
});
|
||||
|
||||
/*
|
||||
Finish
|
||||
*/
|
||||
|
||||
Bukkit.getLogger().info("Loaded §aEcoEnchants!");
|
||||
Logger.info("Loaded §aEcoEnchants!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by {@link EcoEnchantsPlugin#onDisable()}
|
||||
*/
|
||||
public static void unload() {
|
||||
Bukkit.getLogger().info("§cDisabling EcoEnchants...");
|
||||
Bukkit.getLogger().info("Removing Block Populators...");
|
||||
Logger.info("§cDisabling EcoEnchants...");
|
||||
Logger.info("Removing Block Populators...");
|
||||
Bukkit.getServer().getWorlds().forEach((world -> {
|
||||
List<BlockPopulator> populators = new ArrayList<>(world.getPopulators());
|
||||
populators.forEach((blockPopulator -> {
|
||||
@@ -443,9 +435,9 @@ public class Loader {
|
||||
}
|
||||
}));
|
||||
}));
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().info("§cUnloading Extensions...");
|
||||
Logger.info("");
|
||||
Logger.info("§cUnloading Extensions...");
|
||||
ExtensionManager.unloadExtensions();
|
||||
Bukkit.getLogger().info("§fBye! :)");
|
||||
Logger.info("§fBye! :)");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user