From 8034d8852aec2b17e1bfde20805fc027c4f76e79 Mon Sep 17 00:00:00 2001
From: Jkobs <66284145+Minzilein2003@users.noreply.github.com>
Date: Thu, 10 Nov 2022 11:28:55 +0100
Subject: [PATCH 1/8] New Updater
---
pom.xml | 13 ++++
.../SPIGOT/api/messages/T2Ctemplate.java | 2 +-
.../SPIGOT/api/update/T2CupdateAPI.java | 31 ++++----
.../SPIGOT/api/update/T2CupdateChecker.java | 76 ++++++++++---------
.../SPIGOT/api/update/T2CupdateObject.java | 9 +--
.../SPIGOT/api/update/T2CupdateWebData.java | 31 ++++++++
.../SPIGOT/system/T2CodeLibMain.java | 2 +-
7 files changed, 106 insertions(+), 58 deletions(-)
create mode 100644 src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java
diff --git a/pom.xml b/pom.xml
index b8a3786..a58e9d2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -147,5 +147,18 @@
adventure-platform-bukkit
4.1.2
+
+
+ org.projectlombok
+ lombok
+ 1.18.24
+ provided
+
+
+
+ org.json
+ json
+ 20220924
+
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 5f9084f..4aba421 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
@@ -82,7 +82,7 @@ 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()).publicVersion;
+ String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getTag_name();
boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
boolean player = sender instanceof Player;
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 afb48d6..932405a 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
@@ -29,7 +29,7 @@ public class T2CupdateAPI {
}.runTaskLaterAsynchronously(plugin, 20L);
return;
}
- String publicVersion = pluginVersions.get(plugin.getName()).publicVersion;
+ String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
String pluginVersion = plugin.getDescription().getVersion();
if (pluginVersion.equals(publicVersion)) return;
new BukkitRunnable() {
@@ -41,7 +41,7 @@ public class T2CupdateAPI {
}
public static void sendUpdateMsg(String prefix, Integer spigotID, String discord, Plugin plugin, Player player) {
- String publicVersion = pluginVersions.get(plugin.getName()).publicVersion;
+ String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
String pluginVersion = plugin.getDescription().getVersion();
if (publicVersion.equals("§4No public version found!")) {
return;
@@ -67,15 +67,16 @@ public class T2CupdateAPI {
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
}
- public static void sendUpdateMsg(String prefix, Integer spigot, String discord, Plugin plugin) {
- String publicVersion = pluginVersions.get(plugin.getName()).publicVersion;
+ public static void sendUpdateMsg(String prefix, T2CupdateWebData data, String discord, Plugin plugin) {
+ String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
String pluginVersion = plugin.getDescription().getVersion();
String h = "§4=========== " + prefix + " §4===========";
String s1 = "";
String s2 = "§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion;
- String s3 = "§6You can download it here: §ehttps://www.spigotmc.org/resources/" + spigot;
+ String s3 = "§6You can download it here: §e" + data.getUpdateurl();
String s4 = "§6You can find more information on Discord: §e" + discord;
- if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) {
+ if (data.isPrerelease()) {
+ s1 = "§6A new §4Pre-Release§6 version was found!§r";
if (publicVersion.toLowerCase().contains("dev")) {
s1 = "§6A new §4DEV§6 version was found!§r";
}
@@ -92,35 +93,39 @@ public class T2CupdateAPI {
T2Csend.console(text);
}
- public static void onUpdateCheck(Plugin plugin, String prefix, int spigotID, String discord) {
+ public static void onUpdateCheck(Plugin plugin, String prefix, String discord, String RepoURL) {
+ if(!RepoURL.contains("?limit=1")){
+ RepoURL = RepoURL + "?limit=1";
+ }
+ String finalRepoURL = RepoURL;
new BukkitRunnable() {
@Override
public void run() {
- (new T2CupdateChecker((JavaPlugin) plugin, spigotID)).getVersion((update_version) -> {
+ (new T2CupdateChecker((JavaPlugin) plugin)).getVersion((webData) -> {
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
plugin.getDescription().getVersion(),
- update_version,
+ webData,
false
);
pluginVersions.put(plugin.getName(), update);
- if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
+ if (!plugin.getDescription().getVersion().equalsIgnoreCase(webData.getTag_name())) {
if (!update.load) {
new BukkitRunnable() {
@Override
public void run() {
update.load = true;
- sendUpdateMsg(prefix, spigotID, discord, plugin);
+ sendUpdateMsg(prefix, webData, discord, plugin);
}
}.runTaskLaterAsynchronously(plugin, 600L);
- } else sendUpdateMsg(prefix, spigotID, discord, plugin);
+ } else sendUpdateMsg(prefix, webData, discord, plugin);
} else {
if (!update.load){
T2Csend.console(prefix + " §2No update found.");
update.load = true;
}
}
- }, prefix, plugin.getDescription().getVersion());
+ }, prefix, plugin.getDescription().getVersion(), finalRepoURL);
}
}.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java
index 4cf9c7c..2b5376e 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java
@@ -2,62 +2,63 @@ package net.t2code.t2codelib.SPIGOT.api.update;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
+import org.json.JSONArray;
+import org.json.JSONObject;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.net.URL;
-import java.util.Scanner;
+import java.net.URLConnection;
import java.util.function.Consumer;
public class T2CupdateChecker {
private JavaPlugin plugin;
- private int resourceId;
- public T2CupdateChecker(JavaPlugin plugin, int resourceId) {
+ public T2CupdateChecker(JavaPlugin plugin) {
this.plugin = plugin;
- this.resourceId = resourceId;
}
- public void getVersion(Consumer consumer, String Prefix, String pluginVersion) {
+ public void getVersion(Consumer consumer, String Prefix, String pluginVersion, String URL) {
if (!plugin.isEnabled()) {
return;
}
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
try {
- InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
- try {
- Scanner scanner = new Scanner(inputStream);
-
- try {
- if (scanner.hasNext()) {
- consumer.accept(scanner.next());
- }
- } catch (Throwable var8) {
- try {
- scanner.close();
- } catch (Throwable var7) {
- var8.addSuppressed(var7);
- }
- throw var8;
- }
- scanner.close();
- } catch (Throwable var9) {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (Throwable var6) {
- var9.addSuppressed(var6);
- }
- }
- throw var9;
+ URL url = new URL(URL);
+ URLConnection yc = url.openConnection();
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(
+ yc.getInputStream()));
+ String inputLine;
+ String data = "";
+ while ((inputLine = in.readLine()) != null)
+ data = inputLine;
+ in.close();
+ data = data.substring(1, data.length() - 1);
+ if (data.isEmpty()) {
+ consumer.accept(null);
+ return;
}
- inputStream.close();
- } catch (IOException var10) {
+ JSONObject obj = new JSONObject(data);
+ String UpdateName = obj.getString("name");
+ String tag_name = obj.getString("tag_name");
+ String body = obj.getString("body");
+ String updateurl = obj.getString("url");
+ boolean prerelease = obj.getBoolean("prerelease");
+ String published_at = obj.getString("published_at");
+ JSONArray downloadArray = obj.getJSONArray("assets");
+ String downloadURL;
+ if (downloadArray.isEmpty()) {
+ downloadURL = "";
+ } else {
+ downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
+ }
+ T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, published_at, downloadURL, prerelease);
+ consumer.accept(webData);
+ } catch (Exception var10) {
Boolean load = false;
- if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())){
+ if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
}
-
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
pluginVersion,
@@ -69,4 +70,5 @@ public class T2CupdateChecker {
}
});
}
+
}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java
index 529d7ca..3bf0780 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java
@@ -5,19 +5,16 @@ public class T2CupdateObject {
public String pluginName;
public String pluginVersion;
- public String publicVersion;
- public String changeLog;
+ public T2CupdateWebData webData;
public Boolean load;
public T2CupdateObject(String pluginName,
String pluginVersion,
- String publicVersion ,
- String changeLog ,
+ T2CupdateWebData webData ,
Boolean load) {
this.pluginName = pluginName;
this.pluginVersion = pluginVersion;
- this.publicVersion = publicVersion;
- this.changeLog = changeLog;
+ this.webData = webData;
this.load=load;
}
}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java
new file mode 100644
index 0000000..f635232
--- /dev/null
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java
@@ -0,0 +1,31 @@
+package net.t2code.t2codelib.SPIGOT.api.update;
+
+import lombok.Getter;
+
+public class T2CupdateWebData {
+ @Getter
+ private String UpdateName;
+ @Getter
+ private String tag_name;
+ @Getter
+ private String body;
+ @Getter
+ private String updateurl;
+ @Getter
+ private String published_at;
+ @Getter
+ private String downloadURL;
+ @Getter
+ private boolean prerelease;
+
+ public T2CupdateWebData(String updateName, String tag_name, String body, String updateurl, String published_at, String downloadURL, boolean prerelease) {
+ UpdateName = updateName;
+ this.tag_name = tag_name;
+ this.body = body;
+ this.updateurl = updateurl;
+ this.published_at = published_at;
+ this.downloadURL = downloadURL;
+ this.prerelease = prerelease;
+ }
+}
+
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java
index d5f9cf8..821daf3 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java
@@ -90,7 +90,7 @@ public final class T2CodeLibMain extends JavaPlugin {
SelectLibConfig.onSelect();
SelectLibMsg.onSelect();
- T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getSpigotID(), Util.getDiscord());
+ T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getDiscord(), "https://git.t2code.net/api/v1/repos/JaTiTV/T2CodeLib/releases?limit=1");
Metrics.Bstats(plugin, Util.getBstatsID());
if (SelectLibConfig.getBungee()){
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
--
2.34.1
From 3bdbaacd64dadbd654b109b85301c25d3b4d5923 Mon Sep 17 00:00:00 2001
From: JaTiTV
Date: Thu, 10 Nov 2022 14:00:59 +0100
Subject: [PATCH 2/8] uc
---
.../SPIGOT/api/messages/T2CminiMessage.java | 8 +-
.../SPIGOT/api/messages/T2Ctemplate.java | 2 +-
.../SPIGOT/api/update/T2CupdateAPI.java | 74 ++++++++++++-----
.../SPIGOT/api/update/T2CupdateChecker.java | 76 +++++++++---------
.../api/update/T2CupdateCheckerGit.java | 80 +++++++++++++++++++
.../SPIGOT/api/update/T2CupdateObject.java | 4 +-
.../SPIGOT/api/update/T2CupdateWebData.java | 22 ++---
.../SPIGOT/system/T2CodeLibMain.java | 8 +-
src/main/java/net/t2code/t2codelib/Util.java | 3 +
9 files changed, 198 insertions(+), 79 deletions(-)
create mode 100644 src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2CminiMessage.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2CminiMessage.java
index e654ca2..bd07d51 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2CminiMessage.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2CminiMessage.java
@@ -1,5 +1,6 @@
package net.t2code.t2codelib.SPIGOT.api.messages;
+import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
@@ -8,17 +9,18 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class T2CminiMessage {
+ private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
public static void miniMessage(String msg, CommandSender sender) {
- T2CodeLibMain.adventure().sender(sender).sendMessage(replace(msg));
+ bukkitAudiences.sender(sender).sendMessage(replace(msg));
}
public static void sendMiniMessage(String msg) {
- T2CodeLibMain.adventure().console().sendMessage(replace(msg));
+ bukkitAudiences.console().sendMessage(replace(msg));
}
public static void miniMessage(String msg, Player player) {
- T2CodeLibMain.adventure().player(player).sendMessage(replace(msg));
+ bukkitAudiences.player(player).sendMessage(replace(msg));
}
protected static Component replace(String text) {
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 4aba421..b61d131 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
@@ -82,7 +82,7 @@ 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.getTag_name();
+ String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getTagName();
boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
boolean player = sender instanceof Player;
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 932405a..12f8104 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
@@ -29,19 +29,19 @@ public class T2CupdateAPI {
}.runTaskLaterAsynchronously(plugin, 20L);
return;
}
- String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
+ T2CupdateWebData webData = pluginVersions.get(plugin.getName()).webData;
String pluginVersion = plugin.getDescription().getVersion();
- if (pluginVersion.equals(publicVersion)) return;
+ if (pluginVersion.equals(webData.getTagName())) return;
new BukkitRunnable() {
@Override
public void run() {
- sendUpdateMsg(prefix, spigotID, discord, plugin, player);
+ sendUpdateMsg(prefix, webData, discord, plugin, player);
}
}.runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), 200L);
}
- public static void sendUpdateMsg(String prefix, Integer spigotID, String discord, Plugin plugin, Player player) {
- String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
+ public static void sendUpdateMsg(String prefix, T2CupdateWebData webData, String discord, Plugin plugin, Player player) {
+ String publicVersion = webData.getTagName();
String pluginVersion = plugin.getDescription().getVersion();
if (publicVersion.equals("§4No public version found!")) {
return;
@@ -52,7 +52,9 @@ public class T2CupdateAPI {
"[dc]'>[prefix] You can find more information on Discord.
" +
"[prefix]";
String value = "";
- if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) {
+
+ if (webData.isPreRelease()) {
+ value = "Pre-Release ";
if (publicVersion.toLowerCase().contains("dev")) {
value = "DEV ";
}
@@ -63,19 +65,19 @@ public class T2CupdateAPI {
value = "SNAPSHOT ";
}
}
- T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", "https://www.spigotmc.org/resources/" + spigotID)
+ T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", webData.getUpdateUrl())
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
}
- public static void sendUpdateMsg(String prefix, T2CupdateWebData data, String discord, Plugin plugin) {
- String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
+ public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin) {
+ String publicVersion =webData.getTagName();
String pluginVersion = plugin.getDescription().getVersion();
String h = "§4=========== " + prefix + " §4===========";
String s1 = "";
String s2 = "§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion;
- String s3 = "§6You can download it here: §e" + data.getUpdateurl();
+ String s3 = "§6You can download it here: §e" + webData.getUpdateUrl();
String s4 = "§6You can find more information on Discord: §e" + discord;
- if (data.isPrerelease()) {
+ if (webData.isPreRelease()) {
s1 = "§6A new §4Pre-Release§6 version was found!§r";
if (publicVersion.toLowerCase().contains("dev")) {
s1 = "§6A new §4DEV§6 version was found!§r";
@@ -93,15 +95,49 @@ public class T2CupdateAPI {
T2Csend.console(text);
}
- public static void onUpdateCheck(Plugin plugin, String prefix, String discord, String RepoURL) {
- if(!RepoURL.contains("?limit=1")){
+ public static void onUpdateCheck(Plugin plugin, String prefix, Integer spigotID, String discord) {
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ (new T2CupdateChecker((JavaPlugin) plugin, spigotID)).getVersion((update_version) -> {
+ T2CupdateObject update = new T2CupdateObject(
+ plugin.getName(),
+ plugin.getDescription().getVersion(),
+ new T2CupdateWebData("OLD", update_version, "", "https://www.spigotmc.org/resources/" + spigotID, "",
+ "https://www.spigotmc.org/resources/" + spigotID, false),
+ false
+ );
+ pluginVersions.put(plugin.getName(), update);
+ if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
+ if (!update.load) {
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ update.load = true;
+ sendUpdateMsg(prefix, discord, update.webData, plugin);
+ }
+ }.runTaskLaterAsynchronously(plugin, 600L);
+ } else sendUpdateMsg(prefix, discord, update.webData, plugin);
+ } else {
+ if (!update.load) {
+ T2Csend.console(prefix + " §2No update found.");
+ update.load = true;
+ }
+ }
+ }, prefix, plugin.getDescription().getVersion());
+ }
+ }.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
+ }
+
+ public static void onUpdateCheck(Plugin plugin, String prefix, String RepoURL, Integer spigotID, String discord) {
+ if (!RepoURL.contains("?limit=1")) {
RepoURL = RepoURL + "?limit=1";
}
String finalRepoURL = RepoURL;
new BukkitRunnable() {
@Override
public void run() {
- (new T2CupdateChecker((JavaPlugin) plugin)).getVersion((webData) -> {
+ (new T2CupdateCheckerGit((JavaPlugin) plugin)).getVersion((webData) -> {
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
plugin.getDescription().getVersion(),
@@ -109,23 +145,23 @@ public class T2CupdateAPI {
false
);
pluginVersions.put(plugin.getName(), update);
- if (!plugin.getDescription().getVersion().equalsIgnoreCase(webData.getTag_name())) {
+ if (!plugin.getDescription().getVersion().equalsIgnoreCase(webData.getTagName())) {
if (!update.load) {
new BukkitRunnable() {
@Override
public void run() {
update.load = true;
- sendUpdateMsg(prefix, webData, discord, plugin);
+ sendUpdateMsg(prefix, discord, webData, plugin);
}
}.runTaskLaterAsynchronously(plugin, 600L);
- } else sendUpdateMsg(prefix, webData, discord, plugin);
+ } else sendUpdateMsg(prefix, discord, webData, plugin);
} else {
- if (!update.load){
+ if (!update.load) {
T2Csend.console(prefix + " §2No update found.");
update.load = true;
}
}
- }, prefix, plugin.getDescription().getVersion(), finalRepoURL);
+ }, plugin.getDescription().getVersion(), spigotID, finalRepoURL);
}
}.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java
index 2b5376e..4cf9c7c 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateChecker.java
@@ -2,63 +2,62 @@ package net.t2code.t2codelib.SPIGOT.api.update;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import java.io.*;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
-import java.net.URLConnection;
+import java.util.Scanner;
import java.util.function.Consumer;
public class T2CupdateChecker {
private JavaPlugin plugin;
+ private int resourceId;
- public T2CupdateChecker(JavaPlugin plugin) {
+ public T2CupdateChecker(JavaPlugin plugin, int resourceId) {
this.plugin = plugin;
+ this.resourceId = resourceId;
}
- public void getVersion(Consumer consumer, String Prefix, String pluginVersion, String URL) {
+ public void getVersion(Consumer consumer, String Prefix, String pluginVersion) {
if (!plugin.isEnabled()) {
return;
}
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
try {
- URL url = new URL(URL);
- URLConnection yc = url.openConnection();
- BufferedReader in = new BufferedReader(
- new InputStreamReader(
- yc.getInputStream()));
- String inputLine;
- String data = "";
- while ((inputLine = in.readLine()) != null)
- data = inputLine;
- in.close();
- data = data.substring(1, data.length() - 1);
- if (data.isEmpty()) {
- consumer.accept(null);
- return;
+ InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
+ try {
+ Scanner scanner = new Scanner(inputStream);
+
+ try {
+ if (scanner.hasNext()) {
+ consumer.accept(scanner.next());
+ }
+ } catch (Throwable var8) {
+ try {
+ scanner.close();
+ } catch (Throwable var7) {
+ var8.addSuppressed(var7);
+ }
+ throw var8;
+ }
+ scanner.close();
+ } catch (Throwable var9) {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (Throwable var6) {
+ var9.addSuppressed(var6);
+ }
+ }
+ throw var9;
}
- JSONObject obj = new JSONObject(data);
- String UpdateName = obj.getString("name");
- String tag_name = obj.getString("tag_name");
- String body = obj.getString("body");
- String updateurl = obj.getString("url");
- boolean prerelease = obj.getBoolean("prerelease");
- String published_at = obj.getString("published_at");
- JSONArray downloadArray = obj.getJSONArray("assets");
- String downloadURL;
- if (downloadArray.isEmpty()) {
- downloadURL = "";
- } else {
- downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
- }
- T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, published_at, downloadURL, prerelease);
- consumer.accept(webData);
- } catch (Exception var10) {
+ inputStream.close();
+ } catch (IOException var10) {
Boolean load = false;
- if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
+ if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())){
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
}
+
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
pluginVersion,
@@ -70,5 +69,4 @@ public class T2CupdateChecker {
}
});
}
-
}
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
new file mode 100644
index 0000000..b8cdaa1
--- /dev/null
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java
@@ -0,0 +1,80 @@
+package net.t2code.t2codelib.SPIGOT.api.update;
+
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.function.Consumer;
+
+public class T2CupdateCheckerGit {
+ private JavaPlugin plugin;
+
+ public T2CupdateCheckerGit(JavaPlugin plugin) {
+ this.plugin = plugin;
+ }
+
+ public void getVersion(Consumer consumer, String pluginVersion, Integer spigotID, String URL) {
+ if (!plugin.isEnabled()) {
+ return;
+ }
+ Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
+ try {
+ URL url = new URL(URL);
+ URLConnection yc = url.openConnection();
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(
+ yc.getInputStream()));
+ String inputLine;
+ String data = "";
+ while ((inputLine = in.readLine()) != null)
+ data = inputLine;
+ in.close();
+ data = data.substring(1, data.length() - 1);
+ if (data.isEmpty()) {
+ consumer.accept(null);
+ return;
+ }
+ JSONObject obj = new JSONObject(data);
+ String UpdateName = obj.getString("name");
+ String tag_name = obj.getString("tag_name");
+ String body = obj.getString("body");
+ String updateurl = obj.getString("url");
+ boolean prerelease = obj.getBoolean("prerelease");
+ String published_at = obj.getString("published_at");
+ JSONArray downloadArray = obj.getJSONArray("assets");
+ String downloadURL;
+ if (downloadArray.isEmpty()) {
+ downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
+ } else {
+ downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
+ }
+
+ if (!prerelease) {
+ downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
+ updateurl = "https://www.spigotmc.org/resources/" + spigotID;
+ }
+
+ T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, published_at, downloadURL, prerelease);
+ consumer.accept(webData);
+ } catch (Exception var10) {
+ Boolean load = false;
+ if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
+ load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
+ }
+ T2CupdateObject update = new T2CupdateObject(
+ plugin.getName(),
+ pluginVersion,
+ null,
+ load
+ );
+ T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
+ this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java
index 3bf0780..1102d0c 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateObject.java
@@ -10,11 +10,11 @@ public class T2CupdateObject {
public T2CupdateObject(String pluginName,
String pluginVersion,
- T2CupdateWebData webData ,
+ T2CupdateWebData webData,
Boolean load) {
this.pluginName = pluginName;
this.pluginVersion = pluginVersion;
this.webData = webData;
- this.load=load;
+ this.load = load;
}
}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java
index f635232..b2afbf2 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateWebData.java
@@ -4,28 +4,28 @@ import lombok.Getter;
public class T2CupdateWebData {
@Getter
- private String UpdateName;
+ private String updateName;
@Getter
- private String tag_name;
+ private String tagName;
@Getter
private String body;
@Getter
- private String updateurl;
+ private String updateUrl;
@Getter
- private String published_at;
+ private String publishedAt;
@Getter
private String downloadURL;
@Getter
- private boolean prerelease;
+ private boolean preRelease;
- public T2CupdateWebData(String updateName, String tag_name, String body, String updateurl, String published_at, String downloadURL, boolean prerelease) {
- UpdateName = updateName;
- this.tag_name = tag_name;
+ public T2CupdateWebData(String updateName, String tagName, String body, String updateUrl, String publishedAt, String downloadURL, boolean preRelease) {
+ this.updateName = updateName;
+ this.tagName = tagName;
this.body = body;
- this.updateurl = updateurl;
- this.published_at = published_at;
+ this.updateUrl = updateUrl;
+ this.publishedAt = publishedAt;
this.downloadURL = downloadURL;
- this.prerelease = prerelease;
+ this.preRelease = preRelease;
}
}
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java
index 821daf3..9ac0fcf 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java
@@ -39,7 +39,7 @@ public final class T2CodeLibMain extends JavaPlugin {
plugin = this;
autor = plugin.getDescription().getAuthors();
version = plugin.getDescription().getVersion();
- this.adventure = BukkitAudiences.create(this);
+ adventure = BukkitAudiences.create(this);
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
String prefix = Util.getPrefix();
@@ -90,9 +90,9 @@ public final class T2CodeLibMain extends JavaPlugin {
SelectLibConfig.onSelect();
SelectLibMsg.onSelect();
- T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getDiscord(), "https://git.t2code.net/api/v1/repos/JaTiTV/T2CodeLib/releases?limit=1");
+ T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord());
Metrics.Bstats(plugin, Util.getBstatsID());
- if (SelectLibConfig.getBungee()){
+ if (SelectLibConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
}
@@ -155,7 +155,7 @@ public final class T2CodeLibMain extends JavaPlugin {
private static BukkitAudiences adventure;
- public static BukkitAudiences adventure() {
+ public BukkitAudiences getAdventure() {
if (adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
diff --git a/src/main/java/net/t2code/t2codelib/Util.java b/src/main/java/net/t2code/t2codelib/Util.java
index ea6ab55..88b48cf 100644
--- a/src/main/java/net/t2code/t2codelib/Util.java
+++ b/src/main/java/net/t2code/t2codelib/Util.java
@@ -16,6 +16,9 @@ public class Util {
public static Integer getSpigotID() {
return 96388;
}
+ public static String getGit() {
+ return "https://git.t2code.net/api/v1/repos/JaTiTV/T2CodeLib/releases?limit=1";
+ }
public static Integer getBstatsID() {
return 12518;
--
2.34.1
From eb466f0df1ec9161cecd19d52ab3092c71c774c9 Mon Sep 17 00:00:00 2001
From: Jkobs <66284145+Minzilein2003@users.noreply.github.com>
Date: Thu, 10 Nov 2022 18:27:55 +0100
Subject: [PATCH 3/8] Init
---
pom.xml | 7 ++++
.../t2codelib/SPIGOT/system/CmdExecuter.java | 35 ++++++++++++----
.../SPIGOT/system/CreateReportLog.java | 42 ++++++++++++++++---
3 files changed, 72 insertions(+), 12 deletions(-)
diff --git a/pom.xml b/pom.xml
index a58e9d2..7d61fa9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -160,5 +160,12 @@
json
20220924
+
+
+ org.apache.httpcomponents
+ httpmime
+ 4.3.1
+
+
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
index 7904140..41809cb 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
@@ -11,6 +11,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -24,7 +25,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
return false;
}
if (args.length == 0) {
- T2Ctemplate.sendInfo(sender,T2CodeLibMain.getPlugin(), Util.getSpigotID(),Util.getDiscord(),null, Util.getInfoText());
+ T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
return false;
}
switch (args[0].toLowerCase()) {
@@ -33,20 +34,40 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "pl":
case "version":
case "ver":
- T2Ctemplate.sendInfo(sender,T2CodeLibMain.getPlugin(), Util.getSpigotID(),Util.getDiscord(),null, Util.getInfoText());
+ T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
return false;
case "reloadconfig":
SelectLibConfig.onSelect();
return false;
case "debug":
- if (args.length != 2) {
+ if (args.length < 2) {
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false;
}
- if ("createreportlog".equals(args[1].toLowerCase())) {
- CreateReportLog.create(sender);
- } else T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
- return false;
+ switch (args[1].toLowerCase()) {
+ case "createreportlog":
+ try {
+ CreateReportLog.create(sender);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ break;
+ case "deleteReportLog":
+ if(args.length != 3){
+ T2Csend.sender(sender, "§4Use: §7/t2code debug deleteReportLog [id]");
+ return false;
+ }
+ try {
+ CreateReportLog.delete(args[2]);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ break;
+ default:
+ T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog/deleteReportLog");
+ break;
+ }
+ return false;
default:
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
index a1a91da..46c0b15 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
@@ -5,13 +5,23 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.Util;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.MultipartEntity;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
-
+import org.json.JSONObject;
import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -19,7 +29,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class CreateReportLog {
- protected static void create(CommandSender sender) {
+ protected static void create(CommandSender sender) throws IOException {
T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog is created...");
String timeStampFile = new SimpleDateFormat("HH_mm_ss-dd_MM_yyyy").format(Calendar.getInstance().getTime());
@@ -113,10 +123,26 @@ public class CreateReportLog {
e.printStackTrace();
}
file.delete();
+ HttpClient httpclient = new DefaultHttpClient();
+ HttpPost httppost = new HttpPost("https://debug.t2code.net/uploadFile");
+ File zipFile = new File(zipPath);
+ FileBody bin = new FileBody(zipFile);
+ MultipartEntity reqEntity = new MultipartEntity();
+ reqEntity.addPart("file", bin);
+ httppost.setEntity(reqEntity);
+ HttpResponse response = httpclient.execute(httppost);
+ HttpEntity resEntity = response.getEntity();
+ String responseString = EntityUtils.toString(resEntity, "UTF-8");
+ JSONObject obj = new JSONObject(responseString);
+ String downloadURL = obj.getString("fileDownloadUri");
+ String fileID = obj.getString("fileID");
+ String fileType = obj.getString("fileType");
+ Integer fileSize = obj.getInt("size");
+ zipFile.delete();
if (sender instanceof Player) {
- T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
- T2Csend.console(Util.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
- } else T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
+ T2Csend.sender(sender, Util.getPrefix() + "A DebugLog zip has been created. You can download it here. Please enter the following key in the ticket: key
Do not share the download URL with anyone!
You can delte yor Debug-File by clicking me.".replace("key",fileID).replace("url",downloadURL));
+ T2Csend.console(Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following key in the ticket: §ekey.\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("key",fileID).replace("url",downloadURL));
+ } else T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following key in the ticket: §ekey.\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("key",fileID).replace("url",downloadURL));
}
@@ -183,4 +209,10 @@ public class CreateReportLog {
}
}
}
+
+ public static void delete(String arg) throws IOException {
+ URL url = new URL("https://debug.t2code.net/delte/" + arg);
+ HttpURLConnection con = (HttpURLConnection) url.openConnection();
+ con.setRequestMethod("GET");
+ }
}
--
2.34.1
From 855b0ee3cd88e098d30cee5629217f4ce6d36cf4 Mon Sep 17 00:00:00 2001
From: Jkobs <66284145+Minzilein2003@users.noreply.github.com>
Date: Thu, 10 Nov 2022 19:03:56 +0100
Subject: [PATCH 4/8] Update CmdExecuter.java
---
.../java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
index 41809cb..0e84900 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
@@ -99,6 +99,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
if (sender.hasPermission("t2code.admin")) {
if (hasPermission(p, arg1.get("debug")) && passend("debug", args[1])) {
list.add("createReportLog");
+ list.add("deleteReportLog");
}
}
return list;
--
2.34.1
From a15d667244b3836b1425613d9234161b5ee239b3 Mon Sep 17 00:00:00 2001
From: Jkobs <66284145+Minzilein2003@users.noreply.github.com>
Date: Thu, 10 Nov 2022 19:13:54 +0100
Subject: [PATCH 5/8] Update CmdExecuter.java
---
.../t2codelib/SPIGOT/system/CmdExecuter.java | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
index 29a9d22..9388b28 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CmdExecuter.java
@@ -47,20 +47,19 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
}
switch (args[1].toLowerCase()) {
case "createreportlog":
- Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
- @Override
- public void run() {
- try {
- CreateReportLog.create(sender);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- });
-
+ Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
+ @Override
+ public void run() {
+ try {
+ CreateReportLog.create(sender);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
break;
case "deleteReportLog":
- if(args.length != 3){
+ if (args.length != 3) {
T2Csend.sender(sender, "§4Use: §7/t2code debug deleteReportLog [id]");
return false;
}
@@ -74,7 +73,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog/deleteReportLog");
break;
}
- return false;
+ return false;
default:
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
--
2.34.1
From 8147a5a2b475183cb5a42f20ebf360591083a69d Mon Sep 17 00:00:00 2001
From: Jkobs <66284145+Minzilein2003@users.noreply.github.com>
Date: Thu, 10 Nov 2022 19:29:44 +0100
Subject: [PATCH 6/8] Update CreateReportLog.java
---
.../net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
index 46c0b15..c80f31e 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
@@ -141,7 +141,7 @@ public class CreateReportLog {
zipFile.delete();
if (sender instanceof Player) {
T2Csend.sender(sender, Util.getPrefix() + "A DebugLog zip has been created. You can download it here. Please enter the following key in the ticket: key
Do not share the download URL with anyone!
You can delte yor Debug-File by clicking me.".replace("key",fileID).replace("url",downloadURL));
- T2Csend.console(Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following key in the ticket: §ekey.\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("key",fileID).replace("url",downloadURL));
+ T2Csend.console(Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following Key in the ticket: §ekey.\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("key",fileID).replace("url",downloadURL));
} else T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following key in the ticket: §ekey.\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("key",fileID).replace("url",downloadURL));
}
--
2.34.1
From 55d7a4496c63ec70c253d7246a6b993b52b80557 Mon Sep 17 00:00:00 2001
From: JaTiTV
Date: Thu, 10 Nov 2022 21:37:15 +0100
Subject: [PATCH 7/8] Update Util.java
---
src/main/java/net/t2code/t2codelib/Util.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/net/t2code/t2codelib/Util.java b/src/main/java/net/t2code/t2codelib/Util.java
index 998dae2..cb018f4 100644
--- a/src/main/java/net/t2code/t2codelib/Util.java
+++ b/src/main/java/net/t2code/t2codelib/Util.java
@@ -38,7 +38,7 @@ public class Util {
"T2C-LuckyBox",
"WonderBagShop",
"CommandGUI",
- "T2C-OPSecurity",
+ // "T2C-OPSecurity",
"OPSecurity",
"PaPiTest",
"T2C-Alias",
--
2.34.1
From a2e8a672fa476a189ffa2fc1418ef14be85271e5 Mon Sep 17 00:00:00 2001
From: JaTiTV
Date: Sun, 13 Nov 2022 15:43:49 +0100
Subject: [PATCH 8/8] Update CreateReportLog.java
---
.../net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
index c80f31e..ca835c5 100644
--- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
+++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/CreateReportLog.java
@@ -141,8 +141,8 @@ public class CreateReportLog {
zipFile.delete();
if (sender instanceof Player) {
T2Csend.sender(sender, Util.getPrefix() + "A DebugLog zip has been created. You can download it here. Please enter the following key in the ticket: key
Do not share the download URL with anyone!
You can delte yor Debug-File by clicking me.".replace("key",fileID).replace("url",downloadURL));
- T2Csend.console(Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following Key in the ticket: §ekey.\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("key",fileID).replace("url",downloadURL));
- } else T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following key in the ticket: §ekey.\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("key",fileID).replace("url",downloadURL));
+ T2Csend.console(Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following key in the ticket: §e[key].\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("[key]",fileID).replace("url",downloadURL));
+ } else T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog zip has been created. You can download it here: url.\n§6Please enter the following key in the ticket: §e[key].\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog key.".replace("[key]",fileID).replace("url",downloadURL));
}
--
2.34.1