56 lines
1.8 KiB
Java
56 lines
1.8 KiB
Java
// This claas was created by JaTiTV
|
|
|
|
package net.t2code.automatedMessages.command;
|
|
|
|
import net.t2code.automatedMessages.Util;
|
|
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) {
|
|
if (!sender.hasPermission("t2c.automatedmessages.admin")) {
|
|
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity! §7<t2c.automatedmessages.admin>");
|
|
return false;
|
|
}
|
|
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;
|
|
}
|
|
}
|