T2C-AutomatedMessages/src/main/java/net/t2code/automatedMessages/command/CmdExecuter.java

56 lines
1.8 KiB
Java
Raw Normal View History

2022-11-17 04:01:25 +00:00
// This claas was created by JaTiTV
package net.t2code.automatedMessages.command;
2023-06-27 17:13:21 +00:00
import net.t2code.automatedMessages.Util;
2022-11-17 04:01:25 +00:00
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class CmdExecuter implements CommandExecutor, TabCompleter {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
2023-06-27 17:13:21 +00:00
if (!sender.hasPermission("t2c.automatedmessages.admin")) {
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity! §7<t2c.automatedmessages.admin>");
return false;
}
2022-11-17 04:01:25 +00:00
if (args.length == 0) {
Commands.reload(sender);
} else {
switch (args[0].toLowerCase()) {
case "reload":
case "rl":
Commands.reload(sender);
break;
case "info":
case "plugin":
case "pl":
case "version":
case "ver":
Commands.info(sender);
break;
}
}
return false;
}
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
put("reload", "t2c.automatedmessages.admin");
put("info", "t2c.automatedmessages.admin");
}};
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
List<String> list = new ArrayList<>();
T2Ctab.tab(list,sender,0,args,arg1);
return list;
}
}