From 951c699ed02e84db33940263e750cab557877310 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 3 May 2021 15:44:05 +0100 Subject: [PATCH] Remove a number of wipe commands we don't want anyway We shouldn't be wiping any of this data within the server now anyway so let's not tempt fate again. --- .../command/Command_wipecoreprotectdata.java | 37 ---------- .../command/Command_wipeflatlands.java | 53 -------------- .../command/Command_wipepunishments.java | 40 ---------- .../command/Command_wiperegions.java | 73 ------------------- .../command/Command_wipewarps.java | 34 --------- 5 files changed, 237 deletions(-) delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipecoreprotectdata.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipepunishments.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipecoreprotectdata.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipecoreprotectdata.java deleted file mode 100644 index f89ff3cf..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipecoreprotectdata.java +++ /dev/null @@ -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 = "/") -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; - } -} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java deleted file mode 100644 index a0b71336..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java +++ /dev/null @@ -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 = "/") -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; - } -} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipepunishments.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipepunishments.java deleted file mode 100644 index f6d5c2ce..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipepunishments.java +++ /dev/null @@ -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 = "/ ") -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; - } -} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java deleted file mode 100644 index 42ddf20c..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java +++ /dev/null @@ -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 = "/ ") -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 getAllWorldNames() - { - List names = new ArrayList<>(); - for (World world : server.getWorlds()) - { - names.add(world.getName()); - } - return names; - } - - @Override - public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) - { - if (args.length == 1) - { - return getAllWorldNames(); - } - - return Collections.emptyList(); - } -} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java deleted file mode 100644 index b7003ea6..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java +++ /dev/null @@ -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 = "/") -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; - } -}