mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 03:14:56 +00:00
added /halt
This commit is contained in:
parent
8884b478aa
commit
5234f3c807
4 changed files with 88 additions and 1 deletions
|
@ -26,6 +26,7 @@ public class Command_glist extends TFM_Command
|
|||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Purging the banlist", true);
|
||||
TFM_UserList.getInstance(plugin).purge();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_halt extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if(!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
try
|
||||
{
|
||||
p = getPlayer(args[0]);
|
||||
}
|
||||
catch(CantFindPlayerException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||
|
||||
if(!playerdata.isHalted())
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Halting " + p.getName(), true);
|
||||
|
||||
p.setOp(false);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
p.setFlying(false);
|
||||
p.setDisplayName(p.getName());
|
||||
p.closeInventory();
|
||||
p.setTotalExperience(0);
|
||||
|
||||
playerdata.stopOrbiting();
|
||||
playerdata.setFrozen(true);
|
||||
playerdata.setMuted(true);
|
||||
|
||||
TFM_Util.playerMsg(p, "You have been halted, don't move!");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unhalting " + p.getName(), true);
|
||||
|
||||
p.setOp(true);
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
playerdata.setFrozen(false);
|
||||
playerdata.setMuted(false);
|
||||
|
||||
TFM_Util.playerMsg(p, "You are no longer halted.");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -170,7 +170,8 @@ public class Command_whitelist extends TFM_Command
|
|||
//purge
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
Set whitelisted = MinecraftServer.getServer().getServerConfigurationManager().getWhitelisted();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Set whitelisted = MinecraftServer.getServer().getServerConfigurationManager().getWhitelisted();
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||
TFM_Util.playerMsg(sender, "Removed " + whitelisted.size() + " players from the whitelist.");
|
||||
whitelisted.clear();
|
||||
|
|
|
@ -17,6 +17,7 @@ public class TFM_UserInfo
|
|||
private Player player;
|
||||
private boolean user_frozen = false;
|
||||
private boolean is_muted = false;
|
||||
private boolean is_halted = false;
|
||||
private int msg_count = 0;
|
||||
private int block_destroy_total = 0;
|
||||
private int block_place_total = 0;
|
||||
|
@ -338,4 +339,14 @@ public class TFM_UserInfo
|
|||
{
|
||||
this.is_muted = is_muted;
|
||||
}
|
||||
|
||||
public boolean isHalted()
|
||||
{
|
||||
return this.is_halted;
|
||||
}
|
||||
|
||||
public void setHalted(boolean is_halted)
|
||||
{
|
||||
this.is_halted = is_halted;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue