diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java index c54b6b35..57847e49 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_glist.java @@ -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; } diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_halt.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_halt.java new file mode 100644 index 00000000..1ea92ddc --- /dev/null +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_halt.java @@ -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; + } + + } +} diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_whitelist.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_whitelist.java index 17711b8f..8c89fd42 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_whitelist.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_whitelist.java @@ -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(); diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java b/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java index 76cd93c2..52f298f8 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java @@ -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; + } } diff --git a/src/plugin.yml b/src/plugin.yml index 529bd4c8..14b7880d 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -73,6 +73,9 @@ commands: gtfo: description: Superadmin command - Makes someone GTFO (deop and ip ban by username). usage: / + halt: + description: Superadmin command - Halts a player + usage: / kicknoob: description: Superadmin command - Kick all non-superadmins on server. usage: /