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(); 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) public boolean isSeniorAdmin(CommandSender sender)
{ {
Admin admin = getAdmin(sender); Admin admin = getAdmin(sender);

View File

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

View File

@ -299,41 +299,34 @@ public class Command_saconfig extends FreedomCommand
@Override @Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) 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("info");
arguments.add("list");
if (plugin.al.isAdmin(sender))
{
arguments.add("info");
}
return arguments;
} }
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 FUtil.getPlayerList();
{ }
return Arrays.asList("add", "remove", "clean", "reload", "setrank", "info", "list"); if (args.length == 3 && args[0].equals("setrank"))
} {
else if (args.length == 2) return Arrays.asList("SUPER_ADMIN", "TELNET_ADMIN", "SENIOR_ADMIN");
{
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 Collections.emptyList(); 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) protected List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{ {
return null; return FUtil.getPlayerList();
} }
protected boolean isConsole() protected boolean isConsole()