Merge pull request 'Fixes and Changes' (#13) from Debug_Changes_and_Fixes into 13.4

Reviewed-on: #13
This commit is contained in:
JaTiTV 2022-11-14 13:05:04 +00:00
commit ee07755493
4 changed files with 15 additions and 11 deletions

View File

@ -97,8 +97,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
if (sender.hasPermission("t2code.admin")) {
if (hasPermission(p, arg1.get("debug"))) {
for (String st : ReportLogStorage.list){
String[] string = st.split(" - ");
if (passend(st,args[2])) list.add(string[0]);
if (passend(st,args[2])) list.add(st);
}
}
}

View File

@ -43,7 +43,7 @@ public class Commands {
return;
}
try {
CreateReportLog.delete(args[2]);
CreateReportLog.delete(args[2], sender);
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@ -155,7 +155,7 @@ public class CreateReportLog {
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));
ReportLogStorage.add(fileID +" - "+downloadURL);
ReportLogStorage.add(fileID);
}
private static void pluginToDebug(String pluginName, ZipOutputStream zip) throws IOException {
@ -222,10 +222,17 @@ public class CreateReportLog {
}
}
public static void delete(String arg) throws IOException {
URL url = new URL("https://debug.t2code.net/delte/" + arg);
public static void delete(String arg, CommandSender sender) throws IOException {
URL url = new URL("https://debug.t2code.net/delete/" + arg);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
int response = con.getResponseCode();
if(response == 200){
ReportLogStorage.remove(arg);
T2Csend.sender(sender,"<green>Deleted report: <yellow>" + arg);
}else {
T2Csend.sender(sender,"<green>Error while deleting report: <yellow>" + arg);
}
con.disconnect();
}
}

View File

@ -2,17 +2,15 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.List;
public class ReportLogStorage {
public static List<String> list = new ArrayList<>();
protected static File config = new File("T2CodeReportKeys.yml");
protected static File config = new File(T2CodeLibMain.getPath(),"T2CodeReportKeys.yml");
protected static YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
public static void add(String key){
@ -26,7 +24,7 @@ public class ReportLogStorage {
}
public static void save(){
if (list.isEmpty()) return;
if (list == null) return;
yamlConfiguration.set("Keys",list);
try {