2013-05-16 06:59:08 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
|
|
|
|
2013-07-02 20:31:05 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
2013-05-16 06:59:08 +00:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
2013-07-02 20:31:05 +00:00
|
|
|
import org.bukkit.potion.PotionEffect;
|
2013-05-16 06:59:08 +00:00
|
|
|
|
|
|
|
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
|
|
|
@CommandParameters(description = "Superadmin command - Purge everything! (except for bans).", usage = "/<command>")
|
|
|
|
public class Command_purgeall extends TFM_Command
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
2013-07-02 20:31:05 +00:00
|
|
|
TFM_Util.adminAction(sender.getName(), "Purging all player data", true);
|
|
|
|
|
|
|
|
// Purge entities
|
2013-08-12 02:02:18 +00:00
|
|
|
TFM_Util.TFM_EntityWiper.wipeEntities(true, true);
|
2013-07-02 20:31:05 +00:00
|
|
|
|
2013-08-14 14:01:42 +00:00
|
|
|
for (Player player : server.getOnlinePlayers())
|
2013-07-02 20:31:05 +00:00
|
|
|
{
|
2013-08-14 14:01:42 +00:00
|
|
|
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
2013-07-02 20:31:05 +00:00
|
|
|
|
|
|
|
// Unmute all players
|
|
|
|
if (playerdata.isMuted())
|
|
|
|
{
|
|
|
|
playerdata.setMuted(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unblock all commands
|
|
|
|
if (playerdata.allCommandsBlocked())
|
|
|
|
{
|
|
|
|
playerdata.setCommandsBlocked(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unhalt all players
|
|
|
|
if (playerdata.isHalted())
|
|
|
|
{
|
|
|
|
playerdata.setHalted(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop orbiting
|
|
|
|
if (playerdata.isOrbiting())
|
|
|
|
{
|
|
|
|
playerdata.stopOrbiting();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unfreeze
|
|
|
|
if (playerdata.isFrozen())
|
|
|
|
{
|
|
|
|
playerdata.setFrozen(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Purge potion effects
|
2013-08-14 14:01:42 +00:00
|
|
|
for (PotionEffect potion_effect : player.getActivePotionEffects())
|
2013-07-02 20:31:05 +00:00
|
|
|
{
|
2013-08-14 14:01:42 +00:00
|
|
|
player.removePotionEffect(potion_effect.getType());
|
2013-07-02 20:31:05 +00:00
|
|
|
}
|
2013-07-27 21:49:25 +00:00
|
|
|
|
|
|
|
// Uncage
|
|
|
|
if (playerdata.isCaged())
|
|
|
|
{
|
|
|
|
playerdata.setCaged(false);
|
|
|
|
playerdata.regenerateHistory();
|
|
|
|
playerdata.clearHistory();
|
|
|
|
}
|
2013-07-02 20:31:05 +00:00
|
|
|
}
|
|
|
|
|
2014-11-20 22:20:31 +00:00
|
|
|
// Unfreeze all players
|
2014-12-21 09:23:50 +00:00
|
|
|
Command_fr.setAllFrozen(false);
|
2013-07-02 20:31:05 +00:00
|
|
|
|
|
|
|
// Remove all mobs
|
2013-07-27 21:49:25 +00:00
|
|
|
Command_mp.purgeMobs();
|
2013-05-16 06:59:08 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-05-16 18:18:39 +00:00
|
|
|
}
|