diff --git a/pom.xml b/pom.xml
index 718b76a..0c74cbd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
net.t2code
T2CodeLib
- 15.6
+ 15.7
diff --git a/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java b/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java
index e03825d..0300fcd 100644
--- a/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java
+++ b/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java
@@ -50,20 +50,20 @@ public class T2CBupdateCheckerGit {
return;
}
JSONObject obj = new JSONObject(data);
- String UpdateName = obj.getString("name");
- String tag_name = obj.getString("tag_name");
- String body = obj.getString("body").replace("\n", "
").replace("\r", "").replace("'", "''");
- String updateurl = obj.getString("html_url");
- boolean prerelease = obj.getBoolean("prerelease");
+ String updateTitle = obj.getString("name");
+ String version = obj.getString("tag_name");
+ String updateDescription = obj.getString("body").replace("\n", "
").replace("\r", "").replace("'", "''");
+ String updateUrl = obj.getString("html_url");
+ boolean preRelease = obj.getBoolean("prerelease");
String date = obj.getString("published_at");
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
Date parsedDate = inputFormat.parse(date);
- String formattedDate = outputFormat.format(parsedDate);
+ String publishedAt = outputFormat.format(parsedDate);
JSONArray downloadArray = obj.getJSONArray("assets");
- String gitURL = updateurl;
+ String gitURL = updateUrl;
String downloadURL;
if (downloadArray.isEmpty()) {
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
@@ -71,12 +71,12 @@ public class T2CBupdateCheckerGit {
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
}
- if (!prerelease) {
+ if (!preRelease) {
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
- updateurl = "https://www.spigotmc.org/resources/" + spigotID;
+ updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
}
- T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
+ T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
consumer.accept(webData);
} catch (Exception var10) {
Boolean load = false;
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2Ctemplate.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2Ctemplate.java
index 8021d46..e561437 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2Ctemplate.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2Ctemplate.java
@@ -2,6 +2,8 @@ package net.t2code.t2codelib.SPIGOT.api.messages;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
+import net.t2code.t2codelib.T2CupdateWebData;
+import net.t2code.t2codelib.UpdateType;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -46,7 +48,7 @@ public class T2Ctemplate {
T2Csend.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!");
onLoadSeparateStroke(prefix);
- if (!SelectLibConfig.getT2cTestDevelopment()){
+ if (!SelectLibConfig.getT2cTestDevelopment()) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
@@ -69,8 +71,9 @@ public class T2Ctemplate {
}
public static void onLoadFooter(String prefix, Long long_, String v) {
- onLoadFooter(prefix,long_);
+ onLoadFooter(prefix, long_);
}
+
public static void onLoadFooter(String prefix, Long long_) {
onLoadSeparateStroke(prefix);
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
@@ -81,16 +84,14 @@ public class T2Ctemplate {
* @param autor
* @param spigot
* @param discord
- *
- * @deprecated reason this method is deprecated
- * {will be removed in next version}
- * use {@link #onDisable(Plugin)} instead like this:
+ * @deprecated reason this method is deprecated
+ * {will be removed in next version}
+ * use {@link #onDisable(String, Plugin)} instead like this:
*
*
*
* onDisable(getPlugin())
*
- *
*/
@Deprecated
public static void onDisable(String prefix, List autor, String version, String spigot, String discord) {
@@ -108,15 +109,32 @@ public class T2Ctemplate {
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
String pluginVersion = plugin.getDescription().getVersion();
- String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
- boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
- boolean player = sender instanceof Player;
+ String publicVersion = "";
+ boolean update;
+ String stNVersion;
+ T2CupdateWebData webData;
+ try {
+ webData = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData;
+ } catch (Exception ex) {
+ webData = null;
+ }
+ if (webData != null) {
+ publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
+ update = !publicVersion.equalsIgnoreCase(pluginVersion);
+
+ } else {
+ update = false;
+ }
+
+ boolean player = sender instanceof Player;
String stPlugin = "║ Plugin: [pl]".replace("[pl]", plugin.getName());
String stVersion = "║ Version: [ver]".replace("[ver]", pluginVersion);
String stAutor = "║ Autor(s): [autor]".replace("[autor]", plugin.getDescription().getAuthors().toString());
- String stNVersion = "║ Newest Version: [nver]".replace("[nver]", publicVersion);
- String stStable = "║ Stable version available: [up]".replace("[up]", update ? "YES" : "no");
+
+ String stUpdate = "║ New version available: [up]".replace("[up]", webData != null ? update ?
+ "YES" : "no" : "It could not be checked for updates!");
+ stNVersion = update ? "
║ Newest Version: [nver]".replace("[nver]",player ? "Click for the update information'>"+publicVersion+"":publicVersion) : "";
String stLinkPlayer = "║ Go to the Spigot page'>Spigot "
.replace("[slink]", "https://www.spigotmc.org/resources/" + spigotID)
+ "- Go to the T2Code Support Discord'>Discord"
@@ -124,16 +142,17 @@ public class T2Ctemplate {
String stLinkConsole = "║ Spigot: https://www.spigotmc.org/resources/" + spigotID + ""
+ "
║ Discord: " + discord + "";
String stLink = player ? stLinkPlayer : stLinkConsole;
- String pr = premiumVerified != null ? "
║ Premium verified: [pr]".replace("[pr]", premiumVerified ? "YES" : "NO") : "";
+ String pr = premiumVerified != null ? "
║ Premium verified: [pr]".replace("[pr]",
+ premiumVerified ? "YES" : "NO") : "";
- String stMSG = text == null || text.equals("") ? "" : "
║ " + text + "
";
- T2Csend.sender(sender, "╔════════════════════════════════"
+ String stMSG = text == null || text.equals("") ? "" : "
║ " + text;
+ T2Csend.sender(sender, "
╔════════════════════════════════"
+ "
" + stPlugin
+ + "
" + stVersion
+ stMSG
- + stVersion
+ "
" + stAutor
- + "
" + stNVersion
- + "
" + stStable
+ + "
" + stUpdate
+ + stNVersion
+ "
" + stLink
+ pr
+ "
╚════════════════════════════════");
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java
index ee0c7d3..e93a2c5 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java
@@ -6,6 +6,7 @@ import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import net.t2code.t2codelib.UpdateType;
import net.t2code.t2codelib.T2CupdateObject;
import net.t2code.t2codelib.T2CupdateWebData;
+import net.t2code.t2codelib.Util;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -68,44 +69,44 @@ public class T2CupdateAPI {
"[prefix] Click for more information'>Update information
" +
"[prefix]";
- String value;
+ String updateStatusVersion;
if (webData.isPreRelease()) {
//todo if (!SelectLibConfig.getSeePreReleaseUpdates()) return;
- value = UpdateType.PRERELEASE.text;
+ updateStatusVersion = UpdateType.PRERELEASE.text;
if (publicVersion.toLowerCase().contains("dev")) {
- value = UpdateType.DEVELOPMENT.text;
+ updateStatusVersion = UpdateType.DEVELOPMENT.text;
}
if (publicVersion.toLowerCase().contains("beta")) {
- value = UpdateType.BETA.text;
+ updateStatusVersion = UpdateType.BETA.text;
}
if (publicVersion.toLowerCase().contains("snapshot")) {
- value = UpdateType.SNAPSHOT.text;
+ updateStatusVersion = UpdateType.SNAPSHOT.text;
}
- } else value = UpdateType.STABLE.text;
+ } else updateStatusVersion = UpdateType.STABLE.text;
- T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", webData.getUpdateUrl())
+ T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", updateStatusVersion).replace("[link]", webData.getUpdateUrl())
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
}
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin) {
String publicVersion = webData.getVersion();
String pluginVersion = plugin.getDescription().getVersion();
- String value;
+ String updateStatusVersion;
if (webData.isPreRelease()) {
- value = UpdateType.PRERELEASE.text;
+ updateStatusVersion = UpdateType.PRERELEASE.text;
if (publicVersion.toLowerCase().contains("dev")) {
- value = UpdateType.DEVELOPMENT.text;
+ updateStatusVersion = UpdateType.DEVELOPMENT.text;
}
if (publicVersion.toLowerCase().contains("beta")) {
- value = UpdateType.BETA.text;
+ updateStatusVersion = UpdateType.BETA.text;
}
if (publicVersion.toLowerCase().contains("snapshot")) {
- value = UpdateType.SNAPSHOT.text;
+ updateStatusVersion = UpdateType.SNAPSHOT.text;
}
- } else value = UpdateType.STABLE.text;
+ } else updateStatusVersion = UpdateType.STABLE.text;
String h = "
╔══════════════" + prefix + "══════════════";
- String s1 = "
║ A new [value] version was found!".replace("[value]", value);
+ String s1 = "
║ A new [value] version was found!".replace("[value]", updateStatusVersion);
String s2 = "
║ Your version: " + pluginVersion + " - Current version: " + webData.getVersion() + "";
String s3 = "
║ You can download it here: " + webData.getUpdateUrl() + "";
String s4 = "
║ You can find more information on Discord: " + discord + "";
@@ -119,9 +120,13 @@ public class T2CupdateAPI {
try {
object = T2CupdateAPI.pluginVersions.get(args[1]);
} catch (Exception e) {
- return "Das Plugin " + args[1] + " gibts net"; // todo
+ return Util.getPrefix() + " The plugin " + args[1] + " is not registered in the update checker of T2Code!";
}
+ if (object == null) return Util.getPrefix() + " The plugin " + args[1] + " is not registered in the update checker of T2Code!";
T2CupdateWebData webData = object.webData;
+ if (webData == null) {
+ return Util.getPrefix() + " It could not be checked for updates with the plugin " + args[1] + "!";
+ }
String pluginName = T2CupdateAPI.pluginVersions.get(args[1]).pluginName;
String pluginVersion = T2CupdateAPI.pluginVersions.get(args[1]).pluginVersion;
@@ -162,7 +167,7 @@ public class T2CupdateAPI {
String text;
- text = "╔══════════════════════";
+ text = "
╔══════════════════════";
text = text + pluginNameString;
text = text + pluginVersionString;
text = text + updateInfoString.replace("[value]", object.updateAvailable ? "Update available" : "Info about your version");
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java
index 6af3098..25b8291 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java
@@ -15,6 +15,7 @@ import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Date;
import java.util.function.Consumer;
@@ -33,7 +34,7 @@ public class T2CupdateCheckerGit {
String finalRepoURL = RepoURL;
Integer finalInterval;
- if (timeInterval < 1){
+ if (timeInterval < 1) {
finalInterval = 1;
} else finalInterval = timeInterval;
@@ -98,19 +99,19 @@ public class T2CupdateCheckerGit {
return;
}
JSONObject obj = new JSONObject(data);
- String UpdateName = obj.getString("name");
- String tag_name = obj.getString("tag_name");
- String body = obj.getString("body").replace("\n", "
").replace("\r", "").replace("'", "''").replace("**", "");
- String updateurl = obj.getString("html_url");
- boolean prerelease = obj.getBoolean("prerelease");
+ String updateTitle = obj.getString("name");
+ String version = obj.getString("tag_name");
+ String updateDescription = obj.getString("body").replace("\n", "
").replace("\r", "").replace("'", "''").replace("**", "");
+ String updateUrl = obj.getString("html_url");
+ boolean preRelease = obj.getBoolean("prerelease");
String date = obj.getString("published_at");
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
Date parsedDate = inputFormat.parse(date);
- String formattedDate = outputFormat.format(parsedDate);
+ String publishedAt = outputFormat.format(parsedDate);
- String gitURL = updateurl;
+ String gitURL = updateUrl;
JSONArray downloadArray = obj.getJSONArray("assets");
String downloadURL;
if (downloadArray.isEmpty()) {
@@ -119,14 +120,14 @@ public class T2CupdateCheckerGit {
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
}
- if (!prerelease) {
+ if (!preRelease) {
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
- updateurl = "https://www.spigotmc.org/resources/" + spigotID;
+ updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
}
- T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
+ T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
consumer.accept(webData);
- } catch (Exception var10) {
+ } catch (Exception exception) {
Boolean load = false;
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
@@ -140,7 +141,9 @@ public class T2CupdateCheckerGit {
updateCheckOnJoin
);
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
- this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
+
+ T2Csend.error(this.plugin,"§4 Cannot look for updates: " + exception.getMessage());
+ exception.printStackTrace();
}
});
}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java
index e7becc8..54ed09a 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java
@@ -52,6 +52,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
}
Commands.updateInfo(sender, args);
return false;
+ // case "plugininfo": todo
+ // if (!sender.hasPermission("t2code.admin")) {
+ // T2Csend.sender(sender, "§4No Permission §8t2code.admin");
+ // return false;
+ // }
+ // Commands.updateInfo(sender, args);
+ // return false;
case "reloadconfig":
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
@@ -74,10 +81,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
}
Commands.test(sender, args);
return false;
- case "serverid":if (!sender.hasPermission("t2code.admin")) {
- T2Csend.sender(sender, "§4No Permission §8t2code.admin");
- return false;
- }
+ case "serverid":
+ if (!sender.hasPermission("t2code.admin")) {
+ T2Csend.sender(sender, "§4No Permission §8t2code.admin");
+ return false;
+ }
T2Csend.sender(sender, ("[prefix] T2C ServerID: copy'>" +
"[id]").replace("[prefix]", Util.getPrefix()).replace("[id]", String.valueOf(Util.getServerUUID())));
return false;
diff --git a/src/main/java/net/t2code/t2codelib/Util.java b/src/main/java/net/t2code/t2codelib/Util.java
index cb584f2..a802956 100644
--- a/src/main/java/net/t2code/t2codelib/Util.java
+++ b/src/main/java/net/t2code/t2codelib/Util.java
@@ -1,6 +1,7 @@
package net.t2code.t2codelib;
import lombok.Getter;
+import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import java.util.Arrays;
import java.util.List;
@@ -13,7 +14,7 @@ public class Util {
public static String getInfoText() {
- return "";
+ return "Description: "+T2CodeLibMain.getPlugin().getDescription().getDescription()+"" ;
}
public static String getPrefix() {
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 832cec0..229c15e 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -3,7 +3,7 @@ version: '${project.version}'
main: net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain
api-version: 1.13
prefix: T2CodeLib
-authors: [ JaTiTV, Jkobs ]
+authors: [ JaTiTV ]
description: Library from T2Code Plugins
website: https://spigotmc.org/resources/96388/
load: STARTUP