From d4f311493f0c9c86cc50fc98adea1edab9978137 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Sat, 18 Jun 2022 16:16:26 +0200 Subject: [PATCH] 12.2 - A new method has been added for Tab (tab(List matches, CommandSender sender, int arg, String[] args, HashMap permMap, Boolean onlinePlayer, String permForPlayer)). - The class net.t2code.lib.Spigot.Lib.player. NameHistory was added - Minor code changes --- .idea/misc.xml | 3 + pom.xml | 6 +- .../java/net/t2code/lib/Bungee/BMain.java | 8 +- .../t2code/lib/Spigot/Lib/commands/Tab.java | 17 +-- .../lib/Spigot/Lib/messages/HoverModule.java | 1 + .../Spigot/Lib/messages/T2CodeTemplate.java | 26 ++-- .../t2code/lib/Spigot/Lib/messages/send.java | 31 ++-- .../lib/Spigot/Lib/player/NameHistory.java | 143 ++++++++++++++++++ .../lib/Spigot/Lib/replace/Replace.java | 55 ++++--- .../t2code/lib/Spigot/system/T2CodeMain.java | 4 +- .../net/t2code/lib/Spigot/system/Vault.java | 6 +- .../Spigot/system/config/SelectLibConfig.java | 1 - 12 files changed, 232 insertions(+), 69 deletions(-) create mode 100644 src/main/java/net/t2code/lib/Spigot/Lib/player/NameHistory.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 3656e5e..1377757 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -16,4 +16,7 @@ + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6427e54..4c8d176 100644 --- a/pom.xml +++ b/pom.xml @@ -4,10 +4,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + 12.2 + + net.t2code - T2CodeLib - 12.1 jar + T2CodeLib T2CodeLib diff --git a/src/main/java/net/t2code/lib/Bungee/BMain.java b/src/main/java/net/t2code/lib/Bungee/BMain.java index 1a7ea3b..110d7c1 100644 --- a/src/main/java/net/t2code/lib/Bungee/BMain.java +++ b/src/main/java/net/t2code/lib/Bungee/BMain.java @@ -10,6 +10,7 @@ public final class BMain extends Plugin { public static Plugin plugin; public static String Version; + private static String orgVersion; public static String Autor; public static String Prefix = Util.getPrefix(); @@ -23,9 +24,12 @@ public final class BMain extends Plugin { public void onEnable() { // Plugin startup logic plugin = this; - Version = plugin.getDescription().getVersion(); + orgVersion = plugin.getDescription().getVersion(); Autor = plugin.getDescription().getAuthor(); - BLoad.onLoad(plugin, Prefix, Autor, Version, Spigot, Discord, SpigotID,BstatsID); + BLoad.onLoad(plugin, Prefix, Autor, orgVersion, Spigot, Discord, SpigotID,BstatsID); + String[] fv=orgVersion.split("_"); + plugin.getDescription().setVersion(fv[0]); + Version = plugin.getDescription().getVersion(); } @Override diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/commands/Tab.java b/src/main/java/net/t2code/lib/Spigot/Lib/commands/Tab.java index 28fd7e6..6abb6cd 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/commands/Tab.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/commands/Tab.java @@ -38,25 +38,22 @@ public class Tab { } } - //public static void tab(List matches,CommandSender sender, int arg, String[] args, HashMap permMap) { - // - // for (String command : permMap.keySet()) { - // if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) { - // matches.add(command); - // } - // } - //} - - public static void tab(List matches, CommandSender sender, int arg, String[] args, HashMap permMap) { + public static void tab(List matches, CommandSender sender, int arg, String[] args, HashMap permMap, Boolean onlinePlayer, String permForPlayer) { if (args.length == arg + 1) { for (String command : permMap.keySet()) { if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) { matches.add(command); + } else if (onlinePlayer != null && permForPlayer != null) { + tab(matches, sender, arg, args, permForPlayer, onlinePlayer); } } } } + public static void tab(List matches, CommandSender sender, int arg, String[] args, HashMap permMap) { + tab(matches, sender, arg, args, permMap, null, null); + } + public static void tab(List matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap permMap) { if (args.length == arg + 1) { if (args[argEquals].toLowerCase().equals(equalsValue)) { diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java b/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java index 9da52d9..f6bf1f3 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java @@ -1,6 +1,7 @@ package net.t2code.lib.Spigot.Lib.messages; import net.md_5.bungee.api.chat.ClickEvent; +import net.t2code.lib.Spigot.system.T2CodeMain; import org.bukkit.entity.Player; public class HoverModule { 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 27b939f..92e4c3d 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 @@ -6,6 +6,7 @@ import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion; 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 net.t2code.lib.Util; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -46,16 +47,19 @@ public class T2CodeTemplate { } send.console(prefix + " §4 §e-------------------"); - 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) { - e.printStackTrace(); + if (!(Util.getSnapshot() && spigot.equals(Util.getSpigot()))){ + 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-------------------"); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } } } + //onLoadSeparateStroke(prefix); return long_; } @@ -94,12 +98,14 @@ public class T2CodeTemplate { send.console(prefix + " §4Plugin successfully disabled."); } - public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List autor, String pluginVersion, String publicVersion, Boolean isPremium) { + public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List autor, String pluginVersion, String publicVersion, + Boolean isPremium) { send.sender(sender, prefix + "§4======= " + prefix + " §4======="); send.sender(sender, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", "")); if (sender instanceof Player) { - if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15) { + if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || + MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15) { send.sender(sender, prefix + " §2Version: §6" + pluginVersion); } else { TextComponent comp2 = new TextBuilder(prefix + " §2Version: §6" + pluginVersion) diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java b/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java index 697e85d..192f178 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java @@ -18,54 +18,57 @@ public class send { Bukkit.getConsoleSender().sendMessage(msg); } - public static void player(Player player, String msg) { + public static void player( Player player, String msg) { if (msg == null || msg.contains("[empty]")) return; - HoverModule.module(msg,player); + HoverModule.module(msg, player); } - public static void title(Player player, String msg, String msg2) { + public static void title( Player player, String msg, String msg2) { if (msg == null || msg.contains("[empty]")) return; if (msg2 == null || msg2.contains("[empty]")) return; player.sendTitle(msg, msg2); } - public static void title(Player player, String msg, String msg2, int i, int i1, int i2) { + public static void title( Player player, String msg, String msg2, int i, int i1, int i2) { if (msg == null || msg.contains("[empty]")) return; if (msg2 == null || msg2.contains("[empty]")) return; player.sendTitle(msg, msg2, i, i1, i2); } - public static void sender(CommandSender sender, String msg) { + public static void sender( CommandSender sender, String msg) { if (msg == null || msg.contains("[empty]")) return; sender.sendMessage(msg); } - public static void debug(Plugin plugin, String msg) { + public static void debug( Plugin plugin, String msg) { debug(plugin, msg, null); } - public static void debug(Plugin plugin, String msg, Integer stage) { + public static void debug( Plugin plugin, String msg, Integer stage) { // if (!new File(Main.getPath(), "config.yml").exists()) return; if (stage == null) { - if (plugin.getConfig().getBoolean("Plugin.Debug")) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg); + if (plugin.getConfig().getBoolean("Plugin.Debug")) + Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg); return; } - if (plugin.getConfig().getInt("Plugin.Debug") >= stage) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg); + if (plugin.getConfig().getInt("Plugin.Debug") >= stage) + Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg); } - public static void debugmsg(Plugin plugin, String msg) { - Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG-MSG: §6" + msg); + public static void debugmsg(Plugin plugin, String msg) { + warning(plugin, ""); + Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg); } - public static void info(Plugin plugin, String msg) { + public static void info( Plugin plugin, String msg) { plugin.getLogger().log(Level.INFO, msg); } - public static void warning(Plugin plugin, String msg) { + public static void warning( Plugin plugin, String msg) { plugin.getLogger().log(Level.WARNING, msg); } - public static void error(Plugin plugin, String msg) { + public static void error( Plugin plugin, String msg) { plugin.getLogger().log(Level.SEVERE, msg); } } diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/player/NameHistory.java b/src/main/java/net/t2code/lib/Spigot/Lib/player/NameHistory.java new file mode 100644 index 0000000..28569b2 --- /dev/null +++ b/src/main/java/net/t2code/lib/Spigot/Lib/player/NameHistory.java @@ -0,0 +1,143 @@ +package net.t2code.lib.Spigot.Lib.player; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import com.google.gson.annotations.SerializedName; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Date; +import java.util.UUID; + + +public class NameHistory { + public static class NameLookup { + + /** + * The URL from Mojang API that provides the JSON String in response. + */ + private static final String LOOKUP_URL = "https://api.mojang.com/user/profiles/%s/names"; + + /** + * The URL from Mojang API to resolve the UUID of a player from their name. + */ + private static final String GET_UUID_URL = "https://api.mojang.com/users/profiles/minecraft/%s?t=0"; + private static final Gson JSON_PARSER = new Gson(); + + /** + *

NOTE: Avoid running this method Synchronously with the main thread!It blocks while attempting to get a response from Mojang servers!

+ * @param player The UUID of the player to be looked up. + * @return Returns an array of {@link PreviousPlayerNameEntry} objects, or null if the response couldn't be interpreted. + * @throws IOException {@link #getPlayerPreviousNames(String)} + */ + public static PreviousPlayerNameEntry[] getPlayerPreviousNames(UUID player) throws IOException { + return getPlayerPreviousNames(player.toString()); + } + + /** + *

NOTE: Avoid running this method Synchronously with the main thread! It blocks while attempting to get a response from Mojang servers!

+ * Alternative method accepting an 'OfflinePlayer' (and therefore 'Player') objects as parameter. + * @param player The OfflinePlayer object to obtain the UUID from. + * @return Returns an array of {@link PreviousPlayerNameEntry} objects, or null if the response couldn't be interpreted. + * @throws IOException {@link #getPlayerPreviousNames(UUID)} + */ + public static PreviousPlayerNameEntry[] getPlayerPreviousNames(OfflinePlayer player) throws IOException { + return getPlayerPreviousNames(player.getUniqueId()); + } + + /** + *

NOTE: Avoid running this method Synchronously with the main thread! It blocks while attempting to get a response from Mojang servers!

+ * Alternative method accepting an {@link OfflinePlayer} (and therefore {@link Player}) objects as parameter. + * @param uuid The UUID String to lookup + * @return Returns an array of {@link PreviousPlayerNameEntry} objects, or null if the response couldn't be interpreted. + * @throws IOException + */ + public static PreviousPlayerNameEntry[] getPlayerPreviousNames(String uuid) throws IOException { + if (uuid == null || uuid.isEmpty()) + return null; + String response = getRawJsonResponse(new URL(String.format(LOOKUP_URL, uuid))); + PreviousPlayerNameEntry[] names = JSON_PARSER.fromJson(response, PreviousPlayerNameEntry[].class); + return names; + } + + /** + * If you don't have the UUID of a player, this method will resolve it for you.
+ * The output of this method may be used directly with {@link #getPlayerPreviousNames(String)}.
+ * NOTE: as with the rest, this method opens a connection with a remote server, so running it synchronously will block the main thread which will lead to server lag. + * @param name The name of the player to lookup. + * @return A String which represents the player's UUID. Note: the uuid cannot be parsed to a UUID object directly, as it doesnt contain dashes. This feature will be implemented later + * @throws IOException Inherited by {@link BufferedReader#readLine()}, {@link BufferedReader#close()}, {@link URL}, {@link HttpURLConnection#getInputStream()} + */ + public static String getPlayerUUID(String name) throws IOException { + String response = getRawJsonResponse(new URL(String.format(GET_UUID_URL, name))); + JsonObject o = JSON_PARSER.fromJson(response, JsonObject.class); + if (o == null) + return null; + return o.get("id") == null ? null : o.get("id").getAsString(); + } + + /** + * This is a helper method used to read the response of Mojang's API webservers. + * @param u the URL to connect to + * @return a String with the data read. + * @throws IOException Inherited by {@link BufferedReader#readLine()}, {@link BufferedReader#close()}, {@link URL}, {@link HttpURLConnection#getInputStream()} + */ + private static String getRawJsonResponse(URL u) throws IOException { + HttpURLConnection con = (HttpURLConnection) u.openConnection(); + con.setDoInput(true); + con.setConnectTimeout(2000); + con.setReadTimeout(2000); + con.connect(); + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String response = in.readLine(); + in.close(); + return response; + } + + /** + * This class represents the typical response expected by Mojang servers when requesting the name history of a player. + */ + public class PreviousPlayerNameEntry { + private String name; + @SerializedName("changedToAt") + private long changeTime; + + /** + * Gets the player name of this entry. + * @return The name of the player. + */ + public String getPlayerName() { + return name; + } + + /** + * Get the time of change of the name. + *
Note: This will return 0 if the name is the original (initial) name of the player! Make sure you check if it is 0 before handling! + *
Parsing 0 to a Date will result in the date "01/01/1970".
+ * @return a timestamp in miliseconds that you can turn into a date or handle however you want :) + */ + public long getChangeTime() { + return changeTime; + } + + /** + * Check if this name is the name used to register the account (the initial/original name) + * @return a boolean, true if it is the the very first name of the player, otherwise false. + */ + public boolean isPlayersInitialName() { + return getChangeTime() == 0; + } + + @Override + public String toString() { + return "Name: " + name + " Date of change: " + new Date(changeTime).toString(); + } + } + + } +} \ No newline at end of file diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java b/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java index f253e32..61020c2 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java @@ -1,9 +1,15 @@ package net.t2code.lib.Spigot.Lib.replace; import me.clip.placeholderapi.PlaceholderAPI; +import net.t2code.lib.Spigot.Lib.messages.send; +import net.t2code.lib.Spigot.system.T2CodeMain; +import net.t2code.lib.Spigot.system.config.SelectLibConfig; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; import java.util.Collections; import java.util.List; @@ -12,29 +18,29 @@ public class Replace { public static String replace(String prefix, String Text) { return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü") .replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö") - .replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n"); + .replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n") + ; } - - public static String replace(String prefix,Player player, String Text) { + public static String replace(String prefix, Player player, String Text) { return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§") .replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö") - .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n")); + .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä") + .replace("[nl]", "\n")); } - public static List replace(String prefix, List Text) { List output = new ArrayList<>(); for (String input : Text) { output.add(input.replace("[prefix]", prefix).replace("&", "§") .replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö") - .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n")); + .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä") + .replace("[nl]", "\n")); } return output; } - - public static List replace(String prefix,Player player, List Text) { + public static List replace(String prefix, Player player, List Text) { List output = new ArrayList(); if (player == null) { return Collections.singletonList("player is null"); @@ -45,59 +51,58 @@ public class Replace { for (String input : Text) { output.add(PlaceholderAPI.setPlaceholders(player, input.replace("[prefix]", prefix).replace("&", "§") .replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö") - .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n"))); + .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä") + .replace("[nl]", "\n"))); } return output; } - - public static List replacePrice(String prefix,List Text, String price) { + public static List replacePrice(String prefix, List Text, String price) { List rp = new ArrayList(); for (String s : Text) { rp.add(s.replace("[prefix]", prefix).replace("&", "§") .replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö") - .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n") - .replace("[price]", String.valueOf(price))); + .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä") + .replace("[nl]", "\n").replace("[price]", String.valueOf(price))); } return rp; } - public static String removeColorCode(String value){ + public static String removeColorCode(String value) { String text = value.replace("&", "§"); - while(text.contains("§")){ + while (text.contains("§")) { int stelle = text.indexOf("§"); - if(text.length() >= stelle+2) { + if (text.length() >= stelle + 2) { text = text.substring(0, stelle) + text.substring(stelle + 2); - }else{ + } else { text = text.substring(0, stelle) + text.substring(stelle + 1); } } return (text); } - - public static List replacePrice(String prefix,Player player, List Text, String price) { + public static List replacePrice(String prefix, Player player, List Text, String price) { List rp = new ArrayList(); for (String s : Text) { rp.add(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix).replace("&", "§") .replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö") - .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n") + .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n") .replace("[price]", String.valueOf(price)))); } return rp; } + public static String replacePrice(String prefix, String Text, String price) { return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü") .replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö") - .replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price)).replace("[nl]","\n"); + .replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price)) + .replace("[nl]", "\n"); } - - public static String replacePrice(String prefix,Player player, String Text, String price) { + public static String replacePrice(String prefix, Player player, String Text, String price) { return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§") .replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö") .replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä") - .replace("[price]", String.valueOf(price)).replace("[nl]","\n")); + .replace("[price]", String.valueOf(price)).replace("[nl]", "\n")); } - } diff --git a/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java b/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java index b7da776..e0a6de8 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java +++ b/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java @@ -56,7 +56,7 @@ public final class T2CodeMain extends JavaPlugin { return eco; } - protected static void setEco(Economy eco) { + static void setEco(Economy eco) { T2CodeMain.eco = eco; } public static Permission getPerm() { @@ -160,7 +160,7 @@ public final class T2CodeMain extends JavaPlugin { LanguagesCreate.langCreate(); SelectLibConfig.onSelect(); SelectLibMsg.onSelect(prefix); - if (!Util.getSnapshot()) { + if (!Util.getSnapshot() || version.toLowerCase().contains("dev")) { UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord); Metrics.Bstats(plugin, bstatsID); } diff --git a/src/main/java/net/t2code/lib/Spigot/system/Vault.java b/src/main/java/net/t2code/lib/Spigot/system/Vault.java index db24803..64f26d8 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/Vault.java +++ b/src/main/java/net/t2code/lib/Spigot/system/Vault.java @@ -23,11 +23,11 @@ public class Vault { send.console(Util.getPrefix() + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); } else { connected = false; - send.console(Util.getPrefix() + " §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(Util.getPrefix() + " §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 = T2CodeMain.getPlugin().getServer().getServicesManager().getRegistration(Permission.class); if (perm != null) { @@ -36,7 +36,7 @@ public class Vault { } else { vaultEnable = false; connected = false; - send.console(Util.getPrefix() + " §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"); } } 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 7a51dd5..f5ee551 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 @@ -25,6 +25,5 @@ public class SelectLibConfig { Debug = yamlConfiguration.getBoolean("Plugin.Debug"); language = yamlConfiguration.getString("Plugin.language"); InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop"); - } }