mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge pull request #58 from AtlasMediaGroup/FS-221
Remove a number of wipe commands we don't want anyway
This commit is contained in:
commit
7258d7f1bf
@ -1,37 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE)
|
|
||||||
@CommandParameters(description = "Wipes the CoreProtect data for the flatlands", usage = "/<command>")
|
|
||||||
public class Command_wipecoreprotectdata extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (!plugin.cpb.isEnabled())
|
|
||||||
{
|
|
||||||
msg("CoreProtect is not enabled on this server");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUtil.adminAction(sender.getName(), "Wiping CoreProtect data for the flatlands", true);
|
|
||||||
|
|
||||||
new BukkitRunnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
plugin.cpb.clearDatabase(plugin.wm.flatlands.getWorld());
|
|
||||||
}
|
|
||||||
}.runTaskAsynchronously(plugin);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
|
||||||
@CommandParameters(description = "Wipe the flatlands map. Requires manual restart after command is used.", usage = "/<command>")
|
|
||||||
public class Command_wipeflatlands extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
plugin.sf.setSavedFlag("do_wipe_flatlands", true);
|
|
||||||
|
|
||||||
if (!ConfigEntry.FLATLANDS_GENERATE.getBoolean())
|
|
||||||
{
|
|
||||||
msg("Flatlands generation is disabled, therefore it cannot be wiped.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUtil.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
|
|
||||||
|
|
||||||
World flatlands = plugin.wm.flatlands.getWorld();
|
|
||||||
|
|
||||||
if (plugin.wgb.isEnabled())
|
|
||||||
{
|
|
||||||
plugin.wgb.wipeRegions(flatlands);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
player.kickPlayer("Server is going offline for flatlands wipe, come back in a few minutes.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plugin.cpb.isEnabled())
|
|
||||||
{
|
|
||||||
plugin.cpb.clearDatabase(flatlands, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
server.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
|
||||||
@CommandParameters(description = "Wipes all logged punishments or punishments for a specific user.", usage = "/<command> <username | -a>")
|
|
||||||
public class Command_wipepunishments extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (args.length < 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("-a"))
|
|
||||||
{
|
|
||||||
FUtil.adminAction(sender.getName(), "Wiping the punishment history", true);
|
|
||||||
|
|
||||||
msg("Wiped " + plugin.pul.clear() + " punishments.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String username = args[0];
|
|
||||||
|
|
||||||
FUtil.adminAction(sender.getName(), "Wiping the punishment history for " + username, true);
|
|
||||||
|
|
||||||
msg("Wiped " + plugin.pul.clear(username) + " punishments for " + username + ".");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
|
|
||||||
@CommandParameters(description = "Wipe all WorldGuard regions for a specified world.", usage = "/<command> <world>")
|
|
||||||
public class Command_wiperegions extends FreedomCommand
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (!plugin.wgb.isEnabled())
|
|
||||||
{
|
|
||||||
msg("WorldGuard is not enabled.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length != 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
World world = server.getWorld(args[0]);
|
|
||||||
if (world == null)
|
|
||||||
{
|
|
||||||
msg("There is no world named \"" + args[0] + "\"", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int regionsWiped = plugin.wgb.wipeRegions(world);
|
|
||||||
|
|
||||||
if (regionsWiped != 0)
|
|
||||||
{
|
|
||||||
FUtil.adminAction(sender.getName(), "Wiped all regions in " + world.getName(), true);
|
|
||||||
msg("Wiped " + regionsWiped + " regions in " + world.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(ChatColor.RED + "No regions were found in \"" + world.getName() + "\"");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAllWorldNames()
|
|
||||||
{
|
|
||||||
List<String> names = new ArrayList<>();
|
|
||||||
for (World world : server.getWorlds())
|
|
||||||
{
|
|
||||||
names.add(world.getName());
|
|
||||||
}
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
|
||||||
{
|
|
||||||
if (args.length == 1)
|
|
||||||
{
|
|
||||||
return getAllWorldNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import java.io.File;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
|
||||||
@CommandParameters(description = "Removes all Essentials warps", usage = "/<command>")
|
|
||||||
public class Command_wipewarps extends FreedomCommand
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (!plugin.esb.isEnabled())
|
|
||||||
{
|
|
||||||
msg("Essentials is not enabled on this server.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Essentials essentials = plugin.esb.getEssentialsPlugin();
|
|
||||||
File warps = new File(essentials.getDataFolder(), "warps");
|
|
||||||
FUtil.adminAction(sender.getName(), "Wiping Essentials warps", true);
|
|
||||||
FUtil.deleteFolder(warps);
|
|
||||||
//noinspection ResultOfMethodCallIgnored
|
|
||||||
warps.mkdir();
|
|
||||||
essentials.reload();
|
|
||||||
msg("All warps deleted.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user