bug fixing

This commit is contained in:
Super_ 2020-06-30 23:21:44 -04:00
parent baf5fd42f6
commit 357eddf51a
4 changed files with 40 additions and 47 deletions

View File

@ -106,6 +106,17 @@ public class AdminList extends FreedomService
return admin != null && admin.isActive();
}
public boolean isTelnetAdmin(CommandSender sender)
{
Admin admin = getAdmin(sender);
if (admin == null)
{
return false;
}
return admin.getRank().ordinal() >= Rank.TELNET_ADMIN.ordinal();
}
public boolean isSeniorAdmin(CommandSender sender)
{
Admin admin = getAdmin(sender);

View File

@ -118,30 +118,19 @@ public class Command_mbconfig extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (sender instanceof Player)
if (args.length == 1)
{
if (args.length == 1)
{
return Arrays.asList("list");
}
return Collections.emptyList();
return Arrays.asList("add", "remove", "list");
}
else
else if (args.length == 2)
{
if (args.length == 1)
if (args[0].equals("add"))
{
return Arrays.asList("add", "remove", "list");
return FUtil.getPlayerList();
}
else if (args.length == 2)
else if (args[0].equals("remove"))
{
if (args[0].equals("add"))
{
return FUtil.getPlayerList();
}
else if (args[0].equals("remove"))
{
return plugin.pl.getMasterBuilderNames();
}
return plugin.pl.getMasterBuilderNames();
}
}
return Collections.emptyList();

View File

@ -299,41 +299,34 @@ public class Command_saconfig extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (sender instanceof Player)
if (args.length == 1)
{
if (args.length == 1)
List<String> arguments = new ArrayList<>();
arguments.add("list");
if (plugin.al.isAdmin(sender))
{
List<String> arguments = new ArrayList<>();
arguments.add("list");
if (plugin.al.isAdmin(sender))
{
arguments.add("info");
}
return arguments;
arguments.add("info");
}
else if (args.length == 2 && args[0].equals("info") && plugin.al.isAdmin(sender))
if (plugin.al.isTelnetAdmin(sender))
{
return plugin.al.getActiveAdminNames();
arguments.add("add");
arguments.add("remove");
}
return Collections.emptyList();
if (plugin.al.isSeniorAdmin(sender))
{
arguments.add("reload");
arguments.add("clean");
arguments.add("setrank");
}
return arguments;
}
else
if (args.length == 2 && (args[0].equals("add") || args[0].equals("remove") || args[0].equals("setrank") || args[0].equals("info")))
{
if (args.length == 1)
{
return Arrays.asList("add", "remove", "clean", "reload", "setrank", "info", "list");
}
else if (args.length == 2)
{
if (args[0].equals("add") || args[0].equals("remove") || args[0].equals("setrank") || args[0].equals("info"))
{
return FUtil.getPlayerList();
}
}
else if (args.length == 3 && args[0].equals("setrank"))
{
return Arrays.asList("super_admin", "telnet_admin", "senior_admin");
}
return FUtil.getPlayerList();
}
if (args.length == 3 && args[0].equals("setrank"))
{
return Arrays.asList("SUPER_ADMIN", "TELNET_ADMIN", "SENIOR_ADMIN");
}
return Collections.emptyList();

View File

@ -293,7 +293,7 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
protected List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
return null;
return FUtil.getPlayerList();
}
protected boolean isConsole()