2016-03-02 19:28:01 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
2014-05-11 17:03:11 +00:00
|
|
|
|
2018-07-31 07:01:29 +00:00
|
|
|
import java.io.File;
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
2017-11-16 22:32:09 +00:00
|
|
|
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;
|
|
|
|
|
2020-08-15 06:44:57 +00:00
|
|
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
2020-03-30 23:43:57 +00:00
|
|
|
@CommandParameters(description = "Removes all essentials playerdata", usage = "/<command>")
|
2015-10-19 17:43:46 +00:00
|
|
|
public class Command_wipeuserdata extends FreedomCommand
|
2014-05-11 17:03:11 +00:00
|
|
|
{
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2014-05-11 17:03:11 +00:00
|
|
|
@Override
|
2015-11-22 18:26:47 +00:00
|
|
|
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"))
|
|
|
|
{
|
2018-07-30 07:23:01 +00:00
|
|
|
msg("Essentials is not enabled on this server.");
|
2014-05-11 17:03:11 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-08-15 06:44:57 +00:00
|
|
|
FUtil.staffAction(sender.getName(), "Wiping Essentials and worlds playerdata", true);
|
2014-05-11 17:03:11 +00:00
|
|
|
|
2017-11-16 22:32:09 +00:00
|
|
|
for (World w : Bukkit.getWorlds())
|
|
|
|
{
|
2020-08-15 06:44:57 +00:00
|
|
|
if (w.getName().equals(plugin.wm.staffworld.getWorld().getName()))
|
2017-11-16 22:32:09 +00:00
|
|
|
{
|
2018-02-09 08:21:44 +00:00
|
|
|
continue;
|
2017-11-16 22:32:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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"));
|
|
|
|
msg("All playerdata deleted.");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2014-05-11 17:03:11 +00:00
|
|
|
}
|
|
|
|
}
|