package net.t2code.t2codelib.SPIGOT.system.cmd; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI; import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver; import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain; import net.t2code.t2codelib.Util; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.io.IOException; public class Commands { public static void info(CommandSender sender) { T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText()); } public static void debug(CommandSender sender, String[] args) { if (args.length < 2) { T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog"); return; } switch (args[1].toLowerCase()) { case "createreportlog": switch (args.length){ case 2: if (sender instanceof Player) { T2Csend.sender(sender, "The debug zip file is automatically uploaded to T2Code's servers
and automatically deleted " + "after 14 days!
The file can also be deleted manually by you via command!

Confirm the" + " upload'>upload | " + "Do not upload'>keep the file on your server"); } else T2Csend.sender(sender, "The debug zip file is automatically uploaded to T2Code's servers" + "
and automatically deleted after 14 days!" + "
The file can also be deleted manually by you via command!" + "
Confirm the upload with the command:" + "
/t2c debug createReportLog confirmupload" + "
Keep the file on your server and do not upload it with the command:" + "
/t2c debug createReportLog noupload"); break; case 3: Boolean upload = args[2].equalsIgnoreCase("confirmupload"); Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() { @Override public void run() { try { CreateReportLog.create(sender, upload); } catch (IOException e) { T2Csend.sender(sender, Util.getPrefix() + " An error occurred while creating a report log! Please look in the console!"); throw new RuntimeException(e); } } }); break; default: T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog"); return; } break; case "deletereportlog": if (args.length != 3) { T2Csend.sender(sender, "§4Use: §7/t2code debug deleteReportLog [id]"); return; } try { CreateReportLog.delete(args[2], sender); } catch (IOException e) { throw new RuntimeException(e); } break; default: T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog/deleteReportLog"); break; } } public static void updateInfo(CommandSender sender, String[] args) { T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player)); } }