diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java index 11cc4eec..09b90f40 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java @@ -110,4 +110,4 @@ public class Command_gtfo extends FreedomCommand return true; } -} \ No newline at end of file +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbownick.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbownick.java index 83ad4801..de59c98f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbownick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbownick.java @@ -57,4 +57,4 @@ public class Command_rainbownick extends FreedomCommand return true; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbowtag.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbowtag.java index b4a13d98..4fcb68bc 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbowtag.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rainbowtag.java @@ -45,4 +45,4 @@ public class Command_rainbowtag extends FreedomCommand return true; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectator.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectator.java new file mode 100644 index 00000000..b66a968a --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectator.java @@ -0,0 +1,38 @@ + + +package me.totalfreedom.totalfreedommod.command; + +import org.bukkit.GameMode; +import org.bukkit.command.Command; +import org.bukkit.entity.Player; +import org.bukkit.command.CommandSender; +import me.totalfreedom.totalfreedommod.rank.Rank; + +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) +@CommandParameters(description = "Quickly change your own gamemode to spectator.", usage = "/", aliases = "gmsp") +public class Command_spectator extends FreedomCommand +{ + public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) { + if (args.length == 0) { + if (this.isConsole()) { + sender.sendMessage("When used from the console, you must define a target player."); + return true; + } + playerSender.setGameMode(GameMode.SPECTATOR); + this.msg("Gamemode set to spectator."); + return true; + } + else { + this.checkRank(Rank.SUPER_ADMIN); + final Player player = this.getPlayer(args[0]); + if (player == null) { + sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); + return true; + } + this.msg("Setting " + player.getName() + " to game mode spectator"); + this.msg((CommandSender)player, sender.getName() + " set your game mode to spectator"); + player.setGameMode(GameMode.SPECTATOR); + return true; + } + } +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java index 085cbae9..21f1c3ff 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java @@ -18,7 +18,7 @@ public class Command_tag extends FreedomCommand public static final List FORBIDDEN_WORDS = Arrays.asList(new String[] { - "admin", "owner", "moderator", "developer", "console" + "admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA" }); @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tagnyan.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tagnyan.java index 70eef744..3ba4bd53 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tagnyan.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tagnyan.java @@ -1,5 +1,7 @@ package me.totalfreedom.totalfreedommod.command; +import java.util.Arrays; +import java.util.List; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -13,6 +15,11 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Gives you a tag with random colors", usage = "/ ", aliases = "tn") public class Command_tagnyan extends FreedomCommand { + + public static final List FORBIDDEN_WORDS = Arrays.asList(new String[] + { + "admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA" + }); @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tban.java index 15a3edfc..c06830c1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tban.java @@ -48,7 +48,7 @@ public class Command_tban extends FreedomCommand for (int z = -1; z <= 1; z++) { final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z); - targetPos.getWorld().strikeLightning(strike_pos); + targetPos.getWorld().strikeLightningEffect(strike_pos); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java index f2c95ac3..79aa87d9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java @@ -62,7 +62,7 @@ public class Command_tempban extends FreedomCommand for (int z = -1; z <= 1; z++) { final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z); - targetPos.getWorld().strikeLightning(strike_pos); + targetPos.getWorld().strikeLightningEffect(strike_pos); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java index 4cbb1e5a..b6a23176 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java @@ -1,6 +1,8 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.GameRuleHandler; import me.totalfreedom.totalfreedommod.GameRuleHandler.GameRule; +import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -25,6 +27,8 @@ public class Command_toggle extends FreedomCommand msg("- fluidspread"); msg("- lavadmg"); msg("- firespread"); + msg("- frostwalk"); + msg("- firework"); msg("- prelog"); msg("- lockdown"); msg("- petprotect"); @@ -34,133 +38,103 @@ public class Command_toggle extends FreedomCommand return false; } - if (args[0].equals("waterplace")) - { - toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE); + if (args[0].equals("waterplace")) { + this.toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE); return true; } - - if (args[0].equals("fireplace")) - { - toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE); + if (args[0].equals("frostwalk")) { + this.toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER); return true; } - - if (args[0].equals("lavaplace")) - { - toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE); + if (args[0].equals("fireplace")) { + this.toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE); return true; } - - if (args[0].equals("fluidspread")) + if (args[0].equals("lavaplace")) { + this.toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE); + return true; + } + /*if (args[0].equals("explosivearrows")) { - toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD); + toggle("Explosive arrows are now", ConfigEntry.MAKE_ARROW_EXPLOSIVE); + return true; + }*/ + if (args[0].equals("fluidspread")) { + this.toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD); return true; } - - if (args[0].equals("lavadmg")) - { - toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE); + if (args[0].equals("lavadmg")) { + this.toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE); return true; } - - if (args[0].equals("firespread")) - { - toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD); - plugin.gr.setGameRule(GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean()); + if (args[0].equals("firespread")) { + this.toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD); + ((TotalFreedomMod)this.plugin).gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean()); return true; } - - if (args[0].equals("prelog")) - { - toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG); + if (args[0].equals("prelog")) { + this.toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG); return true; } - - if (args[0].equals("lockdown")) - { - boolean active = !plugin.lp.isLockdownEnabled(); - plugin.lp.setLockdownEnabled(active); - + if (args[0].equals("lockdown")) { + final boolean active = !((TotalFreedomMod)this.plugin).lp.isLockdownEnabled(); + ((TotalFreedomMod)this.plugin).lp.setLockdownEnabled(active); FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true); return true; } - - if (args[0].equals("petprotect")) - { - toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT); + if (args[0].equals("petprotect")) { + this.toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT); return true; } - - if (args[0].equals("entitywipe")) - { - toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE); + if (args[0].equals("entitywipe")) { + this.toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE); return true; } - - if (args[0].equals("nonuke")) - { - if (args.length >= 2) - { - try - { + if (args[0].equals("firework")) { + this.toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION); + return true; + } + if (args[0].equals("nonuke")) { + if (args.length >= 2) { + try { ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1])))); } - catch (NumberFormatException nfex) - { - } + catch (NumberFormatException ex2) {} } - - if (args.length >= 3) - { - try - { + if (args.length >= 3) { + try { ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2])))); } - catch (NumberFormatException nfex) - { - } + catch (NumberFormatException ex3) {} } - - toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED); - - if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) - { - msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks."); - msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds."); + this.toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED); + if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) { + this.msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks."); + this.msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds."); } - return true; } - if (args[0].equals("explosives")) - { - if (args.length == 2) - { - try - { + if (args[0].equals("explosives")) { + if (args.length == 2) { + try { ConfigEntry.EXPLOSIVE_RADIUS.setDouble(Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1])))); } - catch (NumberFormatException ex) - { - msg(ex.getMessage()); + catch (NumberFormatException ex) { + this.msg(ex.getMessage()); return true; } } - - toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS); - - if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) - { - msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble()); + this.toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS); + if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { + this.msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble()); } return true; } - return false; } - - private void toggle(String name, ConfigEntry entry) - { - msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled.")); + + private void toggle(final String name, final ConfigEntry entry) { + this.msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled.")); } } + diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java index b382ff78..41e2889b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; //import me.libraryaddict.disguise.DisallowedDisguises; +import me.libraryaddict.disguise.DisallowedDisguises; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; @@ -14,7 +15,7 @@ public class Command_undisguiseall extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { /* + { if (!plugin.ldb.isPluginEnabled()) { msg("LibsDisguises is not enabled."); @@ -32,10 +33,5 @@ public class Command_undisguiseall extends FreedomCommand plugin.ldb.undisguiseAll(false); return true; - -*/ - - msg("This command has been disabled for technical reasons. Contact a developer for additional information."); - return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java index 9cc2e255..74494aaa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java @@ -2,6 +2,10 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.List; +import me.totalfreedom.totalfreedommod.command.CommandParameters; +import me.totalfreedom.totalfreedommod.command.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.SourceType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipecoreprotectdata.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipecoreprotectdata.java new file mode 100644 index 00000000..779a4e5c --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipecoreprotectdata.java @@ -0,0 +1,31 @@ +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.TELNET_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) + { + 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 index 532ab1ee..e09be93e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java @@ -6,6 +6,7 @@ import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; @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 = "/") @@ -24,8 +25,22 @@ public class Command_wipeflatlands extends FreedomCommand player.kickPlayer("Server is going offline for flatlands wipe, come back in a few minutes."); } - server.shutdown(); + if (!plugin.cpb.isEnabled()) + { + server.shutdown(); + } + else + { + new BukkitRunnable() + { + @Override + public void run() + { + plugin.cpb.clearDatabase(plugin.wm.flatlands.getWorld(), true); + } + }.runTaskAsynchronously(plugin); + } 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 new file mode 100644 index 00000000..d2129f59 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java @@ -0,0 +1,77 @@ +package me.totalfreedom.totalfreedommod.command; + +import com.sk89q.worldguard.bukkit.RegionContainer; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; +import com.sk89q.worldguard.protection.managers.RegionManager; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import java.util.Map; +import me.totalfreedom.totalfreedommod.rank.Rank; +import me.totalfreedom.totalfreedommod.util.FUtil; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH) +@CommandParameters(description = "Wipe all WorldGuard regions for a specified world.", usage = "/ ", aliases = "wiperegions") +public class Command_wiperegions extends FreedomCommand +{ + + public WorldGuardPlugin getWorldGuard() + { + Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard"); + + if (plugin == null || !(plugin instanceof WorldGuardPlugin)) + { + return null; + } + + return (WorldGuardPlugin) plugin; + } + + @Override + public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + if (getWorldGuard() == null) + { + msg("WorldGuard is not installed.", ChatColor.GRAY); + return true; + } + if (args.length != 1) + { + return false; + } + World world = server.getWorld(args[0]); + if (world == null) + { + msg("World : \"" + args[0] + "\" not found.", ChatColor.GRAY); + return true; + } + if (world.equals(plugin.wm.adminworld.getWorld()) && !plugin.rm.getRank(sender).isAtLeast(Rank.SENIOR_ADMIN)) + { + msg("You do not have permission to wipe adminworld.", ChatColor.RED); + return true; + } + RegionContainer container = getWorldGuard().getRegionContainer(); + RegionManager rm = container.get(world); + if (rm != null) + { + Map regions = rm.getRegions(); + for (ProtectedRegion region : regions.values()) + { + rm.removeRegion(region.getId()); + } + FUtil.adminAction(sender.getName(), "Wiping regions for world: " + world.getName(), true); + return true; + } + else + { + msg(ChatColor.RED + "No regions have been found for world: \"" + world.getName() + "\"."); + return true; + } + } + +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java index 3ce64628..c652b605 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java @@ -1,8 +1,12 @@ package me.totalfreedom.totalfreedommod.command; import java.io.File; +import java.util.List; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; +import org.bukkit.Bukkit; +import static org.bukkit.Bukkit.getServer; +import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -21,11 +25,24 @@ public class Command_wipeuserdata extends FreedomCommand return true; } - FUtil.adminAction(sender.getName(), "Wiping Essentials playerdata", true); + FUtil.adminAction(sender.getName(), "Wiping Essentials and Worlds playerdata", true); - FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "userdata")); + for (World w : Bukkit.getWorlds()) + { + if (w.getName().equals(plugin.wm.adminworld.getWorld())) + { + return true; + } - msg("All playerdata deleted."); - return true; + 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; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java new file mode 100644 index 00000000..0ccab569 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java @@ -0,0 +1,33 @@ +package me.totalfreedom.totalfreedommod.command; + +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 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 (!server.getPluginManager().isPluginEnabled("Essentials")) + { + msg("Essentials is not enabled on this server"); + return true; + } + Plugin essentials = server.getPluginManager().getPlugin("Essentials"); + FUtil.adminAction(sender.getName(), "Wiping Essentials Warps", true); + server.getPluginManager().disablePlugin(essentials); + FUtil.deleteFolder(new File(essentials.getDataFolder(), "warps")); + server.getPluginManager().enablePlugin(essentials); + msg("All warps deleted."); + return true; + + } +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java index 6c79ce2d..110f3952 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java @@ -134,6 +134,11 @@ public abstract class FreedomCommand extends AbstractCommandBase