make aw available to ops

This commit is contained in:
Super_
2020-07-15 20:17:45 -04:00
parent a1418eb516
commit 03b22ac326
5 changed files with 14 additions and 254 deletions

View File

@ -14,14 +14,14 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Allows for admins to configure guests, time, and weather of the AdminWorld, and allows for admins and guests to go to the AdminWorld.",
usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | rain | storm>]",
usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]",
aliases = "aw")
public class Command_adminworld extends FreedomCommand
{
private enum CommandMode
{
TELEPORT, GUEST, TIME, WEATHER
TELEPORT, TIME, WEATHER
}
@Override
@ -35,11 +35,7 @@ public class Command_adminworld extends FreedomCommand
}
else if (args.length >= 2)
{
if ("guest".equalsIgnoreCase(args[0]))
{
commandMode = CommandMode.GUEST;
}
else if ("time".equalsIgnoreCase(args[0]))
if ("time".equalsIgnoreCase(args[0]))
{
commandMode = CommandMode.TIME;
}
@ -81,77 +77,8 @@ public class Command_adminworld extends FreedomCommand
}
else
{
if (plugin.wm.adminworld.canAccessWorld(playerSender))
{
msg("Going to the AdminWorld.");
plugin.wm.adminworld.sendToWorld(playerSender);
}
else
{
msg("You don't have permission to access the AdminWorld.");
}
}
break;
}
case GUEST:
{
if (args.length == 2)
{
if ("list".equalsIgnoreCase(args[1]))
{
msg("AdminWorld guest list: " + plugin.wm.adminworld.guestListToString());
}
else if ("purge".equalsIgnoreCase(args[1]))
{
assertCommandPerms(sender, playerSender);
plugin.wm.adminworld.purgeGuestList();
FUtil.adminAction(sender.getName(), "AdminWorld guest list purged.", false);
}
else
{
return false;
}
}
else if (args.length == 3)
{
assertCommandPerms(sender, playerSender);
if ("add".equalsIgnoreCase(args[1]))
{
final Player player = getPlayer(args[2]);
if (player == null)
{
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
if (plugin.wm.adminworld.addGuest(player, playerSender))
{
FUtil.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
}
else
{
msg("Could not add player to guest list.");
}
}
else if ("remove".equals(args[1]))
{
final Player player = plugin.wm.adminworld.removeGuest(args[2]);
if (player != null)
{
FUtil.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);
}
else
{
msg("Can't find guest entry for: " + args[2]);
}
}
else
{
return false;
}
msg("Going to the AdminWorld.");
plugin.wm.adminworld.sendToWorld(playerSender);
}
break;
@ -274,20 +201,6 @@ public class Command_adminworld extends FreedomCommand
return Arrays.asList("off", "rain", "storm");
}
}
else if (args.length == 3)
{
if (args[0].equals("guest"))
{
if (args[1].equals("add"))
{
return FUtil.getPlayerList();
}
else if (args[1].equals("remove"))
{
return plugin.wm.adminworld.getGuestList();
}
}
}
return Collections.emptyList();
}