commands change

- add permission for '/t2c debug createReportLog'
- add '/t2c info'
pull/1/head
JaTiTV 5 months ago
parent
commit
3c6bb074d8
  1. 31
      src/main/java/net/t2code/lib/Spigot/system/CmdExecuter.java

31
src/main/java/net/t2code/lib/Spigot/system/CmdExecuter.java

@ -4,6 +4,7 @@ import net.md_5.bungee.protocol.packet.Commands; @@ -4,6 +4,7 @@ import net.md_5.bungee.protocol.packet.Commands;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import net.t2code.lib.Util;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -22,29 +23,36 @@ import java.util.zip.ZipEntry; @@ -22,29 +23,36 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class CmdExecuter implements CommandExecutor, TabCompleter {
private static Plugin plugin = Main.plugin;
private static String prefix = Main.prefix;
private static List autor = Main.autor;
private static String version = Main.version;
private static String spigot = Main.spigot;
private static String discord = Main.discord;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!sender.hasPermission("t2code.admin")){
send.sender(sender,"§4No Permission §8t2code.admin");
return false;
}
if (args.length == 0) {
T2CodeTemplate.sendInfo(sender, prefix, spigot, discord, autor, version, UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion);
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
} else {
switch (args[0].toLowerCase()) {
case "info":
case "plugin":
case "pl":
case "version":
case "ver":
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
return false;
}
if ("debug".equals(args[0].toLowerCase())) {
if (args.length != 2) {
send.sender(sender,"§4Use: §7/t2code debug createReportLog");
send.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false;
}
if ("createreportlog".equals(args[1].toLowerCase())) {
CreateReportLog.create(sender);
CreateReportLog.create(sender);
} else send.sender(sender,"§4Use: §7/t2code debug createReportLog");
} else send.sender(sender,"§4Use: §7/t2code debug createReportLog");
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
}
return false;
}
@ -53,6 +61,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter { @@ -53,6 +61,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
//TabCompleter
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
put("debug", "t2code.admin");
put("info", "t2code.admin");
}};
@Override

Loading…
Cancel
Save