TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java

48 lines
1.9 KiB
Java
Raw Normal View History

package me.totalfreedom.totalfreedommod.command;
2014-05-11 17:03:11 +00:00
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.Bukkit;
import org.bukkit.World;
2014-05-11 17:03:11 +00:00
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.io.File;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
2014-05-11 17:03:11 +00:00
@CommandParameters(description = "Removes essentials playerdata", usage = "/<command>")
public class Command_wipeuserdata extends FreedomCommand
2014-05-11 17:03:11 +00:00
{
2014-05-11 17:03:11 +00:00
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
2014-05-11 17:03:11 +00:00
{
if (!server.getPluginManager().isPluginEnabled("Essentials"))
{
msg("Essentials is not enabled on this server");
2014-05-11 17:03:11 +00:00
return true;
}
FUtil.adminAction(sender.getName(), "Wiping Essentials and worlds playerdata", true);
2014-05-11 17:03:11 +00:00
for (World w : Bukkit.getWorlds())
{
if (w.getName().equals(plugin.wm.adminworld.getWorld().getName()))
{
continue;
}
FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "userdata"));
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(plugin.wm.flatlands.getName()).getWorldFolder().getName() + "playerdata"));
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(plugin.wm.flatlands.getName()).getWorldFolder().getName() + "stats"));
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(w.getName()).getWorldFolder().getName() + "stats"));
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(w.getName()).getWorldFolder().getName() + "playerdata"));
2014-05-11 17:03:11 +00:00
msg("All playerdata deleted.");
return true;
}
return false;
2014-05-11 17:03:11 +00:00
}
}