diff --git a/.idea/libraries/Maven__org_bukkit_bukkit_1_13_1_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_bukkit_bukkit_1_13_1_R0_1_SNAPSHOT.xml index 63108e8..2de93e5 100644 --- a/.idea/libraries/Maven__org_bukkit_bukkit_1_13_1_R0_1_SNAPSHOT.xml +++ b/.idea/libraries/Maven__org_bukkit_bukkit_1_13_1_R0_1_SNAPSHOT.xml @@ -1,13 +1,13 @@ - + - + - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/T2CodeLib.iml b/T2CodeLib.iml index 3a72987..3a79f23 100644 --- a/T2CodeLib.iml +++ b/T2CodeLib.iml @@ -25,25 +25,24 @@ + + + + + + + + - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 54df8fc..608506f 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ T2CodeLib - Libarie from T2Code Plugins + Library from T2Code Plugins 1.8 UTF-8 diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/messages/T2CodeTemplate.java b/src/main/java/net/t2code/lib/Spigot/Lib/messages/T2CodeTemplate.java index 0bcaf4e..2c28775 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/messages/T2CodeTemplate.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/messages/T2CodeTemplate.java @@ -4,6 +4,7 @@ import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.TextComponent; import net.t2code.lib.Spigot.Lib.replace.Replace; import net.t2code.lib.Spigot.Lib.update.UpdateAPI; +import net.t2code.lib.Spigot.system.config.SelectLibConfig; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -46,6 +47,7 @@ public class T2CodeTemplate { if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) { send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!"); send.console(prefix + " §4 §e-------------------"); + if (SelectLibConfig.t2cTestDevelopment) return long_; try { Thread.sleep(5000); } catch (InterruptedException e) { 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 552fbf0..86967bb 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 @@ -25,34 +25,34 @@ public class UpdateAPI { public static HashMap PluginVersionen = new HashMap<>(); public static void join(Plugin plugin, String prefix, String perm, Player player, String spigot, String discord) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { - @Override - public void run() { - String pluginVersion = plugin.getDescription().getVersion(); - if (!player.hasPermission(perm) && !player.isOp()) { - return; + if (!SelectLibConfig.UpdateCheckOnJoin) { + return; + } + String pluginVersion = plugin.getDescription().getVersion(); + if (!player.hasPermission(perm) && !player.isOp()) { + return; + } + if (UpdateAPI.PluginVersionen.get(plugin.getName()) == null) { + new BukkitRunnable() { + @Override + public void run() { + join(plugin, prefix, perm, player, spigot, discord); } - if (UpdateAPI.PluginVersionen.get(plugin.getName()) == null) { - new BukkitRunnable() { - @Override - public void run() { - join(plugin, prefix, perm, player, spigot, discord); - } - }.runTaskLater(plugin, 20L); - } else use(plugin, prefix, player, pluginVersion, UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion, spigot, discord); - } - }); + }.runTaskLater(plugin, 20L); + return; + } + String publicVersion = UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion; + if (pluginVersion.equals(publicVersion)) { + return; + } + use(plugin, prefix, player, pluginVersion, publicVersion, spigot, discord); } private static void use(Plugin plugin, String prefix, Player player, String pluginVersion, String publicVersion, String spigot, String discord) { - Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + Bukkit.getScheduler().runTaskLater(plugin, new Runnable() { @Override public void run() { - if (!pluginVersion.equals(publicVersion)) { - if (SelectLibConfig.UpdateCheckOnJoin) { - UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, player); - } - } + UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, player); } }, 200L); } @@ -120,7 +120,7 @@ public class UpdateAPI { } public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord, Integer timeInMin) { - int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { + int taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() { public void run() { (new UpdateAPI((JavaPlugin) plugin, SpigotID)).getVersion((update_version) -> { UpdateObject update = new UpdateObject( diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java b/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java index d78e45c..5af9c76 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java @@ -5,6 +5,7 @@ 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.Spigot.system.languages.SelectLibMsg; +import net.t2code.lib.Util; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.RegisteredServiceProvider; @@ -20,7 +21,7 @@ public class Vault { 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); } - p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix); + p.sendMessage(prefix + "\n" + SelectLibMsg.vaultNotSetUp + "\n" + prefix); } else { return Main.eco.withdrawPlayer(p,price).transactionSuccess(); } @@ -33,7 +34,7 @@ public class Vault { 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); } - p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix); + p.sendMessage(prefix + "\n" + SelectLibMsg.vaultNotSetUp + "\n" + prefix); } else { return Main.eco.depositPlayer(p,price).transactionSuccess(); } @@ -49,14 +50,14 @@ public class Vault { Main.eco = eco.getProvider(); if (Main.eco != null) { connected = true; - send.console(Main.prefix + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + send.console(Util.getPrefix() + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } else { connected = false; - send.console(Main.prefix + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + send.console(Util.getPrefix() + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } } else { connected = false; - send.console(Main.prefix + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + 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); if (perm != null) { @@ -65,12 +66,12 @@ public class Vault { } else { vaultEnable = false; connected = false; - send.console(Main.prefix + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); + send.console(Util.getPrefix() + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } } public static void vaultDisable() { connected = false; - send.console(Main.prefix + " §4Vault / Economy successfully deactivated."); + send.console(Util.getPrefix() + " §4Vault / Economy successfully deactivated."); } } diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/yamlConfiguration/Config.java b/src/main/java/net/t2code/lib/Spigot/Lib/yamlConfiguration/Config.java index d31c4ff..1cf7218 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/yamlConfiguration/Config.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/yamlConfiguration/Config.java @@ -109,7 +109,7 @@ public class Config { try { return Sound.valueOf(selectSoundFromConfig); } catch (Exception e) { - send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix) + send.console("§4\n§4\n§4\n" + SelectLibMsg.soundNotFound.replace("[prefix]", prefix) .replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n"); return Sound.valueOf(sound); } 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 9769ca1..e2549ac 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 @@ -9,6 +9,7 @@ public class SelectLibConfig { public static Boolean UpdateCheckOnJoin; + public static Boolean t2cTestDevelopment; public static Integer UpdateCheckTimeInterval; public static Boolean Debug; public static String language; @@ -19,6 +20,7 @@ public class SelectLibConfig { YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin"); + t2cTestDevelopment = yamlConfiguration.getBoolean("t2cTestDevelopment"); UpdateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval"); Debug = yamlConfiguration.getBoolean("Plugin.Debug"); language = yamlConfiguration.getString("Plugin.language"); 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 43794dd..1eb191a 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 @@ -15,8 +15,8 @@ public class SelectLibMsg { public static String selectMSG; - public static String VaultNotSetUp; - public static String SoundNotFound; + public static String vaultNotSetUp; + public static String soundNotFound; public static void onSelect(String Prefix) { @@ -38,8 +38,8 @@ public class SelectLibMsg { } else selectMSG = SelectLibConfig.language; YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg); - VaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp")); - SoundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound")); + vaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp")); + soundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound")); send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); } diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 2d89408..e8a3af9 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -2,4 +2,4 @@ name: T2CodeLib version: ${project.version} main: net.t2code.lib.Bungee.BMain author: JaTiTV, Jkobs -description: Libarie from T2Code Plugins \ No newline at end of file +description: Library from T2Code Plugins \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4812f4f..14d20f1 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ main: net.t2code.lib.Spigot.system.Main api-version: 1.13 prefix: T2CodeLib authors: [ JaTiTV, Jkobs ] -description: Libarie from T2Code Plugins +description: Library from T2Code Plugins website: T2Code.net load: STARTUP softdepend: [ PlaceholderAPI, PlotSquared, CMI, CMILib, Vault, Economy, XConomy ]