2015-10-19 17:43:46 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.commands;
|
2013-05-16 06:59:08 +00:00
|
|
|
|
2015-11-15 23:32:04 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
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
|
|
|
|
2015-10-19 17:43:46 +00:00
|
|
|
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
|
2013-05-16 06:59:08 +00:00
|
|
|
@CommandParameters(description = "Superadmin command - Purge everything! (except for bans).", usage = "/<command>")
|
2015-10-19 17:43:46 +00:00
|
|
|
public class Command_purgeall extends FreedomCommand
|
2013-05-16 06:59:08 +00:00
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
2015-10-19 17:43:46 +00:00
|
|
|
FUtil.adminAction(sender.getName(), "Purging all player data", true);
|
2013-07-02 20:31:05 +00:00
|
|
|
|
|
|
|
// Purge entities
|
2015-11-15 23:32:04 +00:00
|
|
|
plugin.ew.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
|
|
|
{
|
2015-11-15 23:32:04 +00:00
|
|
|
FPlayer fPlayer = plugin.pl.getPlayer(player);
|
2013-07-02 20:31:05 +00:00
|
|
|
|
|
|
|
// Unmute all players
|
2015-11-15 23:32:04 +00:00
|
|
|
if (fPlayer.isMuted())
|
2013-07-02 20:31:05 +00:00
|
|
|
{
|
2015-11-15 23:32:04 +00:00
|
|
|
fPlayer.setMuted(false);
|
2013-07-02 20:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Unblock all commands
|
2015-11-15 23:32:04 +00:00
|
|
|
if (fPlayer.allCommandsBlocked())
|
2013-07-02 20:31:05 +00:00
|
|
|
{
|
2015-11-15 23:32:04 +00:00
|
|
|
fPlayer.setCommandsBlocked(false);
|
2013-07-02 20:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Stop orbiting
|
2015-11-15 23:32:04 +00:00
|
|
|
if (fPlayer.isOrbiting())
|
2013-07-02 20:31:05 +00:00
|
|
|
{
|
2015-11-15 23:32:04 +00:00
|
|
|
fPlayer.stopOrbiting();
|
2013-07-02 20:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Unfreeze
|
2015-11-15 23:32:04 +00:00
|
|
|
if (fPlayer.getFreezeData().isFrozen())
|
2013-07-02 20:31:05 +00:00
|
|
|
{
|
2015-11-15 23:32:04 +00:00
|
|
|
fPlayer.getFreezeData().setFrozen(false);
|
2013-07-02 20:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
2015-11-15 23:32:04 +00:00
|
|
|
if (fPlayer.getCageData().isCaged())
|
2013-07-27 21:49:25 +00:00
|
|
|
{
|
2015-11-15 23:32:04 +00:00
|
|
|
fPlayer.getCageData().setCaged(false);
|
2013-07-27 21:49:25 +00:00
|
|
|
}
|
2013-07-02 20:31:05 +00:00
|
|
|
}
|
|
|
|
|
2014-11-20 22:20:31 +00:00
|
|
|
// Unfreeze all players
|
2015-11-15 23:32:04 +00:00
|
|
|
plugin.fm.setGlobalFreeze(false);
|
2013-07-02 20:31:05 +00:00
|
|
|
|
|
|
|
// Remove all mobs
|
2015-11-15 23:32:04 +00:00
|
|
|
Command_mobpurge.purgeMobs();
|
2013-05-16 06:59:08 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-05-16 18:18:39 +00:00
|
|
|
}
|