small fix

This commit is contained in:
JaTiTV 2022-11-14 14:16:46 +01:00
parent ee07755493
commit 5857e02695
2 changed files with 16 additions and 11 deletions

View File

@ -149,12 +149,16 @@ public class CreateReportLog {
String fileType = obj.getString("fileType");
Integer fileSize = obj.getInt("size");
zipFile.delete();
directory.delete();
if (sender instanceof Player) {
T2Csend.sender(sender, Util.getPrefix() + "<green>A DebugLog zip has been created. You can download it <click:open_url:'[url]'><gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>. Please enter the following key in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green><br><dark_red>Do not share the download URL with anyone!</dark_red><br><click:run_command:'/t2code debug deleteReportLog [key]'><green>You can <b>delte </b>yor Debug-File by clicking me.</green></click>".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));
T2Csend.sender(sender, Util.getPrefix() + ("<green>A DebugLog zip has been created. You can download it <click:open_url:'[url]'>" +
"<gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>. Please enter the following key " +
"in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green>" +
"<br><dark_red>Do not share the download URL with anyone!</dark_red><br><click:run_command:'/t2code debug deleteReportLog [key]'>" +
"<green>You can <b>delte </b>yor Debug-File by clicking me.</green></click>").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));
ReportLogStorage.add(fileID);
}

View File

@ -2,6 +2,7 @@ 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.util.ArrayList;
@ -10,22 +11,22 @@ import java.util.List;
public class ReportLogStorage {
public static List<String> list = new ArrayList<>();
protected static File config = new File(T2CodeLibMain.getPath(),"T2CodeReportKeys.yml");
protected static File config = new File(T2CodeLibMain.getPath(), "/DebugLogs/T2CodeReportKeys.yml");
protected static YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
public static void add(String key){
public static void add(String key) {
list.add(key);
save();
}
public static void remove(String key){
public static void remove(String key) {
list.remove(key);
save();
}
public static void save(){
public static void save() {
if (list == null) return;
yamlConfiguration.set("Keys",list);
yamlConfiguration.set("Keys", list);
try {
yamlConfiguration.save(config);
@ -34,7 +35,7 @@ public class ReportLogStorage {
}
}
public static void load(){
public static void load() {
if (!config.exists()) return;
list = yamlConfiguration.getStringList("Keys");
}