diff --git a/T2CodeLib.iml b/T2CodeLib.iml index 3cfbbcd..d90d5da 100644 --- a/T2CodeLib.iml +++ b/T2CodeLib.iml @@ -24,25 +24,18 @@ - - - - - - - - - - - - + + + + + diff --git a/pom.xml b/pom.xml index 4aa9908..5835cb9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code T2CodeLib - 12.0 + 12.1 jar T2CodeLib @@ -84,8 +84,9 @@ org.spigotmc - spigot-api - 1.18-R0.1-SNAPSHOT + spigot + 1.19-R0.1-SNAPSHOT + remapped-mojang provided diff --git a/src/main/java/net/t2code/lib/Bungee/Lib/plugins/BPluginCheck.java b/src/main/java/net/t2code/lib/Bungee/Lib/plugins/BPluginCheck.java index c99a5e7..92c5792 100644 --- a/src/main/java/net/t2code/lib/Bungee/Lib/plugins/BPluginCheck.java +++ b/src/main/java/net/t2code/lib/Bungee/Lib/plugins/BPluginCheck.java @@ -3,7 +3,6 @@ package net.t2code.lib.Bungee.Lib.plugins; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.plugin.Plugin; import net.t2code.lib.Bungee.BMain; -import net.t2code.lib.Spigot.system.Main; import java.util.logging.Level; diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/eco/Eco.java b/src/main/java/net/t2code/lib/Spigot/Lib/eco/Eco.java index be1a308..d77597a 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/eco/Eco.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/eco/Eco.java @@ -1,8 +1,10 @@ package net.t2code.lib.Spigot.Lib.eco; +import com.bencodez.votingplugin.VotingPluginMain; +import com.bencodez.votingplugin.user.VotingPluginUser; import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.plugins.PluginCheck; -import net.t2code.lib.Spigot.system.Main; +import net.t2code.lib.Spigot.system.T2CodeMain; import net.t2code.lib.Spigot.system.languages.SelectLibMsg; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -13,20 +15,20 @@ public class Eco { public static boolean moneyRemove(String prefix, Player player, Double price) { if (vault(prefix, player)) { - return Main.eco.withdrawPlayer(player, price).transactionSuccess(); + return T2CodeMain.getEco().withdrawPlayer(player, price).transactionSuccess(); } return false; } public static boolean moneyAdd(String prefix, Player player, Double price) { if (vault(prefix, player)) { - return Main.eco.depositPlayer(player, price).transactionSuccess(); + return T2CodeMain.getEco().depositPlayer(player, price).transactionSuccess(); } return false; } private static boolean vault(String prefix, Player player) { - if (Main.eco == null) { + if (T2CodeMain.getEco() == null) { if (Bukkit.getPluginManager().getPlugin("Vault") == null) { send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " + "§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix); @@ -75,17 +77,17 @@ public class Eco { public static boolean votePointsRemove(String prefix, Player player, Integer amount) { if (votePlugin(prefix, player)) { - return Main.voteUserManager.getVotingPluginUser(player).removePoints(amount); + return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).removePoints(amount); } else return false; } public static boolean votePointsAdd(String prefix, Player player, Integer amount) { if (votePlugin(prefix, player)) { - Bukkit.getScheduler().runTaskAsynchronously(Main.plugin, new Runnable() { + Bukkit.getScheduler().runTaskAsynchronously(T2CodeMain.getPlugin(), new Runnable() { @Override public void run() { - Main.voteUserManager.getVotingPluginUser(player).addPoints(amount); + VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).addPoints(amount); } }); return true; diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/plugins/PluginCheck.java b/src/main/java/net/t2code/lib/Spigot/Lib/plugins/PluginCheck.java index 4be5055..7438042 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/plugins/PluginCheck.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/plugins/PluginCheck.java @@ -1,6 +1,6 @@ package net.t2code.lib.Spigot.Lib.plugins; -import net.t2code.lib.Spigot.system.Main; +import net.t2code.lib.Spigot.system.T2CodeMain; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; @@ -76,7 +76,7 @@ public class PluginCheck { plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!"); Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " + "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin."); - Main.plugin.getPluginLoader().disablePlugin(Main.plugin); + T2CodeMain.getPlugin().getPluginLoader().disablePlugin(T2CodeMain.getPlugin()); return true; } else return false; } diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java b/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java index 49edc9b..c0aa0c4 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java @@ -1,13 +1,8 @@ package net.t2code.lib.Spigot.Lib.update; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.TextComponent; - import net.t2code.lib.Spigot.Lib.messages.HoverModule; -import net.t2code.lib.Spigot.Lib.messages.TextBuilder; import net.t2code.lib.Spigot.Lib.messages.send; -import net.t2code.lib.Spigot.system.Main; import net.t2code.lib.Spigot.system.config.SelectLibConfig; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/net/t2code/lib/Spigot/system/CmdExecuter.java b/src/main/java/net/t2code/lib/Spigot/system/CmdExecuter.java index 8376121..5676623 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/CmdExecuter.java +++ b/src/main/java/net/t2code/lib/Spigot/system/CmdExecuter.java @@ -1,26 +1,16 @@ package net.t2code.lib.Spigot.system; -import net.md_5.bungee.protocol.packet.Commands; import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate; import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.update.UpdateAPI; import net.t2code.lib.Util; -import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URI; -import java.nio.file.*; import java.util.*; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; public class CmdExecuter implements CommandExecutor, TabCompleter { @@ -31,7 +21,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter { return false; } if (args.length == 0) { - T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion); + T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), T2CodeMain.getAutor(), T2CodeMain.getVersion(), UpdateAPI.PluginVersionen.get(T2CodeMain.getPlugin().getName()).publicVersion); return false; } switch (args[0].toLowerCase()) { @@ -40,7 +30,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter { case "pl": case "version": case "ver": - T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion); + T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), T2CodeMain.getAutor(), T2CodeMain.getVersion(), UpdateAPI.PluginVersionen.get(T2CodeMain.getPerm().getName()).publicVersion); return false; case "debug": if (args.length != 2) { diff --git a/src/main/java/net/t2code/lib/Spigot/system/CreateReportLog.java b/src/main/java/net/t2code/lib/Spigot/system/CreateReportLog.java index 7f0eaa6..7538389 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/CreateReportLog.java +++ b/src/main/java/net/t2code/lib/Spigot/system/CreateReportLog.java @@ -1,6 +1,5 @@ package net.t2code.lib.Spigot.system; -import net.t2code.lib.Spigot.Lib.eco.Vault; import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion; import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion; @@ -22,15 +21,15 @@ import java.util.zip.ZipOutputStream; public class CreateReportLog { protected static void create(CommandSender sender) { - send.sender(sender, Main.prefix + " §6A DebugLog is created..."); + send.sender(sender, T2CodeMain.getPrefix() + " §6A DebugLog is created..."); String timeStampFile = new SimpleDateFormat("HH_mm_ss-dd_MM_yyyy").format(Calendar.getInstance().getTime()); - File directory = new File(Main.getPath() + "/DebugLogs"); + File directory = new File(T2CodeMain.getPath() + "/DebugLogs"); if (!directory.exists()) { directory.mkdir(); } - File file = new File(Main.getPath(), "/DebugLogs/T2CodeLog.txt"); + File file = new File(T2CodeMain.getPath(), "/DebugLogs/T2CodeLog.txt"); PrintWriter pWriter = null; try { pWriter = new PrintWriter(new FileWriter(file.getPath())); @@ -51,17 +50,17 @@ public class CreateReportLog { if (Vault.vaultEnable) { pWriter.println("Vault: " + Bukkit.getPluginManager().getPlugin("Vault").getName() + " - " + Bukkit.getPluginManager().getPlugin("Vault").getDescription().getVersion()); } else pWriter.println("Vault: not connected"); - if (Main.eco != null) { - String st = Main.eco.getName(); - if (Main.eco.getName().equals("CMIEconomy")) st = "CMI"; + if (T2CodeMain.getEco() != null) { + String st = T2CodeMain.getEco().getName(); + if (T2CodeMain.getEco().getName().equals("CMIEconomy")) st = "CMI"; if (Bukkit.getPluginManager().getPlugin(st) != null) { - pWriter.println("Economy: " + Main.eco.isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion()); - } else pWriter.println("Economy: " + Main.eco.isEnabled() + " - " + st); + pWriter.println("Economy: " + T2CodeMain.getEco().isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion()); + } else pWriter.println("Economy: " + T2CodeMain.getEco().isEnabled() + " - " + st); } else pWriter.println("Economy: not connected via vault"); - if (Main.perm != null) { - if (Bukkit.getPluginManager().getPlugin(Main.perm.getName()) != null) { - pWriter.println("Permission: " + Main.perm.isEnabled() + " - " + Main.perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(Main.perm.getName()).getDescription().getVersion()); - } else pWriter.println("Permission: " + Main.perm.isEnabled() + " - " + Main.perm.getName()); + if (T2CodeMain.getPerm() != null) { + if (Bukkit.getPluginManager().getPlugin(T2CodeMain.getPerm().getName()) != null) { + pWriter.println("Permission: " + T2CodeMain.getPerm().isEnabled() + " - " + T2CodeMain.getPerm().getName() + " - " + Bukkit.getPluginManager().getPlugin(T2CodeMain.getPerm().getName()).getDescription().getVersion()); + } else pWriter.println("Permission: " + T2CodeMain.getPerm().isEnabled() + " - " + T2CodeMain.getPerm().getName()); } else pWriter.println("Permission: not connected via vault"); pWriter.println(); pWriter.println("Java: " + System.getProperty("java.version")); @@ -69,7 +68,7 @@ public class CreateReportLog { pWriter.println("System: " + System.getProperty("os.version")); pWriter.println("User Home: " + System.getProperty("user.home")); pWriter.println(); - pWriter.println("T2CodeLib: " + Main.plugin.getDescription().getVersion()); + pWriter.println("T2CodeLib: " + T2CodeMain.getPlugin().getDescription().getVersion()); pWriter.println(); if (PluginCheck.luckyBox()) { pWriter.println("T2C-PremiumPlugins: "); @@ -93,7 +92,7 @@ public class CreateReportLog { } } - String filePath = Main.getPath() + "/DebugLogs/T2CodeLog.txt"; + String filePath = T2CodeMain.getPath() + "/DebugLogs/T2CodeLog.txt"; String log = "logs/latest.log"; String zipPath = "plugins/T2CodeLib/DebugLogs/T2CLog-" + timeStampFile + ".zip"; try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(zipPath))) { @@ -128,9 +127,9 @@ public class CreateReportLog { } file.delete(); if (sender instanceof Player) { - send.sender(sender, Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath); - send.console(Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath); - } else send.sender(sender, Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath); + send.sender(sender, T2CodeMain.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath); + send.console(T2CodeMain.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath); + } else send.sender(sender, T2CodeMain.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath); } diff --git a/src/main/java/net/t2code/lib/Spigot/system/JoinEvent.java b/src/main/java/net/t2code/lib/Spigot/system/JoinEvent.java index 1a4f412..00d3c6b 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/JoinEvent.java +++ b/src/main/java/net/t2code/lib/Spigot/system/JoinEvent.java @@ -4,7 +4,6 @@ package net.t2code.lib.Spigot.system; import net.t2code.lib.Spigot.Lib.update.UpdateAPI; import net.t2code.lib.Util; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerLoginEvent; @@ -13,6 +12,6 @@ public class JoinEvent implements Listener { @EventHandler public void onJoinEvent(PlayerLoginEvent event) { - UpdateAPI.join(Main.plugin, Util.getPrefix(), "t2code.lib.updatemsg", event.getPlayer(), Main.spigot, Main.discord); + UpdateAPI.join(T2CodeMain.getPlugin(), Util.getPrefix(), "t2code.lib.updatemsg", event.getPlayer(), T2CodeMain.getSpigot(), T2CodeMain.getDiscord()); } } \ No newline at end of file diff --git a/src/main/java/net/t2code/lib/Spigot/system/Main.java b/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java similarity index 58% rename from src/main/java/net/t2code/lib/Spigot/system/Main.java rename to src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java index a7eab25..071b9e9 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/Main.java +++ b/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java @@ -1,12 +1,9 @@ package net.t2code.lib.Spigot.system; import com.bencodez.votingplugin.VotingPluginHooks; -import com.bencodez.votingplugin.VotingPluginMain; -import com.bencodez.votingplugin.advancedcore.AdvancedCorePlugin; import com.bencodez.votingplugin.user.UserManager; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.permission.Permission; -import net.t2code.lib.Spigot.Lib.eco.Vault; import net.t2code.lib.Spigot.Lib.items.ItemVersion; import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion; @@ -26,28 +23,77 @@ import org.bukkit.plugin.java.JavaPlugin; import java.io.File; import java.util.List; -public final class Main extends JavaPlugin { - - +public final class T2CodeMain extends JavaPlugin { public static File getPath() { return plugin.getDataFolder(); } - public static Main plugin; - public static Economy eco = null; - public static VotingPluginHooks votingPlugin = null; - public static UserManager voteUserManager = null; - public static Permission perm = null; + private static T2CodeMain plugin; + private static Economy eco = null; + private static Permission perm = null; - public static List autor; - public static String version; + private static List autor; + private static String version; - public static String prefix = Util.getPrefix(); - public static Integer spigotID = Util.getSpigotID(); - public static Integer bstatsID = Util.getBstatsID(); - public static String spigot = Util.getSpigot(); - public static String discord = Util.getDiscord(); + private static String prefix = Util.getPrefix(); + private static Integer spigotID = Util.getSpigotID(); + private static Integer bstatsID = Util.getBstatsID(); + private static String spigot = Util.getSpigot(); + private static String discord = Util.getDiscord(); + + private static Boolean load = false; + + public static String getDiscord() { + return discord; + } + + public static T2CodeMain getPlugin() { + return plugin; + } + + public static Economy getEco() { + return eco; + } + + protected static void setEco(Economy eco) { + T2CodeMain.eco = eco; + } + public static Permission getPerm() { + return perm; + } + + public static List getAutor() { + return autor; + } + + public static String getVersion() { + return version; + } + + public static String getPrefix() { + return prefix; + } + + public static Integer getSpigotID() { + return spigotID; + } + + public static Integer getBstatsID() { + return bstatsID; + } + + public static String getSpigot() { + return spigot; + } + + public static Boolean getLoad() { + return load; + } + + public static void setPerm(Permission perm) { + T2CodeMain.perm = perm; + } @Override public void onEnable() { @@ -84,34 +130,28 @@ public final class Main extends JavaPlugin { } } ItemVersion.scan(); - send.console(Main.prefix + " §3Server run on: §6" + MCVersion.isVersion + " / " + NMSVersion.isNMS); + send.console(T2CodeMain.prefix + " §3Server run on: §6" + MCVersion.isVersion + " / " + NMSVersion.isNMS); if (eco != null) { String st = eco.getName(); if (eco.getName().equals("CMIEconomy")) st = "CMI"; if (Bukkit.getPluginManager().getPlugin(st) != null) { - send.console(Main.prefix + " §3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" + + send.console(T2CodeMain.prefix + " §3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); - } else send.console(Main.prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); - } else send.console(Main.prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + } else send.console(T2CodeMain.prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + } else send.console(T2CodeMain.prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); if (perm != null) { if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) { - send.console(Main.prefix + " §3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion() + send.console(T2CodeMain.prefix + " §3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); - } else send.console(Main.prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms"); - } else send.console(Main.prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + } else send.console(T2CodeMain.prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + } else send.console(T2CodeMain.prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); if (PluginCheck.papi()) { - send.console(Main.prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + send.console(T2CodeMain.prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } - if (PluginCheck.votingPlugin()) { - votingPlugin = VotingPluginHooks.getInstance(); - voteUserManager = votingPlugin.getUserManager(); - send.console(Main.prefix + " §3VotingPlugin: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); - } - - Main.plugin.getCommand("t2code").setExecutor(new CmdExecuter()); + T2CodeMain.plugin.getCommand("t2code").setExecutor(new CmdExecuter()); ConfigCreate.configCreate(); LanguagesCreate.langCreate(); SelectLibConfig.onSelect(); @@ -125,6 +165,7 @@ public final class Main extends JavaPlugin { T2CodeTemplate.onLoadFooter(prefix, long_); } + @Override public void onDisable() { // Plugin shutdown logic diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/eco/Vault.java b/src/main/java/net/t2code/lib/Spigot/system/Vault.java similarity index 73% rename from src/main/java/net/t2code/lib/Spigot/Lib/eco/Vault.java rename to src/main/java/net/t2code/lib/Spigot/system/Vault.java index be9b10a..db24803 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/eco/Vault.java +++ b/src/main/java/net/t2code/lib/Spigot/system/Vault.java @@ -1,9 +1,8 @@ -package net.t2code.lib.Spigot.Lib.eco; +package net.t2code.lib.Spigot.system; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.permission.Permission; import net.t2code.lib.Spigot.Lib.messages.send; -import net.t2code.lib.Spigot.system.Main; import net.t2code.lib.Util; import org.bukkit.plugin.RegisteredServiceProvider; @@ -14,12 +13,12 @@ public class Vault { public static void loadVault() throws InterruptedException { long long_ = System.currentTimeMillis(); - if (Main.plugin.getServer().getPluginManager().getPlugin("Vault") != null) { + if (T2CodeMain.getPlugin().getServer().getPluginManager().getPlugin("Vault") != null) { vaultEnable = true; - RegisteredServiceProvider eco = Main.plugin.getServer().getServicesManager().getRegistration(Economy.class); + RegisteredServiceProvider eco = T2CodeMain.getPlugin().getServer().getServicesManager().getRegistration(Economy.class); if (eco != null) { - Main.eco = eco.getProvider(); - if (Main.eco != null) { + T2CodeMain.setEco(eco.getProvider()); + if (T2CodeMain.getEco() != null) { connected = true; send.console(Util.getPrefix() + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } else { @@ -30,9 +29,9 @@ public class Vault { connected = false; send.console(Util.getPrefix() + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } - RegisteredServiceProvider perm = Main.plugin.getServer().getServicesManager().getRegistration(Permission.class); + RegisteredServiceProvider perm = T2CodeMain.getPlugin().getServer().getServicesManager().getRegistration(Permission.class); if (perm != null) { - Main.perm = perm.getProvider(); + T2CodeMain.setPerm(perm.getProvider()); } } else { vaultEnable = false; diff --git a/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java b/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java index c7f1286..2f9dffe 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java +++ b/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java @@ -1,7 +1,7 @@ package net.t2code.lib.Spigot.system.config; import net.t2code.lib.Spigot.Lib.messages.send; -import net.t2code.lib.Spigot.system.Main; +import net.t2code.lib.Spigot.system.T2CodeMain; import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config; import org.bukkit.configuration.file.YamlConfiguration; @@ -31,12 +31,12 @@ public class ConfigCreate { public static void configCreate() { Long long_ = Long.valueOf(System.currentTimeMillis()); - if (new File(Main.getPath(), "config.yml").exists()){ - if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Main.prefix + " §5DEBUG: §6" + " §4config.yml are created / updated..."); - } else send.console(Main.prefix + " §4config.yml are created..."); + if (new File(T2CodeMain.getPath(), "config.yml").exists()){ + if (T2CodeMain.getPlugin().getConfig().getBoolean("Plugin.Debug")) send.console(T2CodeMain.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated..."); + } else send.console(T2CodeMain.getPrefix() + " §4config.yml are created..."); - File config = new File(Main.getPath(), "config.yml"); + File config = new File(T2CodeMain.getPath(), "config.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); Config.set("Plugin.UpdateCheck.OnJoin", UpdateCheckOnJoin, yamlConfiguration); @@ -64,7 +64,7 @@ public class ConfigCreate { e.printStackTrace(); } - send.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); + send.console(T2CodeMain.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); } } diff --git a/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java b/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java index e2549ac..7a51dd5 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java +++ b/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java @@ -1,6 +1,6 @@ package net.t2code.lib.Spigot.system.config; -import net.t2code.lib.Spigot.system.Main; +import net.t2code.lib.Spigot.system.T2CodeMain; import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; @@ -16,7 +16,7 @@ public class SelectLibConfig { public static Boolean InventoriesCloseByServerStop; public static void onSelect() { - File config = new File(Main.getPath(), "config.yml"); + File config = new File(T2CodeMain.getPath(), "config.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin"); diff --git a/src/main/java/net/t2code/lib/Spigot/system/languages/LanguagesCreate.java b/src/main/java/net/t2code/lib/Spigot/system/languages/LanguagesCreate.java index a1bfc8b..8f19231 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/languages/LanguagesCreate.java +++ b/src/main/java/net/t2code/lib/Spigot/system/languages/LanguagesCreate.java @@ -1,7 +1,7 @@ package net.t2code.lib.Spigot.system.languages; import net.t2code.lib.Spigot.Lib.messages.send; -import net.t2code.lib.Spigot.system.Main; +import net.t2code.lib.Spigot.system.T2CodeMain; import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; @@ -10,10 +10,10 @@ import java.io.File; import java.io.IOException; public class LanguagesCreate { - static Plugin plugin = Main.plugin; + static Plugin plugin = T2CodeMain.getPlugin(); public static void langCreate() { - send.debug(plugin,"§4Language files are created / updated..."); + send.debug(plugin, "§4Language files are created / updated..."); Long long_ = Long.valueOf(System.currentTimeMillis()); /** @@ -22,7 +22,7 @@ public class LanguagesCreate { * */ - File messagesEN = new File(Main.getPath(), "languages/english_messages.yml"); + File messagesEN = new File(T2CodeMain.getPath(), "languages/english_messages.yml"); YamlConfiguration yamlConfigurationEN = YamlConfiguration.loadConfiguration(messagesEN); Config.set("Plugin.VaultNotSetUp", MSG.EN_VaultNotSetUp, yamlConfigurationEN); @@ -32,7 +32,7 @@ public class LanguagesCreate { try { yamlConfigurationEN.save(messagesEN); } catch (IOException e) { - send.warning(Main.plugin,e.getMessage()); + send.warning(T2CodeMain.getPlugin(), e.getMessage()); e.printStackTrace(); } @@ -42,7 +42,7 @@ public class LanguagesCreate { * */ - File messagesDE = new File(Main.getPath(), "languages/german_messages.yml"); + File messagesDE = new File(T2CodeMain.getPath(), "languages/german_messages.yml"); YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE); Config.set("Plugin.VaultNotSetUp", MSG.DE_VotingPluginNotSetUp, yamlConfigurationDE); @@ -52,7 +52,7 @@ public class LanguagesCreate { try { yamlConfigurationDE.save(messagesDE); } catch (IOException e) { - send.warning(Main.plugin,e.getMessage()); + send.warning(T2CodeMain.getPlugin(), e.getMessage()); e.printStackTrace(); } @@ -62,7 +62,7 @@ public class LanguagesCreate { * */ - File messagesNO = new File(Main.getPath(), "languages/norwegian_messages.yml"); + File messagesNO = new File(T2CodeMain.getPath(), "languages/norwegian_messages.yml"); YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messagesNO); Config.set("Plugin.VaultNotSetUp", MSG.NO_VaultNotSetUp, yamlConfigurationNO); @@ -72,10 +72,10 @@ public class LanguagesCreate { try { yamlConfigurationNO.save(messagesNO); } catch (IOException e) { - send.warning(Main.plugin,e.getMessage()); + send.warning(T2CodeMain.getPlugin(), e.getMessage()); e.printStackTrace(); } - send.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); + send.console(T2CodeMain.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); } } diff --git a/src/main/java/net/t2code/lib/Spigot/system/languages/SelectLibMsg.java b/src/main/java/net/t2code/lib/Spigot/system/languages/SelectLibMsg.java index 277e97d..7f01bc5 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/languages/SelectLibMsg.java +++ b/src/main/java/net/t2code/lib/Spigot/system/languages/SelectLibMsg.java @@ -2,7 +2,7 @@ package net.t2code.lib.Spigot.system.languages; import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.replace.Replace; -import net.t2code.lib.Spigot.system.Main; +import net.t2code.lib.Spigot.system.T2CodeMain; import net.t2code.lib.Spigot.system.config.SelectLibConfig; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; @@ -10,8 +10,8 @@ import org.bukkit.plugin.Plugin; import java.io.File; public class SelectLibMsg { - private static Plugin plugin = Main.plugin; - private static String prefix = Main.prefix; + private static Plugin plugin = T2CodeMain.getPlugin(); + private static String prefix = T2CodeMain.getPrefix(); public static String selectMSG; @@ -26,7 +26,7 @@ public class SelectLibMsg { File msg; - msg = new File(Main.getPath(), "languages/" + SelectLibConfig.language + "_messages.yml"); + msg = new File(T2CodeMain.getPath(), "languages/" + SelectLibConfig.language + "_messages.yml"); if (!msg.isFile()) { send.console(Prefix); send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); @@ -34,7 +34,7 @@ public class SelectLibMsg { send.console(Prefix + " §6The default language §eEnglish §6is used!"); send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); send.console(Prefix); - msg = new File(Main.getPath(), "languages/" + "english_messages.yml"); + msg = new File(T2CodeMain.getPath(), "languages/" + "english_messages.yml"); selectMSG = "english"; } else selectMSG = SelectLibConfig.language; YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4c2ce41..3866129 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,14 +1,25 @@ name: T2CodeLib version: ${project.version} -main: net.t2code.lib.Spigot.system.Main +main: net.t2code.lib.Spigot.system.T2CodeMain api-version: 1.13 prefix: T2CodeLib authors: [ JaTiTV, Jkobs ] description: Library from T2Code Plugins website: T2Code.net +load: STARTUP +softdepend: + - VotingPlugin + - PlaceholderAPI + - PlotSquared + - CMI + - CMILib + - Vault + - Economy + - XConomy -softdepend: [ PlaceholderAPI, VotingPlugin, PlotSquared, CMI, CMILib, Vault, Economy, XConomy ] -loadbefore: [ T2C-Alias ] +loadbefore: + - T2C-Alias + - CommandGUI commands: t2code: