commands change

- add permission for '/t2c debug createReportLog'
- add '/t2c info'
This commit is contained in:
JaTiTV 2021-12-31 05:26:45 +01:00
parent 07293cded4
commit 3c6bb074d8

View File

@ -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.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI; import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import net.t2code.lib.Util;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -22,18 +23,25 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
public class CmdExecuter implements CommandExecutor, TabCompleter { 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 @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { 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) { 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 { } 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 ("debug".equals(args[0].toLowerCase())) {
if (args.length != 2) { if (args.length != 2) {
send.sender(sender, "§4Use: §7/t2code debug createReportLog"); send.sender(sender, "§4Use: §7/t2code debug createReportLog");
@ -53,6 +61,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
//TabCompleter //TabCompleter
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{ private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
put("debug", "t2code.admin"); put("debug", "t2code.admin");
put("info", "t2code.admin");
}}; }};
@Override @Override