mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-08-21 21:51:46 +00:00
More guest list changes.
This commit is contained in:
parent
bf7877addc
commit
f5e21f69fd
|
@ -9,7 +9,7 @@ import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Go to the AdminWorld.", usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | on | storm>]")
|
@CommandParameters(description = "Go to the AdminWorld.", usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | on | storm>]")
|
||||||
public class Command_adminworld extends TFM_Command
|
public class Command_adminworld extends TFM_Command
|
||||||
{
|
{
|
||||||
|
@ -82,13 +82,13 @@ public class Command_adminworld extends TFM_Command
|
||||||
{
|
{
|
||||||
if ("list".equalsIgnoreCase(args[1]))
|
if ("list".equalsIgnoreCase(args[1]))
|
||||||
{
|
{
|
||||||
playerMsg("AdminWorld Guest List: " + TFM_AdminWorld.getInstance().guestListToString());
|
playerMsg("AdminWorld guest list: " + TFM_AdminWorld.getInstance().guestListToString());
|
||||||
}
|
}
|
||||||
else if ("purge".equalsIgnoreCase(args[1]))
|
else if ("purge".equalsIgnoreCase(args[1]))
|
||||||
{
|
{
|
||||||
assertCommandPerms(sender, sender_p);
|
assertCommandPerms(sender, sender_p);
|
||||||
TFM_AdminWorld.getInstance().purgeGuestList();
|
TFM_AdminWorld.getInstance().purgeGuestList();
|
||||||
playerMsg("AdminWorld guest list purged.");
|
TFM_Util.adminAction(sender.getName(), "AdminWorld guest list purged.", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -101,22 +101,32 @@ public class Command_adminworld extends TFM_Command
|
||||||
|
|
||||||
if ("add".equalsIgnoreCase(args[1]))
|
if ("add".equalsIgnoreCase(args[1]))
|
||||||
{
|
{
|
||||||
|
Player player;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TFM_AdminWorld.getInstance().addGuest(getPlayer(args[2]), sender_p);
|
player = getPlayer(args[2]);
|
||||||
}
|
}
|
||||||
catch (PlayerNotFoundException ex)
|
catch (PlayerNotFoundException ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ex.getMessage());
|
sender.sendMessage(ex.getMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player != null && TFM_AdminWorld.getInstance().addGuest(player, sender_p))
|
||||||
|
{
|
||||||
|
TFM_Util.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playerMsg("Could not add player to guest list.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (TFM_Util.isRemoveCommand(args[1]))
|
else if (TFM_Util.isRemoveCommand(args[1]))
|
||||||
{
|
{
|
||||||
Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
|
Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
playerMsg("Guest removed: " + player.getName());
|
TFM_Util.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,13 +74,21 @@ public final class TFM_AdminWorld extends TFM_CustomWorld
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGuest(Player guest, Player supervisor)
|
public boolean addGuest(Player guest, Player supervisor)
|
||||||
{
|
{
|
||||||
|
if (guest == supervisor || TFM_SuperadminList.isUserSuperadmin(guest))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (TFM_SuperadminList.isUserSuperadmin(supervisor))
|
if (TFM_SuperadminList.isUserSuperadmin(supervisor))
|
||||||
{
|
{
|
||||||
guestList.put(guest, supervisor);
|
guestList.put(guest, supervisor);
|
||||||
wipeAccessCache();
|
wipeAccessCache();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player removeGuest(Player guest)
|
public Player removeGuest(Player guest)
|
||||||
|
|
Loading…
Reference in a new issue