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

@ -117,16 +117,6 @@ 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)
{
return Arrays.asList("list");
}
return Collections.emptyList();
}
else
{ {
if (args.length == 1) if (args.length == 1)
{ {
@ -143,7 +133,6 @@ public class Command_mbconfig extends FreedomCommand
return plugin.pl.getMasterBuilderNames(); return plugin.pl.getMasterBuilderNames();
} }
} }
}
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -298,8 +298,6 @@ 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)
{ {
@ -309,31 +307,26 @@ public class Command_saconfig extends FreedomCommand
{ {
arguments.add("info"); arguments.add("info");
} }
if (plugin.al.isTelnetAdmin(sender))
{
arguments.add("add");
arguments.add("remove");
}
if (plugin.al.isSeniorAdmin(sender))
{
arguments.add("reload");
arguments.add("clean");
arguments.add("setrank");
}
return arguments; return arguments;
} }
else if (args.length == 2 && args[0].equals("info") && plugin.al.isAdmin(sender)) if (args.length == 2 && (args[0].equals("add") || args[0].equals("remove") || args[0].equals("setrank") || args[0].equals("info")))
{
return plugin.al.getActiveAdminNames();
}
return Collections.emptyList();
}
else
{
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(); return FUtil.getPlayerList();
} }
} if (args.length == 3 && args[0].equals("setrank"))
else if (args.length == 3 && args[0].equals("setrank"))
{ {
return Arrays.asList("super_admin", "telnet_admin", "senior_admin"); 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()