mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added /halt purge and /halt all
This commit is contained in:
parent
692147b84c
commit
54f0d543a7
@ -25,6 +25,38 @@ public class Command_halt extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Halting all non-Superadmins", true);
|
||||
int counter = 0;
|
||||
for(Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if(!TFM_Util.isUserSuperadmin(p))
|
||||
{
|
||||
halt(p, sender);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
TFM_Util.playerMsg(sender, "Halted " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unhalting all players", true);
|
||||
int counter = 0;
|
||||
for(Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if(!TFM_UserInfo.getPlayerData(p).isHalted())
|
||||
{
|
||||
unhalt(p, sender);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
TFM_Util.playerMsg(sender, "Unhalted " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p;
|
||||
try
|
||||
{
|
||||
@ -37,11 +69,24 @@ public class Command_halt extends TFM_Command
|
||||
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||
|
||||
if(!playerdata.isHalted())
|
||||
if(!TFM_UserInfo.getPlayerData(p).isHalted())
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Halting " + p.getName(), true);
|
||||
halt(p, sender);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unhalting " + p.getName(), true);
|
||||
|
||||
unhalt(p, sender);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void halt(Player p, CommandSender sender)
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||
|
||||
p.setOp(false);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
@ -53,22 +98,21 @@ public class Command_halt extends TFM_Command
|
||||
playerdata.stopOrbiting();
|
||||
playerdata.setFrozen(true);
|
||||
playerdata.setMuted(true);
|
||||
playerdata.setHalted(true);
|
||||
|
||||
TFM_Util.playerMsg(p, "You have been halted, don't move!");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
public void unhalt(Player p, CommandSender sender)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unhalting " + p.getName(), true);
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||
|
||||
p.setOp(true);
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
playerdata.setFrozen(false);
|
||||
playerdata.setMuted(false);
|
||||
playerdata.setHalted(false);
|
||||
|
||||
TFM_Util.playerMsg(p, "You are no longer halted.");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user