diff --git a/pom.xml b/pom.xml
index 2628624a..8c348bae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -228,10 +228,6 @@
me.main__.util
com.onarandombox.serializationconfig
-
- com.pneumaticraft.commandhandler
- com.onarandombox.commandhandler
-
buscript
com.onarandombox.buscript
@@ -325,11 +321,6 @@
acf-paper
0.5.1-SNAPSHOT
-
- com.pneumaticraft.commandhandler
- CommandHandler
- 11
-
net.minidev
diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
index cfa0cdc7..2011699a 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
@@ -13,8 +13,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -32,48 +30,18 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
+import com.onarandombox.MultiverseCore.commands.CheckCommand;
import com.onarandombox.MultiverseCore.commands.CreateCommand;
import com.onarandombox.MultiverseCore.commands.DebugCommand;
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
-import com.onarandombox.MultiverseCore.commandsold.AnchorCommand;
-import com.onarandombox.MultiverseCore.commandsold.CloneCommand;
-import com.onarandombox.MultiverseCore.commandsold.ConfigCommand;
-import com.onarandombox.MultiverseCore.commandsold.ConfirmCommand;
-import com.onarandombox.MultiverseCore.commandsold.CoordCommand;
-import com.onarandombox.MultiverseCore.commandsold.DeleteCommand;
-import com.onarandombox.MultiverseCore.commandsold.EnvironmentCommand;
-import com.onarandombox.MultiverseCore.commandsold.GameruleCommand;
-import com.onarandombox.MultiverseCore.commandsold.GamerulesCommand;
-import com.onarandombox.MultiverseCore.commandsold.GeneratorCommand;
-import com.onarandombox.MultiverseCore.commandsold.HelpCommand;
-import com.onarandombox.MultiverseCore.commandsold.ImportCommand;
-import com.onarandombox.MultiverseCore.commandsold.InfoCommand;
-import com.onarandombox.MultiverseCore.commandsold.ListCommand;
-import com.onarandombox.MultiverseCore.commandsold.LoadCommand;
-import com.onarandombox.MultiverseCore.commandsold.ModifyAddCommand;
-import com.onarandombox.MultiverseCore.commandsold.ModifyClearCommand;
-import com.onarandombox.MultiverseCore.commandsold.ModifyCommand;
-import com.onarandombox.MultiverseCore.commandsold.ModifyRemoveCommand;
-import com.onarandombox.MultiverseCore.commandsold.ModifySetCommand;
-import com.onarandombox.MultiverseCore.commandsold.PurgeCommand;
-import com.onarandombox.MultiverseCore.commandsold.RegenCommand;
-import com.onarandombox.MultiverseCore.commandsold.ReloadCommand;
-import com.onarandombox.MultiverseCore.commandsold.RemoveCommand;
-import com.onarandombox.MultiverseCore.commandsold.ScriptCommand;
-import com.onarandombox.MultiverseCore.commandsold.SetSpawnCommand;
-import com.onarandombox.MultiverseCore.commandsold.SilentCommand;
-import com.onarandombox.MultiverseCore.commandsold.SpawnCommand;
-import com.onarandombox.MultiverseCore.commandsold.UnloadCommand;
-import com.onarandombox.MultiverseCore.commandsold.VersionCommand;
-import com.onarandombox.MultiverseCore.commandsold.WhoCommand;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.queue.CommandQueueManager;
+import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.destination.core.AnchorDestination;
import com.onarandombox.MultiverseCore.destination.core.BedDestination;
import com.onarandombox.MultiverseCore.destination.core.CannonDestination;
import com.onarandombox.MultiverseCore.destination.core.ExactDestination;
import com.onarandombox.MultiverseCore.destination.core.PlayerDestination;
-import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.destination.core.WorldDestination;
import com.onarandombox.MultiverseCore.event.MVDebugModeEvent;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
@@ -98,14 +66,12 @@ import com.onarandombox.MultiverseCore.utils.UnsafeCallWrapper;
import com.onarandombox.MultiverseCore.utils.VaultHandler;
import com.onarandombox.MultiverseCore.utils.WorldManager;
import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator;
-import com.pneumaticraft.commandhandler.CommandHandler;
import me.main__.util.SerializationConfig.NoSuchPropertyException;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location;
-import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.ConfigurationSection;
@@ -199,7 +165,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
}
// Setup our Map for our Commands using the CommandHandler.
- private CommandHandler commandHandler;
private MVCommandManager commandManager;
private CommandQueueManager commandQueueManager;
@@ -283,7 +248,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
this.ph = new MVPermissions(this);
// Setup the command manager
- this.commandHandler = new CommandHandler(this, this.ph);
this.commandManager = new MVCommandManager(this);
this.commandQueueManager = new CommandQueueManager(this);
// Call the Function to assign all the Commands to their Class.
@@ -736,46 +700,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
* Register Multiverse-Core commands to Command Manager.
*/
private void registerCommands() {
- // Intro Commands
- this.commandHandler.registerCommand(new HelpCommand(this));
- this.commandHandler.registerCommand(new VersionCommand(this));
- this.commandHandler.registerCommand(new ListCommand(this));
- this.commandHandler.registerCommand(new InfoCommand(this));
- this.commandHandler.registerCommand(new CloneCommand(this));
- this.commandHandler.registerCommand(new ImportCommand(this));
- this.commandHandler.registerCommand(new ReloadCommand(this));
- this.commandHandler.registerCommand(new SetSpawnCommand(this));
- this.commandHandler.registerCommand(new CoordCommand(this));
- this.commandHandler.registerCommand(new WhoCommand(this));
- this.commandHandler.registerCommand(new SpawnCommand(this));
- // Dangerous Commands
- this.commandHandler.registerCommand(new UnloadCommand(this));
- this.commandHandler.registerCommand(new LoadCommand(this));
- this.commandHandler.registerCommand(new RemoveCommand(this));
- this.commandHandler.registerCommand(new DeleteCommand(this));
- this.commandHandler.registerCommand(new RegenCommand(this));
- this.commandHandler.registerCommand(new ConfirmCommand(this));
- // Modification commands
- this.commandHandler.registerCommand(new ModifyCommand(this));
- this.commandHandler.registerCommand(new PurgeCommand(this));
- this.commandHandler.registerCommand(new ModifyAddCommand(this));
- this.commandHandler.registerCommand(new ModifySetCommand(this));
- this.commandHandler.registerCommand(new ModifyRemoveCommand(this));
- this.commandHandler.registerCommand(new ModifyClearCommand(this));
- this.commandHandler.registerCommand(new ConfigCommand(this));
- this.commandHandler.registerCommand(new AnchorCommand(this));
- // Misc Commands
- this.commandHandler.registerCommand(new EnvironmentCommand(this));
- this.commandHandler.registerCommand(new SilentCommand(this));
- this.commandHandler.registerCommand(new GeneratorCommand(this));
- this.commandHandler.registerCommand(new ScriptCommand(this));
- this.commandHandler.registerCommand(new GameruleCommand(this));
- this.commandHandler.registerCommand(new GamerulesCommand(this));
-
- //**NEW ACF COMMAND HANDLER**
- this.commandManager.registerCommand(new TeleportCommand(this));
- this.commandManager.registerCommand(new DebugCommand(this));
+ this.commandManager.registerCommand(new CheckCommand(this));
this.commandManager.registerCommand(new CreateCommand(this));
+ this.commandManager.registerCommand(new DebugCommand(this));
+ this.commandManager.registerCommand(new TeleportCommand(this));
}
/**
@@ -808,30 +736,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
return this.ph;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
- if (!this.isEnabled()) {
- sender.sendMessage("This plugin is Disabled!");
- return true;
- }
- ArrayList allArgs = new ArrayList(Arrays.asList(args));
- allArgs.add(0, command.getName());
- try {
- return this.commandHandler.locateAndRunCommand(sender, allArgs, getMVConfig().getDisplayPermErrors());
- } catch (Exception e) {
- e.printStackTrace();
- sender.sendMessage(ChatColor.RED + "An internal error occurred when attempting to perform this command.");
- if (sender.isOp())
- sender.sendMessage(ChatColor.RED + "Details were printed to the server console and logs, please add that to your bug report.");
- else
- sender.sendMessage(ChatColor.RED + "Try again and contact the server owner or an admin if this problem persists.");
- return true;
- }
- }
-
/**
* {@inheritDoc}
*/
@@ -857,14 +761,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
return authors.substring(2);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public CommandHandler getCommandHandler() {
- return this.commandHandler;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/com/onarandombox/MultiverseCore/api/Core.java b/src/main/java/com/onarandombox/MultiverseCore/api/Core.java
index bb004c92..51155749 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/api/Core.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/api/Core.java
@@ -19,7 +19,6 @@ import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
import com.onarandombox.MultiverseCore.utils.VaultHandler;
-import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.entity.Player;
/**
@@ -80,14 +79,6 @@ public interface Core {
*/
MVPermissions getMVPerms();
- /**
- * Multiverse uses {@link CommandHandler} to make adding and using commands
- * a piece of cake.
- *
- * @return A non-null {@link CommandHandler}.
- */
- CommandHandler getCommandHandler();
-
/**
* Multiverse uses {@link MVCommandManager} to make adding and using commands
* a piece of cake.
diff --git a/src/main/java/com/onarandombox/MultiverseCore/api/MultiversePlugin.java b/src/main/java/com/onarandombox/MultiverseCore/api/MultiversePlugin.java
index 90a9b33f..467e7e28 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/api/MultiversePlugin.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/api/MultiversePlugin.java
@@ -2,16 +2,10 @@ package com.onarandombox.MultiverseCore.api;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.plugin.java.JavaPlugin;
-
import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.pneumaticraft.commandhandler.CommandHandler;
+import org.bukkit.plugin.java.JavaPlugin;
/**
* Make things easier for MV-Plugins!
@@ -87,25 +81,6 @@ public abstract class MultiversePlugin extends JavaPlugin implements MVPlugin {
*/
protected abstract void onPluginEnable();
- /**
- * You can register commands here.
- * @param handler The CommandHandler.
- */
- protected abstract void registerCommands(CommandHandler handler);
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (!this.isEnabled()) {
- sender.sendMessage("This plugin is Disabled!");
- return true;
- }
-
- ArrayList allArgs = new ArrayList(args.length + 1);
- allArgs.add(command.getName());
- allArgs.addAll(Arrays.asList(args));
- return this.getCore().getCommandHandler().locateAndRunCommand(sender, allArgs);
- }
-
@Override
public final String dumpVersionInfo(String buffer) {
throw new UnsupportedOperationException("This is gone.");
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/CheckCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/CheckCommand.java
index 347b1f83..ea58fb73 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/commands/CheckCommand.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/commands/CheckCommand.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
@CommandAlias("mv")
public class CheckCommand extends MultiverseCommand {
- protected CheckCommand(@NotNull MultiverseCore plugin) {
+ public CheckCommand(@NotNull MultiverseCore plugin) {
super(plugin);
}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/AnchorCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/AnchorCommand.java
deleted file mode 100644
index 5009c270..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/AnchorCommand.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.Permission;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Allows management of Anchor Destinations.
- */
-public class AnchorCommand extends PaginatedCoreCommand {
-
- public AnchorCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Create, Delete and Manage Anchor Destinations.");
- this.setCommandUsage("/mv anchor " + ChatColor.GREEN + "{name}" + ChatColor.GOLD + " [-d]");
- this.setArgRange(0, 2);
- this.addKey("mv anchor");
- this.addKey("mv anchors");
- this.addKey("mvanchor");
- this.addKey("mvanchors");
- this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething");
- this.addCommandExample("/mv anchor " + ChatColor.GREEN + "otherthing");
- this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething " + ChatColor.RED + "-d");
- this.addCommandExample("/mv anchors ");
- this.setPermission("multiverse.core.anchor.list", "Allows a player to list all anchors.", PermissionDefault.OP);
- this.addAdditonalPermission(new Permission("multiverse.core.anchor.create",
- "Allows a player to create anchors.", PermissionDefault.OP));
- this.addAdditonalPermission(new Permission("multiverse.core.anchor.delete",
- "Allows a player to delete anchors.", PermissionDefault.OP));
- this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
- }
-
- private List getFancyAnchorList(Player p) {
- List anchorList = new ArrayList();
- ChatColor color = ChatColor.GREEN;
- for (String anchor : this.plugin.getAnchorManager().getAnchors(p)) {
- anchorList.add(color + anchor);
- color = (color == ChatColor.GREEN) ? ChatColor.GOLD : ChatColor.GREEN;
- }
- return anchorList;
- }
-
- private void showList(CommandSender sender, List args) {
- if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.list", true)) {
- sender.sendMessage(ChatColor.RED + "You don't have the permission to list anchors!");
- return;
- }
-
- sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse Anchor List ]====");
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
-
-
- FilterObject filterObject = this.getPageAndFilter(args);
-
- List availableAnchors = new ArrayList(this.getFancyAnchorList(p));
- if (filterObject.getFilter().length() > 0) {
- availableAnchors = this.getFilteredItems(availableAnchors, filterObject.getFilter());
- if (availableAnchors.size() == 0) {
- sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
- + "No anchors matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
- return;
- }
- } else {
- if (availableAnchors.size() == 0) {
- sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No anchors were defined.");
- return;
- }
- }
-
-
- if (!(sender instanceof Player)) {
- for (String c : availableAnchors) {
- sender.sendMessage(c);
- }
- return;
- }
-
- int totalPages = (int) Math.ceil(availableAnchors.size() / (this.itemsPerPage + 0.0));
-
- if (filterObject.getPage() > totalPages) {
- filterObject.setPage(totalPages);
- } else if (filterObject.getPage() < 1) {
- filterObject.setPage(1);
- }
-
- sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
-
- this.showPage(filterObject.getPage(), sender, availableAnchors);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (args.size() == 0) {
- this.showList(sender, args);
- return;
- }
- if (args.size() == 1 && (this.getPageAndFilter(args).getPage() != 1 || args.get(0).equals("1"))) {
- this.showList(sender, args);
- return;
- }
- if (args.size() == 2 && args.get(1).equalsIgnoreCase("-d")) {
- if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.delete", true)) {
- sender.sendMessage(ChatColor.RED + "You don't have the permission to delete anchors!");
- } else {
- if (this.plugin.getAnchorManager().deleteAnchor(args.get(0))) {
- sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.RED + "deleted!");
- } else {
- sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "deleted!");
- }
- }
- return;
- }
-
- if (!(sender instanceof Player)) {
- sender.sendMessage("You must be a player to create Anchors.");
- return;
- }
-
- if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.create", true)) {
- sender.sendMessage(ChatColor.RED + "You don't have the permission to create anchors!");
- } else {
- Player player = (Player) sender;
- if (this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), player.getLocation())) {
- sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.GREEN + "created!");
- } else {
- sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "created!");
- }
- }
- }
-
- @Override
- protected List getFilteredItems(List availableItems, String filter) {
- List filtered = new ArrayList();
- for (String s : availableItems) {
- if (s.matches("(?i).*" + filter + ".*")) {
- filtered.add(s);
- }
- }
- return filtered;
- }
-
- @Override
- protected String getItemText(String item) {
- return item;
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/CloneCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/CloneCommand.java
deleted file mode 100644
index 7f2a2efe..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/CloneCommand.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import java.util.List;
-
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-
-/**
- * Creates a clone of a world.
- */
-public class CloneCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public CloneCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Clone World");
- this.setCommandUsage("/mv clone" + ChatColor.GREEN + " {TARGET} {NAME}" + ChatColor.GOLD + " -g [GENERATOR[:ID]]");
- this.setArgRange(2, 4); // SUPPRESS CHECKSTYLE: MagicNumberCheck
- this.addKey("mvclone");
- this.addKey("mvcl");
- this.addKey("mv cl");
- this.addKey("mv clone");
- this.addCommandExample("/mv clone " + ChatColor.GOLD + "world" + ChatColor.GREEN + " world_backup");
- this.addCommandExample("/mv clone " + ChatColor.GOLD + "skyblock_pristine" + ChatColor.GREEN + " skyblock");
- this.setPermission("multiverse.core.clone", "Clones a world.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- String oldName = args.get(0);
- if (!this.worldManager.hasUnloadedWorld(oldName, true)) {
- // If no world was found, we can't clone.
- sender.sendMessage("Sorry, Multiverse doesn't know about world " + oldName + ", so we can't clone it!");
- sender.sendMessage("Check the " + ChatColor.GREEN + "/mv list" + ChatColor.WHITE + " command to verify it is listed.");
- return;
- }
- if (this.plugin.getMVWorldManager().cloneWorld(oldName, args.get(1))) {
- sender.sendMessage(ChatColor.GREEN + "World cloned!");
- } else {
- sender.sendMessage(ChatColor.RED + "World could NOT be cloned!");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ConfigCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ConfigCommand.java
deleted file mode 100644
index e454dd95..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ConfigCommand.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Allows you to set Global MV Variables.
- */
-public class ConfigCommand extends MultiverseCommand {
- public ConfigCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Configuration");
- this.setCommandUsage("/mv config " + ChatColor.GREEN + "{PROPERTY} {VALUE}");
- this.setArgRange(1, 2);
- this.addKey("mv config");
- this.addKey("mvconfig");
- this.addKey("mv conf");
- this.addKey("mvconf");
- this.addCommandExample("/mv config show");
- this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
- this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
- this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (args.size() <= 1) {
- StringBuilder builder = new StringBuilder();
- Map serializedConfig = this.plugin.getMVConfig().serialize();
- for (Map.Entry entry : serializedConfig.entrySet()) {
- builder.append(ChatColor.GREEN);
- builder.append(entry.getKey());
- builder.append(ChatColor.WHITE).append(" = ").append(ChatColor.GOLD);
- builder.append(entry.getValue().toString());
- builder.append(ChatColor.WHITE).append(", ");
- }
- String message = builder.toString();
- message = message.substring(0, message.length() - 2);
- sender.sendMessage(message);
- return;
- }
- if (!this.plugin.getMVConfig().setConfigProperty(args.get(0).toLowerCase(), args.get(1))) {
- sender.sendMessage(String.format("%sSetting '%s' to '%s' failed!", ChatColor.RED, args.get(0).toLowerCase(), args.get(1)));
- return;
- }
-
- // special rule
- if (args.get(0).equalsIgnoreCase("firstspawnworld")) {
- // Don't forget to set the world!
- this.plugin.getMVWorldManager().setFirstSpawnWorld(args.get(1));
- }
-
- if (this.plugin.saveMVConfigs()) {
- sender.sendMessage(ChatColor.GREEN + "SUCCESS!" + ChatColor.WHITE + " Values were updated successfully!");
- this.plugin.loadConfigs();
- } else {
- sender.sendMessage(ChatColor.RED + "FAIL!" + ChatColor.WHITE + " Check your console for details!");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ConfirmCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ConfirmCommand.java
deleted file mode 100644
index c216ca37..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ConfirmCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Confirms actions.
- */
-public class ConfirmCommand extends MultiverseCommand {
-
- public ConfirmCommand(MultiverseCore plugin) {
- super(plugin);
- // Any command that is dangerous should require op
- this.setName("Confirms a command that could destroy life, the universe and everything.");
- this.setCommandUsage("/mv confirm");
- this.setArgRange(0, 0);
- this.addKey("mvconfirm");
- this.addKey("mv confirm");
- this.addCommandExample("/mv confirm");
- this.setPermission("multiverse.core.confirm", "If you have not been prompted to use this, it will not do anything.", PermissionDefault.OP);
-
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- this.plugin.getCommandQueueManager().runQueuedCommand(sender);
- }
-
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/CoordCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/CoordCommand.java
deleted file mode 100644
index b7ce8553..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/CoordCommand.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import org.bukkit.ChatColor;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.text.DecimalFormat;
-import java.util.List;
-
-/**
- * Returns detailed information on the Players where abouts.
- */
-public class CoordCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public CoordCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Coordinates");
- this.setCommandUsage("/mv coord");
- this.setArgRange(0, 0);
- this.addKey("mv coord");
- this.addKey("mvcoord");
- this.addKey("mvco");
- this.addCommandExample("/mv coord");
- this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // Check if the command was sent from a Player.
- if (sender instanceof Player) {
- Player p = (Player) sender;
- World world = p.getWorld();
-
- if (!this.worldManager.isMVWorld(world.getName())) {
- this.plugin.showNotMVWorldMessage(sender, world.getName());
- return;
- }
-
- MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName());
-
- p.sendMessage(ChatColor.AQUA + "--- Location Information ---");
- p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());
- p.sendMessage(ChatColor.AQUA + "Alias: " + mvworld.getColoredWorldString());
- p.sendMessage(ChatColor.AQUA + "World Scale: " + ChatColor.WHITE + mvworld.getScaling());
- DecimalFormat df = new DecimalFormat();
- df.setMinimumFractionDigits(0);
- df.setMaximumFractionDigits(2);
- p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + plugin.getLocationManipulation().strCoords(p.getLocation()));
- p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + plugin.getLocationManipulation().getDirection(p.getLocation()));
- p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + world.getBlockAt(p.getLocation()).getType());
- } else {
- sender.sendMessage("This command needs to be used from a Player.");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/CreateCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/CreateCommand.java
deleted file mode 100644
index 750c9e62..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/CreateCommand.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.pneumaticraft.commandhandler.CommandHandler;
-import org.bukkit.ChatColor;
-import org.bukkit.World.Environment;
-import org.bukkit.WorldType;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Creates a new world and loads it.
- */
-public class CreateCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public CreateCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Create World");
- this.setCommandUsage(String.format("/mv create %s{NAME} {ENV} %s-s [SEED] -g [GENERATOR[:ID]] -t [WORLDTYPE] [-n] -a [true|false]",
- ChatColor.GREEN, ChatColor.GOLD));
- this.setArgRange(2, 11); // SUPPRESS CHECKSTYLE: MagicNumberCheck
- this.addKey("mvcreate");
- this.addKey("mvc");
- this.addKey("mv create");
- this.setPermission("multiverse.core.create", "Creates a new world and loads it.", PermissionDefault.OP);
- this.addCommandExample("/mv create " + ChatColor.GOLD + "world" + ChatColor.GREEN + " normal");
- this.addCommandExample("/mv create " + ChatColor.GOLD + "lavaland" + ChatColor.RED + " nether");
- this.addCommandExample("/mv create " + ChatColor.GOLD + "starwars" + ChatColor.AQUA + " end");
- this.addCommandExample("/mv create " + ChatColor.GOLD + "flatroom" + ChatColor.GREEN + " normal" + ChatColor.AQUA + " -t flat");
- this.addCommandExample("/mv create " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -s gargamel");
- this.addCommandExample("/mv create " + ChatColor.GOLD + "moonworld" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -g BukkitFullOfMoon");
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- private String trimWorldName(String userInput) {
- // Removes relative paths.
- return userInput.replaceAll("^[./\\\\]+", "");
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- String worldName = trimWorldName(args.get(0));
- File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
- String env = args.get(1);
- String seed = CommandHandler.getFlag("-s", args);
- String generator = CommandHandler.getFlag("-g", args);
- boolean allowStructures = true;
- String structureString = CommandHandler.getFlag("-a", args);
- if (structureString != null) {
- allowStructures = Boolean.parseBoolean(structureString);
- }
- String typeString = CommandHandler.getFlag("-t", args);
- boolean useSpawnAdjust = true;
- for (String s : args) {
- if (s.equalsIgnoreCase("-n")) {
- useSpawnAdjust = false;
- }
- }
-
- // Make sure the world name doesn't contain the words 'plugins' and '.dat'
- if(worldName.contains("plugins")||worldName.contains(".dat")){
- sender.sendMessage(ChatColor.RED + "Multiverse cannot create a world that contains 'plugins' or '.dat'");
- return;
- }
-
- if (this.worldManager.isMVWorld(worldName)) {
- sender.sendMessage(ChatColor.RED + "Multiverse cannot create " + ChatColor.GOLD + ChatColor.UNDERLINE
- + "another" + ChatColor.RESET + ChatColor.RED + " world named " + worldName);
- return;
- }
-
- if (worldFile.exists()) {
- sender.sendMessage(ChatColor.RED + "A Folder/World already exists with this name!");
- sender.sendMessage(ChatColor.RED + "If you are confident it is a world you can import with /mvimport");
- return;
- }
-
- Environment environment = EnvironmentCommand.getEnvFromString(env);
- if (environment == null) {
- sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
- EnvironmentCommand.showEnvironments(sender);
- return;
- }
-
- // If they didn't specify a type, default to NORMAL
- if (typeString == null) {
- typeString = "NORMAL";
- }
- WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString);
- if (type == null) {
- sender.sendMessage(ChatColor.RED + "That is not a valid World Type.");
- EnvironmentCommand.showWorldTypes(sender);
- return;
- }
- // Determine if the generator is valid. #918
- if (generator != null) {
- List genarray = new ArrayList(Arrays.asList(generator.split(":")));
- if (genarray.size() < 2) {
- // If there was only one arg specified, pad with another empty one.
- genarray.add("");
- }
- if (this.worldManager.getChunkGenerator(genarray.get(0), genarray.get(1), "test") == null) {
- // We have an invalid generator.
- sender.sendMessage("Invalid generator! '" + generator + "'. " + ChatColor.RED + "Aborting world creation.");
- return;
- }
- }
- Command.broadcastCommandMessage(sender, "Starting creation of world '" + worldName + "'...");
-
- if (this.worldManager.addWorld(worldName, environment, seed, type, allowStructures, generator, useSpawnAdjust)) {
- Command.broadcastCommandMessage(sender, "Complete!");
- } else {
- Command.broadcastCommandMessage(sender, "FAILED.");
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/DebugCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/DebugCommand.java
deleted file mode 100644
index 81a7f74f..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/DebugCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.dumptruckman.minecraft.util.Logging;
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Enables debug-information.
- */
-public class DebugCommand extends MultiverseCommand {
-
- public DebugCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Turn Debug on/off?");
- this.setCommandUsage("/mv debug" + ChatColor.GOLD + " [1|2|3|off|silent]");
- this.setArgRange(0, 1);
- this.addKey("mv debug");
- this.addKey("mv d");
- this.addKey("mvdebug");
- this.addCommandExample("/mv debug " + ChatColor.GOLD + "2");
- this.setPermission("multiverse.core.debug", "Spams the console a bunch.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (args.size() == 1) {
- if (args.get(0).equalsIgnoreCase("off")) {
- plugin.getMVConfig().setGlobalDebug(0);
- } else {
- try {
- int debugLevel = Integer.parseInt(args.get(0));
- if (debugLevel > 3 || debugLevel < 0) {
- throw new NumberFormatException();
- }
- plugin.getMVConfig().setGlobalDebug(debugLevel);
- } catch (NumberFormatException e) {
- sender.sendMessage(ChatColor.RED + "Error" + ChatColor.WHITE
- + " setting debug level. Please use a number 0-3 " + ChatColor.AQUA + "(3 being many many messages!)");
- }
- }
- plugin.saveMVConfigs();
- }
- this.displayDebugMode(sender);
- }
-
- private void displayDebugMode(CommandSender sender) {
- final int debugLevel = plugin.getMVConfig().getGlobalDebug();
- if (debugLevel == 0) {
- sender.sendMessage("Multiverse Debug mode is " + ChatColor.RED + "OFF");
- } else {
- sender.sendMessage("Multiverse Debug mode is " + ChatColor.GREEN + debugLevel);
- Logging.fine("Multiverse Debug ENABLED");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/DeleteCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/DeleteCommand.java
deleted file mode 100644
index 85157d16..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/DeleteCommand.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * Deletes worlds.
- */
-public class DeleteCommand extends MultiverseCommand {
-
- public DeleteCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Delete World");
- this.setCommandUsage("/mv delete" + ChatColor.GREEN + " {WORLD}");
- this.setArgRange(1, 1);
- this.addKey("mvdelete");
- this.addKey("mv delete");
- this.addCommandExample("/mv delete " + ChatColor.GOLD + "MyWorld");
- this.setPermission("multiverse.core.delete", "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- String worldName = args.get(0);
-
- this.plugin.getCommandQueueManager().addToQueue(new QueuedCommand(
- sender,
- deleteRunnable(sender, worldName),
- String.format("Are you sure you want to delete world '%s'? You cannot undo this action.", worldName)
- ));
- }
-
- private Runnable deleteRunnable(@NotNull CommandSender sender,
- @NotNull String worldName) {
-
- return () -> {
- sender.sendMessage(String.format("Deleting world '%s'...", worldName));
- if (this.plugin.getMVWorldManager().deleteWorld(worldName)) {
- sender.sendMessage(String.format("%sWorld %s was deleted!", ChatColor.GREEN, worldName));
- return;
- }
- sender.sendMessage(String.format("%sThere was an issue deleting '%s'! Please check console for errors.",
- ChatColor.RED, worldName));
- };
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/EnvironmentCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/EnvironmentCommand.java
deleted file mode 100644
index 9fc85cd4..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/EnvironmentCommand.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.World;
-import org.bukkit.WorldType;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Lists valid known environments.
- */
-public class EnvironmentCommand extends MultiverseCommand {
-
- public EnvironmentCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("List Environments");
- this.setCommandUsage("/mv env");
- this.setArgRange(0, 0);
- this.addKey("mvenv");
- this.addKey("mv env");
- this.addKey("mv type");
- this.addKey("mv environment");
- this.addKey("mv environments");
- this.addCommandExample("/mv env");
- this.setPermission("multiverse.core.list.environments", "Lists valid known environments/world types.", PermissionDefault.OP);
- }
-
- /**
- * Shows all valid known environments to a {@link CommandSender}.
- *
- * @param sender The {@link CommandSender}.
- */
- public static void showEnvironments(CommandSender sender) {
- sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
- sender.sendMessage(ChatColor.GREEN + "NORMAL");
- sender.sendMessage(ChatColor.RED + "NETHER");
- sender.sendMessage(ChatColor.AQUA + "END");
- }
- /**
- * Shows all valid known world types to a {@link CommandSender}.
- *
- * @param sender The {@link CommandSender}.
- */
- public static void showWorldTypes(CommandSender sender) {
- sender.sendMessage(ChatColor.YELLOW + "Valid World Types are:");
- sender.sendMessage(String.format("%sNORMAL%s, %sFLAT, %sLARGEBIOMES %sor %sVERSION_1_1",
- ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA, ChatColor.RED, ChatColor.WHITE, ChatColor.GOLD));
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- EnvironmentCommand.showEnvironments(sender);
- EnvironmentCommand.showWorldTypes(sender);
- }
-
- /**
- * Converts a {@link String} into a {@link WorldType}.
- *
- * @param type The WorldType as a {@link String}
- * @return The WorldType as a {@link WorldType}
- */
- public static WorldType getWorldTypeFromString(String type) {
- // Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
- if (type.equalsIgnoreCase("normal")) {
- type = "NORMAL";
- } else if (type.equalsIgnoreCase("flat")) {
- type = "FLAT";
- } else if (type.equalsIgnoreCase("largebiomes")) {
- type = "LARGE_BIOMES";
- } else if (type.equalsIgnoreCase("amplified")) {
- type = "AMPLIFIED";
- }
- try {
- // Now that we've converted a potentially unfriendly value
- // to a friendly one, get it from the ENUM!
- return WorldType.valueOf(type);
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
-
- /**
- * Converts a {@link String} into an {@link org.bukkit.World.Environment}.
- *
- * @param env The environment as {@link String}
- * @return The environment as {@link org.bukkit.World.Environment}
- */
- public static World.Environment getEnvFromString(String env) {
- env = env.toUpperCase();
- // Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
- if (env.equalsIgnoreCase("HELL") || env.equalsIgnoreCase("NETHER"))
- env = "NETHER";
-
- if (env.equalsIgnoreCase("END") || env.equalsIgnoreCase("THEEND") || env.equalsIgnoreCase("STARWARS"))
- env = "THE_END";
-
- if (env.equalsIgnoreCase("NORMAL") || env.equalsIgnoreCase("WORLD"))
- env = "NORMAL";
-
- try {
- // Now that we've converted a potentially unfriendly value
- // to a friendly one, get it from the ENUM!
- return World.Environment.valueOf(env);
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/GameruleCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/GameruleCommand.java
deleted file mode 100644
index 053c9f23..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/GameruleCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.GameRule;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Allows management of Anchor Destinations.
- */
-public class GameruleCommand extends MultiverseCommand {
-
- public GameruleCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Set a Minecraft Game Rule for a World.");
- this.setCommandUsage("/mv gamerule " + ChatColor.GREEN + "{RULE} {VALUE}" + ChatColor.GOLD + " [WORLD]");
- this.setArgRange(2, 3);
- this.addKey("mv gamerule");
- this.addKey("mv rule");
- this.addKey("mvgamerule");
- this.addKey("mvrule");
- this.addCommandExample("/mv gamerule " + ChatColor.GREEN + "doMobLoot false");
- this.addCommandExample("/mvrule " + ChatColor.GREEN + "keepInventory true " + ChatColor.RED + "world_nether");
- this.setPermission("multiverse.core.gamerule.set", "Allows a player to set a gamerule.", PermissionDefault.OP);
- }
-
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // We NEED a world from the command line
- final Player p;
- if (sender instanceof Player) {
- p = (Player) sender;
- } else {
- p = null;
- }
-
- if (args.size() == 2 && p == null) {
- sender.sendMessage("From the command line, WORLD is required.");
- sender.sendMessage(this.getCommandDesc());
- sender.sendMessage(this.getCommandUsage());
- sender.sendMessage("Nothing changed.");
- return;
- }
-
- final GameRule gameRule = GameRule.getByName(args.get(0));
- final String value = args.get(1);
- final World world;
- if (args.size() == 2) {
- world = p.getWorld();
- } else {
- world = Bukkit.getWorld(args.get(2));
- if (world == null) {
- sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " World " + ChatColor.AQUA + args.get(2)
- + ChatColor.WHITE + " does not exist.");
- return;
- }
- }
-
- if (gameRule == null) {
- sender.sendMessage(ChatColor.RED + "Failure! " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE
- + " is not a valid gamerule.");
- } else {
- if (gameRule.getType() == Boolean.class) {
- boolean booleanValue;
- if (value.equalsIgnoreCase("true")) {
- booleanValue = true;
- } else if (value.equalsIgnoreCase("false")) {
- booleanValue = false;
- } else {
- sender.sendMessage(getErrorMessage(gameRule.getName(), value) + "it can only be set to true or false.");
- return;
- }
-
- if (!world.setGameRule(gameRule, booleanValue)) {
- sender.sendMessage(getErrorMessage(gameRule.getName(), value) + "something went wrong.");
- return;
- }
- } else if (gameRule.getType() == Integer.class) {
- try {
- if (!world.setGameRule(gameRule, Integer.parseInt(value))) {
- throw new NumberFormatException();
- }
- } catch (NumberFormatException e) {
- sender.sendMessage(getErrorMessage(gameRule.getName(), value) + "it can only be set to a positive integer.");
- return;
- }
- } else {
- sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " Gamerule " + ChatColor.AQUA + gameRule.getName()
- + ChatColor.WHITE + " isn't supported yet, please let us know about it.");
- return;
- }
-
- sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Gamerule " + ChatColor.AQUA + gameRule.getName()
- + ChatColor.WHITE + " was set to " + ChatColor.GREEN + value + ChatColor.WHITE + ".");
- }
- }
-
- private String getErrorMessage(String gameRule, String value) {
- return ChatColor.RED + "Failure!" + ChatColor.WHITE + " Gamerule " + ChatColor.AQUA + gameRule
- + ChatColor.WHITE + " could not be set to " + ChatColor.RED + value + ChatColor.WHITE + ", ";
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/GamerulesCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/GamerulesCommand.java
deleted file mode 100644
index 4a8726df..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/GamerulesCommand.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.display.ContentDisplay;
-import com.onarandombox.MultiverseCore.display.filters.ContentFilter;
-import com.onarandombox.MultiverseCore.display.filters.DefaultContentFilter;
-import com.onarandombox.MultiverseCore.display.filters.RegexContentFilter;
-import com.onarandombox.MultiverseCore.display.handlers.InlineSendHandler;
-import com.onarandombox.MultiverseCore.display.parsers.MapContentParser;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.GameRule;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Allows management of Anchor Destinations.
- */
-public class GamerulesCommand extends MultiverseCommand {
-
- public GamerulesCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("List the Minecraft Game Rules for a World.");
- this.setCommandUsage("/mv gamerules" + ChatColor.GOLD + " [WORLD] [FILTER]");
- this.setArgRange(0, 2);
- this.addKey("mv gamerules");
- this.addKey("mv rules");
- this.addKey("mvgamerules");
- this.addKey("mvrules");
- this.addCommandExample("/mv gamerules");
- this.addCommandExample("/mvrules " + ChatColor.RED + "world_nether");
- this.setPermission("multiverse.core.gamerule.list", "Allows a player to list gamerules.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // We NEED a world from the command line
- Player p;
- World world;
- ContentFilter filter = DefaultContentFilter.getInstance();
-
- if (sender instanceof Player) {
- p = (Player) sender;
- } else {
- p = null;
- }
-
- if (args.size() == 0 && p == null) {
- sender.sendMessage("From the command line, WORLD is required.");
- sender.sendMessage(this.getCommandDesc());
- sender.sendMessage(this.getCommandUsage());
- sender.sendMessage("Nothing changed.");
- return;
- }
-
- // Not the best way, need to fix with ACF soon...
- if (args.size() == 0) {
- world = p.getWorld();
- } else if (args.size() == 1) {
- world = Bukkit.getWorld(args.get(0));
- if (world == null) {
- if (p == null) {
- sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " World " + ChatColor.AQUA + args.get(0)
- + ChatColor.WHITE + " does not exist.");
- return;
- }
- world = p.getWorld();
- filter = RegexContentFilter.fromString(args.get(0));
- }
- } else {
- world = Bukkit.getWorld(args.get(0));
- if (world == null) {
- sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " World " + ChatColor.AQUA + args.get(0)
- + ChatColor.WHITE + " does not exist.");
- return;
- }
- filter = RegexContentFilter.fromString(args.get(1));
- }
-
- ContentDisplay.create()
- .addContentParser(MapContentParser.forContent(getGameRuleMap(world))
- .withKeyColor(ChatColor.GREEN)
- .withValueColor(ChatColor.YELLOW))
- .withSendHandler(InlineSendHandler.create()
- .withHeader("====[ Gamerules for %s%s%s ]====", ChatColor.AQUA, world.getName(), ChatColor.WHITE)
- .withFilter(filter))
- .send(sender);
- }
-
- private Map getGameRuleMap(World world) {
- Map gameRuleMap = new HashMap<>();
- for (GameRule> rule : GameRule.values()) {
- Object value = world.getGameRuleValue(rule);
- gameRuleMap.put(rule.getName(), value);
- }
- return gameRuleMap;
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/GeneratorCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/GeneratorCommand.java
deleted file mode 100644
index 342d71a1..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/GeneratorCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.dumptruckman.minecraft.util.Logging;
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-import org.bukkit.plugin.Plugin;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Returns a list of loaded generator plugins.
- */
-public class GeneratorCommand extends MultiverseCommand {
-
- public GeneratorCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("World Information");
- this.setCommandUsage("/mv generators");
- this.setArgRange(0, 0);
- this.addKey("mv generators");
- this.addKey("mvgenerators");
- this.addKey("mv gens");
- this.addKey("mvgens");
- this.addCommandExample("/mv generators");
- this.setPermission("multiverse.core.generator", "Returns a list of Loaded Generator Plugins.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- Logging.info("PLEASE IGNORE the 'Plugin X does not contain any generators' message below!");
- Plugin[] plugins = this.plugin.getServer().getPluginManager().getPlugins();
- List generators = new ArrayList();
- for (Plugin p : plugins) {
- if (p.isEnabled() && p.getDefaultWorldGenerator("world", "") != null) {
- generators.add(p.getDescription().getName());
- }
- }
- sender.sendMessage(ChatColor.AQUA + "--- Loaded Generator Plugins ---");
- String loadedGens = "";
- boolean altColor = false;
- for (String s : generators) {
- loadedGens += (altColor ? ChatColor.YELLOW : ChatColor.WHITE) + s + " ";
- altColor = !altColor;
- }
- if (loadedGens.length() == 0) {
- loadedGens = ChatColor.RED + "No Generator Plugins found.";
- }
- sender.sendMessage(loadedGens);
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/HelpCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/HelpCommand.java
deleted file mode 100644
index 42cbf978..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/HelpCommand.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.pneumaticraft.commandhandler.Command;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Displays a nice help menu.
- */
-public class HelpCommand extends PaginatedCoreCommand {
-
- public HelpCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Get Help with Multiverse");
- this.setCommandUsage("/mv " + ChatColor.GOLD + "[FILTER] [PAGE #]");
- this.setArgRange(0, 2);
- this.addKey("mv");
- this.addKey("mvh");
- this.addKey("mvhelp");
- this.addKey("mv help");
- this.addKey("mvsearch");
- this.addKey("mv search");
- this.addCommandExample("/mv help ?");
- this.setPermission("multiverse.help", "Displays a nice help menu.", PermissionDefault.TRUE);
- this.setItemsPerPage(7); // SUPPRESS CHECKSTYLE: MagicNumberCheck
- }
-
- @Override
- protected List getFilteredItems(List availableItems, String filter) {
- String expression = "(?i).*" + cleanFilter(filter) + ".*";
- List filtered = new ArrayList();
-
- for (Command c : availableItems) {
- if (stitchThisString(c.getKeyStrings()).matches(expression)
- || c.getCommandName().matches(expression)
- || c.getCommandDesc().matches(expression)
- || c.getCommandUsage().matches(expression)
- || c.getCommandExamples().stream().anyMatch(eg -> eg.matches(expression))) {
- filtered.add(c);
- }
- }
- return filtered;
- }
-
- @Override
- protected String getItemText(Command item) {
- return ChatColor.AQUA + item.getCommandUsage();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
-
- FilterObject filterObject = this.getPageAndFilter(args);
-
- List availableCommands = new ArrayList(this.plugin.getCommandHandler().getCommands(sender));
- if (filterObject.getFilter().length() > 0) {
- availableCommands = this.getFilteredItems(availableCommands, filterObject.getFilter());
- if (availableCommands.size() == 0) {
- sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
- + "No commands matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
- return;
- }
- }
-
- if (!(sender instanceof Player)) {
- sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
- for (Command c : availableCommands) {
- sender.sendMessage(ChatColor.AQUA + c.getCommandUsage());
- }
- return;
- }
-
- int totalPages = (int) Math.ceil(availableCommands.size() / (this.itemsPerPage + 0.0));
-
- if (filterObject.getPage() > totalPages) {
- filterObject.setPage(totalPages);
- }
-
- sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
- sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
-
- this.showPage(filterObject.getPage(), sender, availableCommands);
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ImportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ImportCommand.java
deleted file mode 100644
index 9d44dbcf..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ImportCommand.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.utils.WorldNameChecker;
-import com.pneumaticraft.commandhandler.CommandHandler;
-import org.bukkit.ChatColor;
-import org.bukkit.World.Environment;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Imports a new world of the specified type.
- */
-public class ImportCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public ImportCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Import World");
- this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -g [GENERATOR[:ID]] [-n]");
- this.setArgRange(1, 5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
- this.addKey("mvimport");
- this.addKey("mvim");
- this.addKey("mv import");
- this.addCommandExample("/mv import " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal");
- this.addCommandExample("/mv import " + ChatColor.GOLD + "hell_world" + ChatColor.GREEN + " nether");
- this.addCommandExample("To import a world that uses a generator, you'll need the generator:");
- this.addCommandExample("/mv import " + ChatColor.GOLD + "CleanRoom" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " CleanRoomGenerator");
- this.setPermission("multiverse.core.import", "Imports a new world of the specified type.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- private String getPotentialWorldStrings() {
- final Collection potentialWorlds = this.worldManager.getPotentialWorlds();
- StringBuilder worldList = new StringBuilder();
- ChatColor currColor = ChatColor.WHITE;
-
- for (String world : potentialWorlds) {
- worldList.append(currColor).append(world).append(' ');
- currColor = currColor == ChatColor.WHITE ? ChatColor.YELLOW : ChatColor.WHITE;
- }
-
- return worldList.toString();
- }
-
- private String trimWorldName(String userInput) {
- // Removes relative paths.
- return userInput.replaceAll("^[./\\\\]+", "");
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- String worldName = trimWorldName(args.get(0));
-
- if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) {
- String worldList = this.getPotentialWorldStrings();
- if (worldList.length() > 2) {
- sender.sendMessage(ChatColor.AQUA + "====[ These look like worlds ]====");
- sender.sendMessage(worldList);
- } else {
- sender.sendMessage(ChatColor.RED + "No potential worlds found. Sorry!");
- }
- return;
- }
- // Since we made an exception for the list, we have to make sure they have at least 2 params:
- // Note the exception is --list, which is covered above.
- if (args.size() == 1 || worldName.length() < 1) {
- this.showHelp(sender);
- return;
- }
-
- // Make sure the world name doesn't contain the words 'plugins' and '.dat'
- if(worldName.contains("plugins")||worldName.contains(".dat")){
- sender.sendMessage(ChatColor.RED + "Multiverse cannot create a world that contains 'plugins' or '.dat'");
- return;
- }
-
- // Make sure we don't already know about this world.
- if (this.worldManager.isMVWorld(worldName)) {
- sender.sendMessage(ChatColor.GREEN + "Multiverse" + ChatColor.WHITE
- + " already knows about '" + ChatColor.AQUA + worldName + ChatColor.WHITE + "'!");
- return;
- }
-
- File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
-
- String generator = CommandHandler.getFlag("-g", args);
- boolean useSpawnAdjust = true;
- for (String s : args) {
- if (s.equalsIgnoreCase("-n")) {
- useSpawnAdjust = false;
- }
- }
-
- String env = args.get(1);
- Environment environment = EnvironmentCommand.getEnvFromString(env);
- if (environment == null) {
- sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
- EnvironmentCommand.showEnvironments(sender);
- return;
- }
-
- if (!worldFile.exists()) {
- sender.sendMessage(ChatColor.RED + "FAILED.");
- String worldList = this.getPotentialWorldStrings();
- sender.sendMessage("That world folder does not exist. These look like worlds to me:");
- sender.sendMessage(worldList);
- } else if (!WorldNameChecker.isValidWorldFolder(worldFile)) {
- sender.sendMessage(ChatColor.RED + "FAILED.");
- sender.sendMessage(String.format("'%s' does not appear to be a world. It is lacking a .dat file.",
- worldName));
- } else if (env == null) {
- sender.sendMessage(ChatColor.RED + "FAILED.");
- sender.sendMessage("That world environment did not exist.");
- sender.sendMessage("For a list of available world types, type: " + ChatColor.AQUA + "/mvenv");
- } else {
- Command.broadcastCommandMessage(sender, String.format("Starting import of world '%s'...", worldName));
- if (this.worldManager.addWorld(worldName, environment, null, null, null, generator, useSpawnAdjust))
- Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Complete!");
- else
- Command.broadcastCommandMessage(sender, ChatColor.RED + "Failed!");
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/InfoCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/InfoCommand.java
deleted file mode 100644
index 579f271d..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/InfoCommand.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.FancyText;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.utils.FancyColorScheme;
-import com.onarandombox.MultiverseCore.utils.FancyHeader;
-import com.onarandombox.MultiverseCore.utils.FancyMessage;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.ArrayList;
-import java.util.List;
-
-// Will use when we can compile with JDK 6
-//import com.sun.xml.internal.ws.util.StringUtils;
-
-/**
- * Returns detailed information about a world.
- */
-public class InfoCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public InfoCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("World Information");
- this.setCommandUsage("/mv info" + ChatColor.GOLD + " [WORLD] [PAGE]");
- this.setArgRange(0, 2);
- this.addKey("mvinfo");
- this.addKey("mvi");
- this.addKey("mv info");
- this.addCommandExample("/mv info " + ChatColor.GOLD + "1");
- this.addCommandExample("/mv info " + ChatColor.GOLD + "3");
- this.setPermission("multiverse.core.info", "Returns detailed information on the world.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // Check if the command was sent from a Player.
- String worldName = "";
- int pageNum = 0;
-
- if (args.size() == 0) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- worldName = p.getWorld().getName();
- } else {
- sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
- return;
- }
- } else if (args.size() == 1) {
- if (this.worldManager.isMVWorld(args.get(0))) {
- // then we have a world!
- worldName = args.get(0);
- } else if (this.worldManager.getUnloadedWorlds().contains(args.get(0))) {
- sender.sendMessage("That world exists, but it is unloaded!");
- sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, args.get(0)));
- return;
- } else {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- worldName = p.getWorld().getName();
- try {
- pageNum = Integer.parseInt(args.get(0)) - 1;
- } catch (NumberFormatException e) {
- sender.sendMessage("That world does not exist.");
- return;
- }
- } else {
- sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
- return;
- }
- }
- } else if (args.size() == 2) {
- worldName = args.get(0);
- try {
- pageNum = Integer.parseInt(args.get(1)) - 1;
- } catch (NumberFormatException e) {
- pageNum = 0;
- }
- }
-
- if (this.worldManager.isMVWorld(worldName)) {
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
- showPage(pageNum, sender, this.buildEntireCommand(this.worldManager.getMVWorld(worldName), p));
- } else if (this.worldManager.getUnloadedWorlds().contains(worldName)) {
- sender.sendMessage("That world exists, but it is unloaded!");
- sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, worldName));
- } else if (this.plugin.getServer().getWorld(worldName) != null) {
- sender.sendMessage("That world exists, but Multiverse does not know about it!");
- sender.sendMessage("You can import it with" + ChatColor.AQUA + "/mv import " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
- sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
- }
- }
-
- private List> buildEntireCommand(MultiverseWorld world, Player p) {
- List message = new ArrayList();
- List> worldInfo = new ArrayList>();
- // Page 1
- FancyColorScheme colors = new FancyColorScheme(ChatColor.AQUA, ChatColor.AQUA, ChatColor.GOLD, ChatColor.WHITE);
- message.add(new FancyHeader("General Info", colors));
- message.add(new FancyMessage("World Name: ", world.getName(), colors));
- message.add(new FancyMessage("World UID: ", world.getCBWorld().getUID().toString(), colors));
- message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
- message.add(new FancyMessage("Game Mode: ", world.getGameMode().toString(), colors));
- message.add(new FancyMessage("Difficulty: ", world.getDifficulty().toString(), colors));
-
- //message.add(new FancyMessage("Game Mode: ", StringUtils.capitalize(world.getGameMode().toString()), colors));
- Location spawn = world.getSpawnLocation();
- message.add(new FancyMessage("Spawn Location: ", plugin.getLocationManipulation().strCoords(spawn), colors));
- message.add(new FancyMessage("World Scale: ", String.valueOf(world.getScaling()), colors));
- message.add(new FancyMessage("World Seed: ", String.valueOf(world.getSeed()), colors));
- if (world.getPrice() > 0) {
- message.add(new FancyMessage("Price to enter this world: ",
- plugin.getEconomist().formatPrice(world.getPrice(), world.getCurrency()),
- colors));
- } else if (world.getPrice() < 0) {
- message.add(new FancyMessage("Reward for entering this world: ",
- plugin.getEconomist().formatPrice(-world.getPrice(), world.getCurrency()),
- colors));
- } else {
- message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
- }
-
- if (world.getRespawnToWorld() != null) {
- MultiverseWorld respawn = this.worldManager.getMVWorld(world.getRespawnToWorld());
- if (respawn != null) {
- message.add(new FancyMessage("Players will respawn in: ", respawn.getColoredWorldString(), colors));
- } else {
- message.add(new FancyMessage("Players will respawn in: ", ChatColor.RED + "!!INVALID!!", colors));
- }
-
- }
-
- worldInfo.add(message);
- // Page 2
- message = new ArrayList();
- message.add(new FancyHeader("More World Settings", colors));
- message.add(new FancyMessage("World Type: ", world.getWorldType().toString(), colors));
- message.add(new FancyMessage("Generator: ", world.getGenerator(), colors));
- message.add(new FancyMessage("Structures: ", world.getCBWorld().canGenerateStructures() + "", colors));
- message.add(new FancyMessage("Weather: ", world.isWeatherEnabled() + "", colors));
- message.add(new FancyMessage("Players will get hungry: ", world.getHunger() + "", colors));
- message.add(new FancyMessage("Keep spawn in memory: ", world.isKeepingSpawnInMemory() + "", colors));
- message.add(new FancyHeader("PVP Settings", colors));
- message.add(new FancyMessage("Multiverse Setting: ", world.isPVPEnabled() + "", colors));
- message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getPVP() + "", colors));
- worldInfo.add(message);
- // Page 3
- message = new ArrayList();
- message.add(new FancyHeader("Monster Settings", colors));
- message.add(new FancyMessage("Multiverse Setting: ", world.canMonstersSpawn() + "", colors));
- message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
- if (world.getMonsterList().size() > 0) {
- if (world.canMonstersSpawn()) {
- message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT "
- + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
- } else {
- message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
- }
- } else {
- message.add(new FancyMessage("Monsters that CAN spawn: ", world.canMonstersSpawn() ? "ALL" : "NONE", colors));
- }
- worldInfo.add(message);
-
- // Page 4
- message = new ArrayList();
- message.add(new FancyHeader("Animal Settings", colors));
- message.add(new FancyMessage("Multiverse Setting: ", world.canAnimalsSpawn() + "", colors));
- message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
- if (world.getAnimalList().size() > 0) {
- if (world.canAnimalsSpawn()) {
- message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT "
- + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
- } else {
- message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
- }
- } else {
- message.add(new FancyMessage("Animals that CAN spawn: ", world.canAnimalsSpawn() ? "ALL" : "NONE", colors));
- }
- worldInfo.add(message);
-
- return worldInfo;
- }
-
- private static String toCommaSeperated(List list) {
- if (list == null || list.size() == 0) {
- return "";
- }
- if (list.size() == 1) {
- return list.get(0);
- }
- String result = list.get(0);
-
- for (int i = 1; i < list.size() - 1; i++) {
- result += ", " + list.get(i);
- }
- result += " and " + list.get(list.size() - 1);
- return result;
- }
-
- /**
- * Gets a "positive" or "negative" {@link ChatColor}.
- *
- * @param positive Whether this {@link ChatColor} should be "positive".
- * @return The {@link ChatColor}.
- */
- protected ChatColor getChatColor(boolean positive) {
- return positive ? ChatColor.GREEN : ChatColor.RED;
- }
-
- private static void showPage(int page, CommandSender sender, List> doc) {
- page = page < 0 ? 0 : page;
- page = page > doc.size() - 1 ? doc.size() - 1 : page;
- boolean altColor = false;
- boolean appendedPageNum = false;
- if (sender instanceof Player) {
- List list = doc.get(page);
- for (FancyText fancyT : list) {
- if (fancyT instanceof FancyMessage) {
- FancyMessage text = (FancyMessage) fancyT;
- text.setAltColor(altColor);
- altColor = !altColor;
- sender.sendMessage(text.getFancyText());
- } else if (fancyT instanceof FancyHeader) {
- FancyHeader text = (FancyHeader) fancyT;
- if (!appendedPageNum) {
- text.appendText(ChatColor.DARK_PURPLE + " [ Page " + (page + 1) + " of " + doc.size() + " ]");
- appendedPageNum = true;
- }
- sender.sendMessage(text.getFancyText());
- altColor = false;
- }
- }
-
- } else {
- for (List list : doc) {
- for (FancyText fancyT : list) {
- if (fancyT instanceof FancyMessage) {
- FancyMessage text = (FancyMessage) fancyT;
- text.setAltColor(altColor);
- altColor = !altColor;
- sender.sendMessage(text.getFancyText());
- } else {
- FancyText text = fancyT;
- if (appendedPageNum) {
- sender.sendMessage(" ");
- } else {
- appendedPageNum = true;
- }
- sender.sendMessage(text.getFancyText());
- altColor = false;
- }
- }
- }
- }
- }
-
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ListCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ListCommand.java
deleted file mode 100644
index 9b6c1a73..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ListCommand.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.display.ContentDisplay;
-import com.onarandombox.MultiverseCore.display.filters.ContentFilter;
-import com.onarandombox.MultiverseCore.display.filters.DefaultContentFilter;
-import com.onarandombox.MultiverseCore.display.filters.RegexContentFilter;
-import com.onarandombox.MultiverseCore.display.handlers.PagedSendHandler;
-import com.onarandombox.MultiverseCore.display.parsers.ContentParser;
-import org.bukkit.ChatColor;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * Displays a listing of all worlds that a player can enter.
- */
-public class ListCommand extends MultiverseCommand {
-
- public ListCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("World Listing");
- this.setCommandUsage("/mv list [filter] [page]");
- this.setArgRange(0, 2);
- this.addKey("mvlist");
- this.addKey("mvl");
- this.addKey("mv list");
- this.setPermission("multiverse.core.list.worlds", "Displays a listing of all worlds that you can enter.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- ContentFilter filter = DefaultContentFilter.getInstance();
- int page = 1;
-
- // Either page or filter.
- if (args.size() == 1) {
- try {
- page = Integer.parseInt(args.get(0));
- } catch (NumberFormatException ignore) {
- filter = RegexContentFilter.fromString(args.get(0));
- }
- }
-
- // Filter then page.
- if (args.size() == 2) {
- filter = RegexContentFilter.fromString(args.get(0));
- try {
- page = Integer.parseInt(args.get(1));
- } catch (NumberFormatException ignore) {
- sender.sendMessage(ChatColor.RED + args.get(1) + " is not valid number!");
- }
- }
-
- ContentDisplay.create()
- .addContentParser(new WorldListContentParser())
- .withSendHandler(PagedSendHandler.create()
- .withHeader("%s====[ Multiverse World List ]====", ChatColor.GOLD)
- .withFilter(filter)
- .withTargetPage(page))
- .send(sender);
- }
-
- private class WorldListContentParser implements ContentParser {
-
- @Override
- public void parse(@NotNull CommandSender sender, @NotNull List content) {
- Player player = (sender instanceof Player) ? (Player) sender : null;
-
- plugin.getMVWorldManager().getMVWorlds().stream()
- .filter(world -> player == null || plugin.getMVPerms().canEnterWorld(player, world))
- .filter(world -> canSeeWorld(player, world))
- .map(world -> hiddenText(world) + world.getColoredWorldString() + " - " + parseColouredEnvironment(world.getEnvironment()))
- .forEach(content::add);
-
- plugin.getMVWorldManager().getUnloadedWorlds().stream()
- .filter(world -> plugin.getMVPerms().hasPermission(sender, "multiverse.access." + world, true))
- .map(world -> ChatColor.GRAY + world + " - UNLOADED")
- .forEach(content::add);
- }
-
- private boolean canSeeWorld(Player player, MultiverseWorld world) {
- return !world.isHidden()
- || player == null
- || plugin.getMVPerms().hasPermission(player, "multiverse.core.modify", true);
- }
-
- private String hiddenText(MultiverseWorld world) {
- return (world.isHidden()) ? String.format("%s[H] ", ChatColor.GRAY) : "";
- }
-
- private String parseColouredEnvironment(World.Environment env) {
- ChatColor color = ChatColor.GOLD;
- switch (env) {
- case NETHER:
- color = ChatColor.RED;
- break;
- case NORMAL:
- color = ChatColor.GREEN;
- break;
- case THE_END:
- color = ChatColor.AQUA;
- break;
- }
- return color + env.toString();
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/LoadCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/LoadCommand.java
deleted file mode 100644
index 2b60a8da..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/LoadCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Loads a world into Multiverse.
- */
-public class LoadCommand extends MultiverseCommand {
-
- public LoadCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Load World");
- this.setCommandUsage("/mv load" + ChatColor.GREEN + " {WORLD}");
- this.setArgRange(1, 1);
- this.addKey("mvload");
- this.addKey("mv load");
- this.addCommandExample("/mv load " + ChatColor.GREEN + "MyUnloadedWorld");
- this.setPermission("multiverse.core.load", "Loads a world into Multiverse.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (this.plugin.getMVWorldManager().loadWorld(args.get(0))) {
- Command.broadcastCommandMessage(sender, "Loaded world '" + args.get(0) + "'!");
- } else {
- sender.sendMessage("Error trying to load world '" + args.get(0) + "'!");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyAddCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyAddCommand.java
deleted file mode 100644
index 93229d32..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyAddCommand.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.enums.Action;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-// This will contain all the properties that support the ADD/REMOVE
-// Anything not in here will only support the SET action
-
-/**
- * Used to modify various aspects of worlds.
- */
-public class ModifyAddCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public ModifyAddCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Modify a World (Add a value)");
- this.setCommandUsage("/mv modify " + ChatColor.GREEN + "add {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ");
- this.setArgRange(2, 3);
- this.addKey("mvm add");
- this.addKey("mvmadd");
- this.addKey("mv modify add");
- this.addKey("mvmodify add");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
- this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
- + "If you do not include a world, the current world will be used.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // We NEED a world from the command line
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
-
- if (args.size() == 2 && p == null) {
- sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
- sender.sendMessage(this.getCommandDesc());
- sender.sendMessage(this.getCommandUsage());
- sender.sendMessage("Nothing changed.");
- return;
- }
-
- MultiverseWorld world;
- String value = args.get(0);
- String property = args.get(1);
-
- if (args.size() == 2) {
- world = this.worldManager.getMVWorld(p.getWorld().getName());
- } else {
- world = this.worldManager.getMVWorld(args.get(2));
- }
-
- if (world == null) {
- sender.sendMessage("That world does not exist!");
- return;
- }
-
- if (!ModifyCommand.validateAction(Action.Add, property)) {
- sender.sendMessage("Sorry, you can't ADD to " + property);
- sender.sendMessage("Please visit our Github Wiki for more information: https://goo.gl/OMGwzx");
- return;
- }
-
- // TODO fix this
- if (world.addToVariable(property, value)) {
- sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA
- + value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
- if (!plugin.saveWorldConfig()) {
- sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
- }
- } else {
- sender.sendMessage(value + " could not be added to " + property);
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyClearCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyClearCommand.java
deleted file mode 100644
index 93e57663..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyClearCommand.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.enums.Action;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Removes all values from a world-property.
- */
-public class ModifyClearCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public ModifyClearCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Modify a World (Clear a property)");
- this.setCommandUsage("/mv modify" + ChatColor.GREEN + " clear {PROPERTY}" + ChatColor.GOLD + " [WORLD]");
- this.setArgRange(1, 2);
- this.addKey("mvm clear");
- this.addKey("mvmclear");
- this.addKey("mv modify clear");
- this.addKey("mvmodify clear");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "animals");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "monsters");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "worldblacklist");
- this.setPermission("multiverse.core.modify.clear",
- "Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // We NEED a world from the command line
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
- if (args.size() == 1 && p == null) {
- sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
- sender.sendMessage(this.getCommandDesc());
- sender.sendMessage(this.getCommandUsage());
- sender.sendMessage("Nothing changed.");
- return;
- }
-
- MultiverseWorld world;
- String property = args.get(0);
-
- if (args.size() == 1) {
- world = this.worldManager.getMVWorld(p.getWorld().getName());
- } else {
- world = this.worldManager.getMVWorld(args.get(1));
- }
-
- if (world == null) {
- sender.sendMessage("That world does not exist!");
- return;
- }
-
- if (!ModifyCommand.validateAction(Action.Clear, property)) {
- sender.sendMessage("Sorry, you can't use CLEAR with " + property);
- sender.sendMessage("Please visit our Github Wiki for more information: https://goo.gl/q1h01S");
- return;
- }
- // TODO fix this
- if (world.clearList(property)) {
- sender.sendMessage(property + " was cleared. It contains 0 values now.");
- sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + property + ChatColor.WHITE + " was "
- + ChatColor.GREEN + "CLEARED" + ChatColor.WHITE + ". It contains " + ChatColor.LIGHT_PURPLE + "0" + ChatColor.WHITE + " values now.");
- if (!plugin.saveWorldConfig()) {
- sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
- }
- } else {
- sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GOLD + property
- + ChatColor.WHITE + " was " + ChatColor.GOLD + "NOT" + ChatColor.WHITE + " cleared.");
- }
- }
-
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyCommand.java
deleted file mode 100644
index c87a0761..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyCommand.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.enums.Action;
-import com.onarandombox.MultiverseCore.enums.AddProperties;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.Permission;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Used to modify various aspects of worlds.
- */
-public class ModifyCommand extends MultiverseCommand {
-
- public ModifyCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Modify a World");
- this.setCommandUsage("/mv modify" + ChatColor.GREEN + " {set|add|remove|clear} ...");
- this.setArgRange(2, 3);
- this.addKey("mvm");
- this.addKey("mvmodify");
- this.addKey("mv modify");
- Map children = new HashMap();
- children.put("multiverse.core.modify.add", true);
- children.put("multiverse.core.modify.modify", true);
- children.put("multiverse.core.modify.clear", true);
- children.put("multiverse.core.modify.remove", true);
- Permission modify = new Permission("multiverse.core.modify",
- "Modify various aspects of worlds. It requires add/set/clear/remove. See the examples below", PermissionDefault.OP, children);
- this.addCommandExample(ChatColor.AQUA + "/mv modify set ?");
- this.addCommandExample(ChatColor.GREEN + "/mv modify add ?");
- this.addCommandExample(ChatColor.BLUE + "/mv modify clear ?");
- this.addCommandExample(ChatColor.RED + "/mv modify remove ?");
- this.setPermission(modify);
- }
-
- /**
- * Validates the specified action.
- *
- * @param action The {@link Action}.
- * @param property The property.
- * @return Whether this action is valid.
- */
- protected static boolean validateAction(Action action, String property) {
- if (action != Action.Set) {
- try {
- AddProperties.valueOf(property);
- return true;
- } catch (IllegalArgumentException e) {
- return false;
- }
- }
- return false;
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // This is just a place holder. The real commands are in:
- // ModifyAddCommand
- // ModifyRemoveCommand
- // ModifySetCommand
- // ModifyClearCommand
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyRemoveCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyRemoveCommand.java
deleted file mode 100644
index 51792d99..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifyRemoveCommand.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.enums.Action;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Removes values from a world-property.
- */
-public class ModifyRemoveCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public ModifyRemoveCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Modify a World (Remove a value)");
- this.setCommandUsage("/mv modify" + ChatColor.GREEN + " remove {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
- this.setArgRange(2, 3);
- this.addKey("mvm remove");
- this.addKey("mvmremove");
- this.addKey("mv modify remove");
- this.addKey("mvmodify remove");
- this.addKey("mvm delete");
- this.addKey("mvmdelete");
- this.addKey("mv modify delete");
- this.addKey("mvmodify delete");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
- this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
- + "If you do not include a world, the current world will be used.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // We NEED a world from the command line
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
-
- if (args.size() == 2 && p == null) {
- sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
- sender.sendMessage(this.getCommandDesc());
- sender.sendMessage(this.getCommandUsage());
- sender.sendMessage("Nothing changed.");
- return;
- }
-
- MultiverseWorld world;
- String value = args.get(0);
- String property = args.get(1);
-
- if (args.size() == 2) {
- world = this.worldManager.getMVWorld(p.getWorld().getName());
- } else {
- world = this.worldManager.getMVWorld(args.get(2));
- }
-
- if (world == null) {
- sender.sendMessage("That world does not exist!");
- return;
- }
-
- if (!ModifyCommand.validateAction(Action.Remove, property)) {
- sender.sendMessage("Sorry, you can't REMOVE anything from" + property);
- sender.sendMessage("Please visit our Github Wiki for more information: https://goo.gl/OMGwzx");
- return;
- }
- // TODO fix this
- if (world.removeFromVariable(property, value)) {
- sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE
- + " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
- if (!plugin.saveWorldConfig()) {
- sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
- }
- } else {
- sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY
- + value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
- }
- }
-
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifySetCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifySetCommand.java
deleted file mode 100644
index 57a48768..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ModifySetCommand.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
-import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Used to set world-properties.
- */
-public class ModifySetCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public ModifySetCommand(MultiverseCore plugin) {
- super(plugin);
- this.worldManager = this.plugin.getMVWorldManager();
- this.setName("Modify a World (Set a value)");
- this.setCommandUsage("/mv modify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
- this.setArgRange(1, 3);
- this.addKey("mvm set");
- this.addKey("mvmset");
- this.addKey("mv modify set");
- this.addKey("mvmodify set");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "mode " + ChatColor.RED + "creative");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "animals " + ChatColor.RED + "false");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "monsters " + ChatColor.RED + "false");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "alias " + ChatColor.RED + "MyWorld");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "color " + ChatColor.RED + "green");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "curr " + ChatColor.RED + "3");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "price " + ChatColor.RED + "5");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "scale " + ChatColor.RED + "1.2");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "memory " + ChatColor.RED + "true");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "diff " + ChatColor.RED + "hard");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hunger " + ChatColor.RED + "false");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hidden " + ChatColor.RED + "true");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "pvp " + ChatColor.RED + "false");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "heal " + ChatColor.RED + "true");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "adjustspawn " + ChatColor.RED + "false");
- this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "spawn");
- this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
- + "If you do not include a world, the current world will be used.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // Special case for spawn:
- if (args.size() == 1) {
- if (!(sender instanceof Player)) {
- sender.sendMessage("You must be a player to set the" + ChatColor.GREEN + " spawn");
- return;
- }
- if (args.get(0).equalsIgnoreCase("spawn")) {
- SetSpawnCommand c = new SetSpawnCommand(this.plugin);
- c.setWorldSpawn(sender);
-
- } else {
- sender.sendMessage("Spawn is the only param with no" + ChatColor.GREEN + " VALUE");
- sender.sendMessage("Type " + ChatColor.GREEN + "/mv modify ?" + ChatColor.WHITE + " For help.");
- }
- return;
- }
- // We NEED a world from the command line
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
-
- if (args.size() == 2 && p == null) {
- sender.sendMessage("From the command line, WORLD is required.");
- sender.sendMessage(this.getCommandDesc());
- sender.sendMessage(this.getCommandUsage());
- sender.sendMessage("Nothing changed.");
- return;
- }
-
- MultiverseWorld world;
- String value = args.get(1);
- String property = args.get(0);
-
- if (args.size() == 2) {
- world = this.worldManager.getMVWorld(p.getWorld().getName());
- } else {
- world = this.worldManager.getMVWorld(args.get(2));
- }
-
- if (world == null) {
- sender.sendMessage("That world does not exist!");
- return;
- }
-
- if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !EnglishChatColor.isValidAliasColor(value)) {
- sender.sendMessage(value + " is not a valid color. Please pick one of the following:");
- sender.sendMessage(EnglishChatColor.getAllColors());
- return;
- }
- try {
- if (world.setPropertyValue(property, value)) {
- sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property
- + ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
- if (!plugin.saveWorldConfig()) {
- sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
- }
- } else {
- sender.sendMessage(ChatColor.RED + world.getPropertyHelp(property));
- }
- } catch (PropertyDoesNotExistException e) {
- sender.sendMessage(ChatColor.RED + "Sorry, You can't set: '" + ChatColor.GRAY + property + ChatColor.RED + "'");
- sender.sendMessage("Valid world-properties: " + world.getAllPropertyNames());
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/MultiverseCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/MultiverseCommand.java
deleted file mode 100644
index ac0aa7ba..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/MultiverseCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import java.util.List;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
-import com.pneumaticraft.commandhandler.Command;
-import org.bukkit.command.CommandSender;
-
-/**
- * A generic Multiverse-command.
- */
-public abstract class MultiverseCommand extends Command {
-
- /**
- * The reference to the core.
- */
- protected MultiverseCore plugin;
- /**
- * The reference to {@link MultiverseMessaging}.
- */
- protected MultiverseMessaging messaging;
-
- public MultiverseCommand(MultiverseCore plugin) {
- super(plugin);
- this.plugin = plugin;
- this.messaging = this.plugin.getMessaging();
- }
-
- @Override
- public abstract void runCommand(CommandSender sender, List args);
-
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/PaginatedCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/PaginatedCommand.java
deleted file mode 100644
index 3e603e87..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/PaginatedCommand.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.pneumaticraft.commandhandler.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- * A generic paginated command.
- * @param The type of items on the page.
- */
-public abstract class PaginatedCommand extends Command {
- private final Pattern REGEX_SPECIAL_CHARS = Pattern.compile("[.+*?\\[^\\]$(){}=!<>|:-\\\\]");
- private static final int DEFAULT_ITEMS_PER_PAGE = 9;
- /**
- * The number of items per page.
- */
- protected int itemsPerPage = DEFAULT_ITEMS_PER_PAGE;
-
- public PaginatedCommand(JavaPlugin plugin) {
- super(plugin);
- }
-
- /**
- * Set the number of items per page.
- *
- * @param items The new number of items per page.
- */
- protected void setItemsPerPage(int items) {
- itemsPerPage = items;
- }
-
- /**
- * Gets filtered items.
- *
- * @param availableItems All available items.
- * @param filter The filter-{@link String}.
- * @return A list of items that match the filter.
- */
- protected abstract List getFilteredItems(List availableItems, String filter);
-
- /**
- * Escape regex special characters from filter
- *
- * @param filter The filter-{@link String}.
- * @return String with regex characters escaped
- */
- protected String cleanFilter(String filter) {
- return REGEX_SPECIAL_CHARS.matcher(filter).replaceAll("\\\\$0");
- }
-
- /**
- * Constructs a single string from a list of strings.
- *
- * @param list The {@link List} of strings.
- * @return A single {@link String}.
- */
- protected String stitchThisString(List list) {
- StringBuilder builder = new StringBuilder();
- for (String s : list) {
- builder.append(s);
- builder.append(' ');
- }
- return builder.toString();
- }
-
- /**
- * Shows a page.
- *
- * @param page The number of the page to show.
- * @param sender The {@link CommandSender} that wants to see the page.
- * @param cmds The items that should be displayed on the page.
- */
- protected void showPage(int page, CommandSender sender, List cmds) {
- // Ensure the page is at least 1.
- page = (page <= 0) ? 1 : page;
- int start = (page - 1) * itemsPerPage;
- int end = start + itemsPerPage;
-
- for (int i = start; i < end; i++) {
- // For consistancy, print some extra lines if it's a player:
- if (i < cmds.size()) {
- sender.sendMessage(this.getItemText(cmds.get(i)));
- } else if (sender instanceof Player) {
- sender.sendMessage(" ");
- }
- }
- }
-
- /**
- * Converts an item into a string.
- *
- * @param item The item.
- * @return A {@link String}.
- */
- protected abstract String getItemText(T item);
-
- /**
- * Constructs a {@link FilterObject} from a {@link List} of arguments.
- *
- * @param args The {@link List} of arguments.
- * @return The {@link FilterObject}.
- */
- protected FilterObject getPageAndFilter(List args) {
- int page = 1;
-
- String filter = "";
-
- if (args.size() == 0) {
- filter = "";
- page = 1;
- } else if (args.size() == 1) {
- try {
- page = Integer.parseInt(args.get(0));
- } catch (NumberFormatException ex) {
- filter = args.get(0);
- page = 1;
- }
- } else if (args.size() == 2) {
- filter = args.get(0);
- try {
- page = Integer.parseInt(args.get(1));
- } catch (NumberFormatException ex) {
- page = 1;
- }
- }
- return new FilterObject(page, filter);
- }
-
- /**
- * "Key-Object" containing information about the page and the filter that were requested.
- */
- protected class FilterObject {
- private Integer page;
- private String filter;
-
- public FilterObject(Integer page, String filter) {
- this.page = page;
- this.filter = filter;
- }
-
- /**
- * Gets the page.
- * @return The page.
- */
- public Integer getPage() {
- return this.page;
- }
-
- /**
- * Sets the page.
- *
- * @param page The new page.
- */
- public void setPage(int page) {
- this.page = page;
- }
-
- /**
- * Gets the filter.
- * @return The filter.
- */
- public String getFilter() {
- return this.filter;
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/PaginatedCoreCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/PaginatedCoreCommand.java
deleted file mode 100644
index ebd407b7..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/PaginatedCoreCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-
-/**
- * A generic paginated Multiverse-command.
- * @param The type of items on the page.
- */
-public abstract class PaginatedCoreCommand extends PaginatedCommand {
- /**
- * The reference to the core.
- */
- protected MultiverseCore plugin;
-
- public PaginatedCoreCommand(MultiverseCore plugin) {
- super(plugin);
- this.plugin = plugin;
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/PurgeCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/PurgeCommand.java
deleted file mode 100644
index 38f32ca6..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/PurgeCommand.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.api.WorldPurger;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Removes a type of mob from a world.
- */
-public class PurgeCommand extends MultiverseCommand {
- private MVWorldManager worldManager;
-
- public PurgeCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Purge World of Creatures");
- this.setCommandUsage("/mv purge" + ChatColor.GOLD + " [WORLD|all] " + ChatColor.GREEN + "{all|animals|monsters|MOBNAME}");
- this.setArgRange(1, 2);
- this.addKey("mvpurge");
- this.addKey("mv purge");
- this.addCommandExample("/mv purge " + ChatColor.GREEN + "all");
- this.addCommandExample("/mv purge " + ChatColor.GOLD + "all " + ChatColor.GREEN + "all");
- this.addCommandExample("/mv purge " + ChatColor.GREEN + "monsters");
- this.addCommandExample("/mv purge " + ChatColor.GOLD + "all " + ChatColor.GREEN + "animals");
- this.addCommandExample("/mv purge " + ChatColor.GOLD + "MyWorld " + ChatColor.GREEN + "squid");
- this.addCommandExample("/mv purge " + ChatColor.GOLD + "MyWorld_nether " + ChatColor.GREEN + "ghast");
- this.setPermission("multiverse.core.purge", "Removed the specified type of mob from the specified world.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
- if (args.size() == 1 && p == null) {
- sender.sendMessage("This command requires a WORLD when being run from the console!");
- sender.sendMessage(this.getCommandUsage());
- return;
- }
- String worldName = null;
- String deathName = null;
- if (args.size() == 1) {
- worldName = p.getWorld().getName();
- deathName = args.get(0);
- } else {
- worldName = args.get(0);
- deathName = args.get(1);
- }
-
- if (!worldName.equalsIgnoreCase("all") && !this.worldManager.isMVWorld(worldName)) {
- this.plugin.showNotMVWorldMessage(sender, worldName);
- sender.sendMessage("It cannot be purged.");
- return;
- }
-
- List worldsToRemoveEntitiesFrom = new ArrayList();
- // Handle all case any user who names a world "all" should know better...
- if (worldName.equalsIgnoreCase("all")) {
- worldsToRemoveEntitiesFrom.addAll(this.worldManager.getMVWorlds());
- } else {
- worldsToRemoveEntitiesFrom.add(this.worldManager.getMVWorld(worldName));
- }
-
- WorldPurger purger = this.worldManager.getTheWorldPurger();
- ArrayList thingsToKill = new ArrayList();
- if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
- thingsToKill.add(deathName.toUpperCase());
- } else {
- Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
- }
- for (MultiverseWorld w : worldsToRemoveEntitiesFrom) {
- purger.purgeWorld(w, thingsToKill, false, false, sender);
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/RegenCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/RegenCommand.java
deleted file mode 100644
index 2d249842..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/RegenCommand.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
-import com.pneumaticraft.commandhandler.CommandHandler;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * Regenerates a world.
- */
-public class RegenCommand extends MultiverseCommand {
-
- public RegenCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Regenerates a World");
- this.setCommandUsage("/mv regen" + ChatColor.GREEN + " {WORLD}" + ChatColor.GOLD + " [-s [SEED]] [--keep-gamerules]");
- this.setArgRange(1, 4);
- this.addKey("mvregen");
- this.addKey("mv regen");
- this.addCommandExample("You can use the -s with no args to get a new seed:");
- this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s");
- this.addCommandExample("or specifiy a seed to get that one:");
- this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s" + ChatColor.AQUA + " gargamel");
- this.setPermission("multiverse.core.regen", "Regenerates a world on your server. The previous state will be lost "
- + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- String worldName = args.get(0);
- boolean useseed = (!(args.size() == 1));
- boolean randomseed = (args.size() == 2 && args.get(1).equalsIgnoreCase("-s"));
- String seed = (args.size() == 3) ? args.get(2) : "";
- boolean keepGamerules = CommandHandler.hasFlag("--keep-gamerules", args);
- this.plugin.getCommandQueueManager().addToQueue(new QueuedCommand(
- sender,
- doWorldRegen(sender, worldName, useseed, randomseed, seed, keepGamerules),
- String.format("Are you sure you want to regen '%s'? You cannot undo this action.", worldName)
- ));
- }
-
- private Runnable doWorldRegen(@NotNull CommandSender sender,
- @NotNull String worldName,
- boolean useSeed,
- boolean randomSeed,
- @NotNull String seed,
- boolean keepGamerules) {
-
- return () -> {
- if (this.plugin.getMVWorldManager().regenWorld(worldName, useSeed, randomSeed, seed, keepGamerules)) {
- sender.sendMessage(ChatColor.GREEN + "World Regenerated!");
- return;
- }
- sender.sendMessage(ChatColor.RED + "World could NOT be regenerated!");
- };
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ReloadCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ReloadCommand.java
deleted file mode 100644
index 680de34a..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ReloadCommand.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Reloads worlds.yml and config.yml.
- */
-public class ReloadCommand extends MultiverseCommand {
-
- public ReloadCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Reload Configs");
- this.setCommandUsage("/mv reload");
- this.setArgRange(0, 0);
- this.addKey("mvreload");
- this.addKey("mvr");
- this.addKey("mv reload");
- this.addCommandExample("/mv reload");
- this.setPermission("multiverse.core.reload", "Reloads worlds.yml and config.yml.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- sender.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
- this.plugin.loadConfigs();
- this.plugin.getAnchorManager().loadAnchors();
- this.plugin.getMVWorldManager().loadWorlds(true);
-
- List configsLoaded = new ArrayList();
- configsLoaded.add("Multiverse-Core - config.yml");
- configsLoaded.add("Multiverse-Core - worlds.yml");
- configsLoaded.add("Multiverse-Core - anchors.yml");
- // Create the event
- MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
- // Fire it off
- this.plugin.getServer().getPluginManager().callEvent(configReload);
- for (String s : configReload.getAllConfigsLoaded()) {
- sender.sendMessage(s);
- }
-
- sender.sendMessage(ChatColor.GREEN + "Reload Complete!");
- }
-
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/RemoveCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/RemoveCommand.java
deleted file mode 100644
index aa821b33..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/RemoveCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Unloads a world and removes it from the config.
- */
-public class RemoveCommand extends MultiverseCommand {
-
- public RemoveCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Remove World");
- this.setCommandUsage("/mv remove" + ChatColor.GREEN + " {WORLD}");
- this.setArgRange(1, 1);
- this.addKey("mvremove");
- this.addKey("mv remove");
- this.addCommandExample("/mv remove " + ChatColor.GREEN + "MyWorld");
- this.setPermission("multiverse.core.remove",
- "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (this.plugin.getMVWorldManager().removeWorldFromConfig(args.get(0))) {
- sender.sendMessage("World removed from config!");
- } else {
- sender.sendMessage("Error trying to remove world from config!");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ScriptCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/ScriptCommand.java
deleted file mode 100644
index baec84fb..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/ScriptCommand.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * States who is in what world.
- */
-public class ScriptCommand extends MultiverseCommand {
-
- public ScriptCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Runs a script.");
- this.setCommandUsage("/mv script" + ChatColor.GOLD + " {script} [target]");
- this.setArgRange(1, 2);
- this.addKey("mv script");
- this.addKey("mvscript");
- this.addCommandExample(String.format("/mv script %sscript.txt", ChatColor.GOLD));
- this.addCommandExample(String.format("/mv script %stest.txt %ssomeplayer", ChatColor.GOLD, ChatColor.GREEN));
- this.setPermission("multiverse.core.script", "Runs a script.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (plugin.getScriptAPI() == null) {
- sender.sendMessage("Buscript failed to load while the server was starting. Scripts cannot be run.");
- return;
- }
- File file = new File(plugin.getScriptAPI().getScriptFolder(), args.get(0));
- if (!file.exists()) {
- sender.sendMessage("That script file does not exist in the Multiverse-Core scripts directory!");
- return;
- }
- Player player = null;
- if (sender instanceof Player) {
- player = (Player) sender;
- }
- String target = null;
- if (args.size() == 2) {
- target = args.get(1);
- }
- plugin.getScriptAPI().executeScript(file, target, player);
- sender.sendMessage(String.format("Script '%s%s%s' finished!", ChatColor.GOLD, file.getName(), ChatColor.WHITE));
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SetSpawnCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/SetSpawnCommand.java
deleted file mode 100644
index 5e9fa3c6..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SetSpawnCommand.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.BlockSafety;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-import org.bukkit.Bukkit;
-
-/**
- * Sets the spawn for a world.
- */
-public class SetSpawnCommand extends MultiverseCommand {
- public SetSpawnCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Set World Spawn");
- this.setCommandUsage("/mv setspawn");
- this.setArgRange(0, 6);
- this.addKey("mvsetspawn");
- this.addKey("mvsets");
- this.addKey("mvss");
- this.addKey("mv set spawn");
- this.addKey("mv setspawn");
- this.addKey("mvset spawn");
- this.addCommandExample("/mv set spawn");
- this.setPermission("multiverse.core.spawn.set", "Sets the spawn for the current world.", PermissionDefault.OP);
- }
-
- /**
- * Dispatches the user's command depending on the number of parameters
- * @param sender The player who executes the command, may be console as well.
- * @param args Command line parameters
- */
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (args.isEmpty()) {
- setWorldSpawn(sender);
- } else if (args.size() == 4) {
- setWorldSpawn(sender, args.get(0), args.get(1), args.get(2), args.get(3));
- } else if (args.size() == 6) {
- setWorldSpawn(sender, args.get(0), args.get(1), args.get(2), args.get(3), args.get(4), args.get(5));
- } else {
- sender.sendMessage("Use no arguments for your current location, or world/x/y/z, or world/x/y/z/yaw/pitch!");
- }
- }
-
- /**
- * Set the world spawn when no parameters are given
- * @param sender The {@link CommandSender} who executes the command.
- * Everything not a {@link Player}, e.g. console, gets rejected, as we can't get coordinates from there.
- */
- protected void setWorldSpawn(CommandSender sender) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- Location l = p.getLocation();
- World w = p.getWorld();
- setWorldSpawn(sender, w, l);
- } else {
- sender.sendMessage("You need to give coordinates to use this command from the console!");
- }
- }
-
- /**
- * Set the world spawn when 4 parameters are given
- * @param sender The {@link CommandSender} who executes the command
- * @param world The world to set the spawn in
- * @param x X-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
- * @param y Y-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
- * @param z Z-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
- */
- protected void setWorldSpawn(CommandSender sender, String world, String x, String y, String z) {
- setWorldSpawn(sender, world, x, y, z, "0", "0");
- }
-
- /**
- * Set the world spawn when 6 parameters are given
- * @param sender The {@link CommandSender} who executes the command
- * @param world The world to set the spawn in
- * @param x X-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
- * @param y Y-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
- * @param z Z-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
- * @param yaw Yaw a newly spawned player should look at (as a {@link String} as it's from the command line, gets parsed into a float)
- * @param pitch Pitch a newly spawned player should look at (as a {@link String} as it's from the command line, gets parsed into a float)
- */
- protected void setWorldSpawn(CommandSender sender, String world, String x, String y, String z, String yaw, String pitch) {
- double dx, dy, dz;
- float fpitch, fyaw;
- World bukkitWorld = Bukkit.getWorld(world);
- if (bukkitWorld == null) {
- sender.sendMessage("World " + world + " is unknown!");
- return;
- }
- try {
- dx = Double.parseDouble(x);
- dy = Double.parseDouble(y);
- dz = Double.parseDouble(z);
- fpitch = Float.parseFloat(pitch);
- fyaw = Float.parseFloat(yaw);
- } catch (NumberFormatException ex) {
- sender.sendMessage("All coordinates must be numeric");
- return;
- }
- Location l = new Location(bukkitWorld, dx, dy, dz, fyaw, fpitch);
- setWorldSpawn(sender, bukkitWorld, l);
- }
-
- /**
- * Does the actual spawn-setting-work.
- *
- * @param sender The {@link CommandSender} that's setting the spawn.
- * @param w The {@link World} to set the spawn in
- * @param l The {@link Location} to set the spawn to
- */
- private void setWorldSpawn(CommandSender sender, World w, Location l) {
- MultiverseWorld foundWorld = this.plugin.getMVWorldManager().getMVWorld(w.getName());
- if (foundWorld != null) {
- foundWorld.setSpawnLocation(l);
- BlockSafety bs = this.plugin.getBlockSafety();
- if (!bs.playerCanSpawnHereSafely(l) && foundWorld.getAdjustSpawn()) {
- sender.sendMessage("It looks like that location would normally be unsafe. But I trust you.");
- sender.sendMessage("I'm turning off the Safe-T-Teleporter for spawns to this world.");
- sender.sendMessage("If you want this turned back on just do:");
- sender.sendMessage(ChatColor.AQUA + "/mvm set adjustspawn true " + foundWorld.getAlias());
- foundWorld.setAdjustSpawn(false);
- }
- sender.sendMessage("Spawn was set to: " + plugin.getLocationManipulation().strCoords(l));
- if (!plugin.saveWorldConfig()) {
- sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
- }
- } else {
- w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
- sender.sendMessage("Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws).");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SilentCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/SilentCommand.java
deleted file mode 100644
index 45502296..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SilentCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Enables debug-information.
- */
-public class SilentCommand extends MultiverseCommand {
-
- public SilentCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Turn silent mode on/off?");
- this.setCommandUsage("/mv silent" + ChatColor.GOLD + " [true|false|on|off]");
- this.setArgRange(0, 1);
- this.addKey("mv silent");
- this.addKey("mvsilent");
- this.addCommandExample("/mv silent " + ChatColor.GOLD + "true");
- this.setPermission("multiverse.core.silent", "Reduces the amount of startup messages.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (args.size() == 1) {
- if (args.get(0).equalsIgnoreCase("on")) {
- args.set(0, "true");
- }
- plugin.getMVConfig().setSilentStart(Boolean.valueOf(args.get(0)));
- plugin.saveMVConfigs();
- }
- this.displaySilentMode(sender);
- }
-
- private void displaySilentMode(CommandSender sender) {
- if (plugin.getMVConfig().getSilentStart()) {
- sender.sendMessage("Multiverse Silent Start mode is " + ChatColor.GREEN + "ON");
- } else {
- sender.sendMessage("Multiverse Silent Start mode is " + ChatColor.RED + "OFF");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SleepCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/SleepCommand.java
deleted file mode 100644
index c258b8f0..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SleepCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Takes the player to the latest bed he's slept in.
- */
-public class SleepCommand extends MultiverseCommand {
-
- public SleepCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Go to Sleep");
- this.setCommandUsage("/mv sleep");
- this.setArgRange(0, 0);
- this.addKey("mv sleep");
- this.setPermission("multiverse.core.sleep", "Takes you the latest bed you've slept in (Currently BROKEN).", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- Player p = null;
- if (sender instanceof Player) {
- p = (Player) sender;
- }
-
- if (p == null) {
- return;
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SpawnCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/SpawnCommand.java
deleted file mode 100644
index ae6c97dd..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/SpawnCommand.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.onarandombox.MultiverseCore.utils.PlayerFinder;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.Permission;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Teleports a player to the spawn.
- */
-public class SpawnCommand extends MultiverseCommand {
-
- public SpawnCommand(MultiverseCore plugin) {
- super(plugin);
- Permission otherPerm = new Permission("multiverse.core.spawn.other",
- "Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
- this.setName("Spawn");
- this.setCommandUsage("/mv spawn" + ChatColor.GOLD + " [PLAYER]");
- this.setArgRange(0, 1);
- this.addKey("mvspawn");
- this.addKey("mv spawn");
- this.addKey("mvs");
- this.setPermission("multiverse.core.spawn.self", "Teleports you to the Spawn Point of the world you are in.", PermissionDefault.OP);
- this.addAdditonalPermission(otherPerm);
-
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- Player player = null;
- if (sender instanceof Player) {
- player = (Player) sender;
- }
- // If a persons name was passed in, you must be A. the console, or B have permissions
- if (args.size() == 1) {
- if (player != null && !this.plugin.getMVPerms().hasPermission(player, "multiverse.core.spawn.other", true)) {
- sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.core.spawn.other)");
- return;
- }
- Player target = PlayerFinder.get(args.get(0), sender);
- if (target != null) {
- target.sendMessage("Teleporting to this world's spawn...");
- spawnAccurately(target);
-
- if (player != null) {
- target.sendMessage("You were teleported by: " + ChatColor.YELLOW + player.getName());
- } else {
- target.sendMessage("You were teleported by: " + ChatColor.LIGHT_PURPLE + "the console");
- }
- } else {
- sender.sendMessage(args.get(0) + " is not logged on right now!");
- }
- } else {
- if (player != null && !this.plugin.getMVPerms().hasPermission(player, "multiverse.core.spawn.self", true)) {
- sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.core.spawn.self)");
- return;
- }
- if (player != null) {
- player.sendMessage("Teleporting to this world's spawn...");
- spawnAccurately(player);
- } else {
- sender.sendMessage("From the console, you must provide a PLAYER.");
- }
- }
- }
-
- private void spawnAccurately(Player player) {
- MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(player.getWorld().getName());
- Location spawnLocation;
- if (world != null) {
- spawnLocation = world.getSpawnLocation();
- } else {
- spawnLocation = player.getWorld().getSpawnLocation();
- }
- this.plugin.getSafeTTeleporter().safelyTeleport(player, player, spawnLocation, false);
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/UnloadCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/UnloadCommand.java
deleted file mode 100644
index 04a35e17..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/UnloadCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import org.bukkit.ChatColor;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.List;
-
-/**
- * Unloads worlds from Multiverse.
- */
-public class UnloadCommand extends MultiverseCommand {
-
- public UnloadCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Unload World");
- this.setCommandUsage("/mv unload" + ChatColor.GREEN + " {WORLD}");
- this.setArgRange(1, 1);
- this.addKey("mvunload");
- this.addKey("mv unload");
- this.setPermission("multiverse.core.unload",
- "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP);
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- if (this.plugin.getMVWorldManager().unloadWorld(args.get(0))) {
- Command.broadcastCommandMessage(sender, "Unloaded world '" + args.get(0) + "'!");
- } else {
- sender.sendMessage("Error trying to unload world '" + args.get(0) + "'!");
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/VersionCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/VersionCommand.java
deleted file mode 100644
index 941e4713..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/VersionCommand.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-
-import com.dumptruckman.minecraft.util.Logging;
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.event.MVVersionEvent;
-import com.onarandombox.MultiverseCore.utils.webpaste.PasteFailedException;
-import com.onarandombox.MultiverseCore.utils.webpaste.PasteService;
-import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceFactory;
-import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceType;
-import com.onarandombox.MultiverseCore.utils.webpaste.URLShortener;
-import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerFactory;
-import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerType;
-import com.pneumaticraft.commandhandler.CommandHandler;
-import org.apache.commons.lang.StringUtils;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-import org.bukkit.scheduler.BukkitRunnable;
-
-/**
- * Dumps version info to the console.
- */
-public class VersionCommand extends MultiverseCommand {
- private static final URLShortener SHORTENER = URLShortenerFactory.getService(URLShortenerType.BITLY);
-
- public VersionCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Multiverse Version");
- this.setCommandUsage("/mv version " + ChatColor.GOLD + "[-b|-h|-p] [--include-plugin-list]");
- this.setArgRange(0, 2);
- this.addKey("mv version");
- this.addKey("mvver");
- this.addKey("mvv");
- this.addKey("mvversion");
- this.setPermission(
- "multiverse.core.version",
- "Dumps version info to the console, optionally to pastebin.com with -b, to hastebin.com using -h, or to paste.gg with -p.",
- PermissionDefault.OP)
- ;
- }
-
- private String getLegacyString() {
- return "[Multiverse-Core] Multiverse-Core Version: " + this.plugin.getDescription().getVersion() + '\n'
- + "[Multiverse-Core] Bukkit Version: " + this.plugin.getServer().getVersion() + '\n'
- + "[Multiverse-Core] Loaded Worlds: " + this.plugin.getMVWorldManager().getMVWorlds() + '\n'
- + "[Multiverse-Core] Multiverse Plugins Loaded: " + this.plugin.getPluginCount() + '\n'
- +"[Multiverse-Core] Economy being used: " + plugin.getEconomist().getEconomyName() + '\n'
- + "[Multiverse-Core] Permissions Plugin: " + this.plugin.getMVPerms().getType() + '\n'
- + "[Multiverse-Core] Dumping Config Values: (version " + this.plugin.getMVConfig().getVersion() + ")" + '\n'
- + "[Multiverse-Core] enforceaccess: " + plugin.getMVConfig().getEnforceAccess() + '\n'
- + "[Multiverse-Core] prefixchat: " + plugin.getMVConfig().getPrefixChat() + '\n'
- + "[Multiverse-Core] prefixchatformat: " + plugin.getMVConfig().getPrefixChatFormat() + '\n'
- + "[Multiverse-Core] teleportintercept: " + plugin.getMVConfig().getTeleportIntercept() + '\n'
- + "[Multiverse-Core] firstspawnoverride: " + plugin.getMVConfig().getFirstSpawnOverride() + '\n'
- + "[Multiverse-Core] displaypermerrors: " + plugin.getMVConfig().getDisplayPermErrors() + '\n'
- + "[Multiverse-Core] enablebuscript: " + plugin.getMVConfig().getEnableBuscript() + '\n'
- + "[Multiverse-Core] globaldebug: " + plugin.getMVConfig().getGlobalDebug() + '\n'
- + "[Multiverse-Core] silentstart: " + plugin.getMVConfig().getSilentStart() + '\n'
- + "[Multiverse-Core] messagecooldown: " + plugin.getMessaging().getCooldown() + '\n'
- + "[Multiverse-Core] version: " + plugin.getMVConfig().getVersion() + '\n'
- + "[Multiverse-Core] firstspawnworld: " + plugin.getMVConfig().getFirstSpawnWorld() + '\n'
- + "[Multiverse-Core] teleportcooldown: " + plugin.getMVConfig().getTeleportCooldown() + '\n'
- + "[Multiverse-Core] defaultportalsearch: " + plugin.getMVConfig().isUsingDefaultPortalSearch() + '\n'
- + "[Multiverse-Core] portalsearchradius: " + plugin.getMVConfig().getPortalSearchRadius() + '\n'
- + "[Multiverse-Core] autopurge: " + plugin.getMVConfig().isAutoPurgeEnabled() + '\n'
- + "[Multiverse-Core] Special Code: FRN002" + '\n';
- }
-
- private String getMarkdownString() {
- return "# Multiverse-Core" + '\n'
- + "## Overview" + '\n'
- + "| Name | Value |" + '\n'
- + "| --- | --- |" + '\n'
- + "| Multiverse-Core Version | `" + this.plugin.getDescription().getVersion() + "` |" + '\n'
- + "| Bukkit Version | `" + this.plugin.getServer().getVersion() + "` |" + '\n'
- + "| Loaded Worlds | `" + this.plugin.getMVWorldManager().getMVWorlds() + "` |" + '\n'
- + "| Multiverse Plugins Loaded | `" + this.plugin.getPluginCount() + "` |" + '\n'
- + "| Economy being used | `" + plugin.getEconomist().getEconomyName() + "` |" + '\n'
- + "| Permissions Plugin | `" + this.plugin.getMVPerms().getType() + "` |" + '\n'
- + "## Parsed Config" + '\n'
- + "These are what Multiverse thought the in-memory values of the config were." + "\n\n"
- + "| Config Key | Value |" + '\n'
- + "| --- | --- |" + '\n'
- + "| version | `" + this.plugin.getMVConfig().getVersion() + "` |" + '\n'
- + "| messagecooldown | `" + plugin.getMessaging().getCooldown() + "` |" + '\n'
- + "| teleportcooldown | `" + plugin.getMVConfig().getTeleportCooldown() + "` |" + '\n'
- + "| worldnameprefix | `" + plugin.getMVConfig().getPrefixChat() + "` |" + '\n'
- + "| worldnameprefixFormat | `" + plugin.getMVConfig().getPrefixChatFormat() + "` |" + '\n'
- + "| enforceaccess | `" + plugin.getMVConfig().getEnforceAccess() + "` |" + '\n'
- + "| displaypermerrors | `" + plugin.getMVConfig().getDisplayPermErrors() + "` |" + '\n'
- + "| teleportintercept | `" + plugin.getMVConfig().getTeleportIntercept() + "` |" + '\n'
- + "| firstspawnoverride | `" + plugin.getMVConfig().getFirstSpawnOverride() + "` |" + '\n'
- + "| firstspawnworld | `" + plugin.getMVConfig().getFirstSpawnWorld() + "` |" + '\n'
- + "| debug | `" + plugin.getMVConfig().getGlobalDebug() + "` |" + '\n';
- }
-
- private void addVersionInfoToEvent(MVVersionEvent event) {
- // add the legacy version info
- event.appendVersionInfo(this.getLegacyString());
-
- // add the legacy file, but as markdown so it's readable
- // TODO Readd this in 5.0.0
- // event.putDetailedVersionInfo("version.md", this.getMarkdownString());
-
- // add config.yml
- File configFile = new File(this.plugin.getDataFolder(), "config.yml");
- event.putDetailedVersionInfo("multiverse-core/config.yml", configFile);
-
- // add worlds.yml
- File worldsFile = new File(this.plugin.getDataFolder(), "worlds.yml");
- event.putDetailedVersionInfo("multiverse-core/worlds.yml", worldsFile);
- }
-
- @Override
- public void runCommand(final CommandSender sender, final List args) {
- // Check if the command was sent from a Player.
- if (sender instanceof Player) {
- sender.sendMessage("Version info dumped to console. Please check your server logs.");
- }
-
- MVVersionEvent versionEvent = new MVVersionEvent();
-
- this.addVersionInfoToEvent(versionEvent);
- this.plugin.getServer().getPluginManager().callEvent(versionEvent);
-
- if (CommandHandler.hasFlag("--include-plugin-list", args)) {
- versionEvent.appendVersionInfo('\n' + "Plugins: " + getPluginList());
- versionEvent.putDetailedVersionInfo("plugins.txt", "Plugins: " + getPluginList());
- }
-
- final String versionInfo = versionEvent.getVersionInfo();
- versionEvent.putDetailedVersionInfo("version.txt", versionInfo);
-
- final Map files = versionEvent.getDetailedVersionInfo();
-
- // log to console
- String[] lines = versionInfo.split("\\r?\\n");
- for (String line : lines) {
- if (!line.isEmpty()) {
- this.plugin.getServer().getLogger().info(line);
- }
- }
-
- BukkitRunnable logPoster = new BukkitRunnable() {
- @Override
- public void run() {
- if (args.size() > 0) {
- String pasteUrl;
- if (CommandHandler.hasFlag("-b", args)) {
- // private post to pastebin
- pasteUrl = postToService(PasteServiceType.PASTEBIN, true, versionInfo, files);
- } else if (CommandHandler.hasFlag("-g", args)) {
- // private post to github
- pasteUrl = postToService(PasteServiceType.GITHUB, true, versionInfo, files);
- } else if (CommandHandler.hasFlag("-h", args)) {
- // private post to hastebin
- pasteUrl = postToService(PasteServiceType.HASTEBIN, true, versionInfo, files);
- } else if (CommandHandler.hasFlag("-p", args)) {
- // private post to paste.gg
- pasteUrl = postToService(PasteServiceType.PASTEGG, true, versionInfo, files);
- } else {
- return;
- }
-
- if (!(sender instanceof ConsoleCommandSender)) {
- sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteUrl);
- }
- Logging.info("Version info dumped here: %s", pasteUrl);
- }
- }
- };
-
- // Run the log posting operation asynchronously, since we don't know how long it will take.
- logPoster.runTaskAsynchronously(this.plugin);
- }
-
- /**
- * Send the current contents of this.pasteBinBuffer to a web service.
- *
- * @param type Service type to send paste data to.
- * @param isPrivate Should the paste be marked as private.
- * @param pasteData Legacy string only data to post to a service.
- * @param pasteFiles Map of filenames/contents of debug info.
- * @return URL of visible paste
- */
- private static String postToService(PasteServiceType type, boolean isPrivate, String pasteData, Map pasteFiles) {
- PasteService ps = PasteServiceFactory.getService(type, isPrivate);
-
- try {
- String result;
- if (ps.supportsMultiFile()) {
- result = ps.postData(pasteFiles);
- } else {
- result = ps.postData(pasteData);
- }
-
- if (SHORTENER != null) return SHORTENER.shorten(result);
- return result;
- } catch (PasteFailedException e) {
- e.printStackTrace();
- return "Error posting to service.";
- } catch (NullPointerException e) {
- e.printStackTrace();
- return "That service isn't supported yet.";
- }
- }
-
- private String getPluginList() {
- return StringUtils.join(plugin.getServer().getPluginManager().getPlugins(), ", ");
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/WhoCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/WhoCommand.java
deleted file mode 100644
index fa9ab935..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/WhoCommand.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/******************************************************************************
- * Multiverse 2 Copyright (c) the Multiverse Team 2011. *
- * Multiverse 2 is licensed under the BSD License. *
- * For more information please check the README.md file included *
- * with this project. *
- ******************************************************************************/
-
-package com.onarandombox.MultiverseCore.commandsold;
-
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * States who is in what world.
- */
-public class WhoCommand extends MultiverseCommand {
-
- private MVWorldManager worldManager;
-
- public WhoCommand(MultiverseCore plugin) {
- super(plugin);
- this.setName("Who?");
- this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD|--all]");
- this.setArgRange(0, 1);
- this.addKey("mv who");
- this.addKey("mvw");
- this.addKey("mvwho");
- this.addCommandExample("/mv who");
- this.addCommandExample(String.format("/mv who %s--all", ChatColor.GREEN));
- this.addCommandExample(String.format("/mv who %smyworld", ChatColor.GOLD));
- this.setPermission("multiverse.core.list.who", "States who is in what world.", PermissionDefault.OP);
- this.worldManager = this.plugin.getMVWorldManager();
- }
-
- @Override
- public void runCommand(CommandSender sender, List args) {
- // If this command was sent from a Player then we need to check Permissions
- Player p = null;
- // By default, show all from the console
- boolean showAll = true;
- if (sender instanceof Player) {
- p = (Player) sender;
- showAll = false;
- }
-
- final Collection onlinePlayers = plugin.getServer().getOnlinePlayers();
- final Collection visiblePlayers = new HashSet(onlinePlayers.size());
- for (final Object player : onlinePlayers) {
- if (player instanceof Player && (p == null || p.canSee((Player) player))) {
- visiblePlayers.add((Player) player);
- }
- }
-
- if (args.size() == 1) {
- if (args.get(0).equalsIgnoreCase("--all") || args.get(0).equalsIgnoreCase("-a")) {
- showAll = true;
- } else {
- // single world mode
- MultiverseWorld world = this.worldManager.getMVWorld(args.get(0));
- if (world == null) {
- sender.sendMessage(ChatColor.RED + "That world does not exist.");
- return;
- }
-
- if (!this.plugin.getMVPerms().canEnterWorld(p, world)) {
- sender.sendMessage(ChatColor.RED + "You aren't allowed to access to this world!");
- return;
- }
-
- sender.sendMessage(String.format("%s--- Players in %s%s ---", ChatColor.AQUA,
- world.getColoredWorldString(), ChatColor.AQUA));
- sender.sendMessage(this.buildPlayerString(world, p, visiblePlayers));
- return;
- }
- }
-
- // multiworld mode
- sender.sendMessage(ChatColor.AQUA + "--- Worlds and their players --- "
- + visiblePlayers.size() + "/" + plugin.getServer().getMaxPlayers());
- boolean shownOne = false;
- for (MultiverseWorld world : this.worldManager.getMVWorlds()) {
- if (this.plugin.getMVPerms().canEnterWorld(p, world)) { // only show world if the player can access it
- if (showAll || !world.getCBWorld().getPlayers().isEmpty()) { // either show all or show if the world is not empty
- sender.sendMessage(String.format("%s%s - %s", world.getColoredWorldString(), ChatColor.WHITE, buildPlayerString(world, p, visiblePlayers)));
- shownOne = true;
- }
- }
- }
- if (!shownOne) {
- sender.sendMessage("No worlds found.");
- }
- return;
- }
-
- private static String buildPlayerString(MultiverseWorld world, Player viewer, final Collection visiblePlayers) {
- // Retrieve the players in this world
- List players = world.getCBWorld().getPlayers();
- StringBuilder playerBuilder = new StringBuilder();
- for (Player player : players) {
- // If the viewer is the console or the viewier is allowed to see the player, show them.
- // Make sure we're also ONLY showing online players.
- // Since we already checked visible players, we'll just make sure who we're about to show is in that.
- if (visiblePlayers.contains(player))
- playerBuilder.append(player.getDisplayName()).append(", ");
- }
- String bString = playerBuilder.toString();
- return (bString.length() == 0) ? "No players found." : bString.substring(0, bString.length() - 2);
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandsold/package-info.java b/src/main/java/com/onarandombox/MultiverseCore/commandsold/package-info.java
deleted file mode 100644
index a7559b95..00000000
--- a/src/main/java/com/onarandombox/MultiverseCore/commandsold/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * This package contains all Commands.
- */
-package com.onarandombox.MultiverseCore.commandsold;
diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java b/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java
index 24ca8692..bc8a944d 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java
@@ -7,12 +7,13 @@
package com.onarandombox.MultiverseCore.utils;
+import java.util.List;
+
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
-import com.pneumaticraft.commandhandler.PermissionsInterface;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
@@ -20,13 +21,10 @@ import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
-import java.util.List;
-import java.util.logging.Level;
-
/**
- * Multiverse's {@link PermissionsInterface}.
+ * Multiverse's permission checker
*/
-public class MVPermissions implements PermissionsInterface {
+public class MVPermissions {
private MultiverseCore plugin;
private MVWorldManager worldMgr;
@@ -234,7 +232,6 @@ public class MVPermissions implements PermissionsInterface {
* @param isOpRequired deprecated This is not used for anything anymore.
* @return True if they have that permission or any parent.
*/
- @Override
public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) {
if (!(sender instanceof Player)) {
return true;
@@ -311,18 +308,9 @@ public class MVPermissions implements PermissionsInterface {
return null;
}
- /**
- * Gets the type of this {@link PermissionsInterface}.
- * @return The type of this {@link PermissionsInterface}.
- */
- public String getType() {
- return "Bukkit Permissions (SuperPerms)";
- }
-
/**
* {@inheritDoc}
*/
- @Override
public boolean hasAnyPermission(CommandSender sender, List nodes, boolean isOpRequired) {
for (String node : nodes) {
if (this.hasPermission(sender, node, isOpRequired)) {
@@ -335,7 +323,6 @@ public class MVPermissions implements PermissionsInterface {
/**
* {@inheritDoc}
*/
- @Override
public boolean hasAllPermission(CommandSender sender, List nodes, boolean isOpRequired) {
for (String node : nodes) {
if (!this.hasPermission(sender, node, isOpRequired)) {
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index d46f0fd7..c53b394f 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -5,183 +5,3 @@ website: 'https://dev.bukkit.org/projects/multiverse-core'
softdepend: ['Vault']
api-version: 1.13
version: maven-version-number
-commands:
- mv:
- description: Generic Multiverse Command
- usage: /
- mvcreate:
- description: World create command
- aliases: [mvc]
- usage: |
- /
- / creative normal -- Creates a world called 'creative' with a NORMAL environment.
- / hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
- mvimport:
- description: World import command
- aliases: [mvim]
- usage: |
- / [-g generator[:id]] [-n]
- / creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
- / hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
- mvremove:
- description: Remove world from multiverse command
- usage: |
- /
- mvdelete:
- description: Delete world from server folders command
- usage: |
- /
- mvunload:
- description: World unload command
- usage: |
- /
- mvmodify:
- description: Modify the settings of an existing world
- aliases: [mvm]
- usage: |
- / [world]
- / set pvp false creative -- Turns off PVP in the 'creative' world.
- mvmset:
- description: Modify the settings of an existing world
- usage: |
- / [world]
- / pvp false creative -- Turns off PVP in the 'creative' world.
- mvmadd:
- description: Modify the settings of an existing world
- usage: |
- / [world]
- / sheep animals world_nether -- Add sheep to animal list for 'world_nether' world.
- mvmremove:
- description: Modify the settings of an existing world
- aliases: [mvmdelete]
- usage: |
- / [world]
- / sheep animals world_nether -- remove sheep from animal list for 'world_nether' world.
- mvmclear:
- description: Modify the settings of an existing world
- usage: |
- / [world]
- / animals world_nether -- Empties animal list for 'world_nether' world.
- mvtp:
- description: Command to teleport between Worlds
- usage: |
- / [player]
- Example: / creative - Teleports you to the relevant location in the 'creative' world.
- mvlist:
- description: Print list of loaded Worlds
- aliases: [mvl]
- usage: |
- / [page]
- Example: / NETHER - Shows all NETHER Worlds.
- Example: / NORMAL - Shows all NORMAL Worlds.
- mvsetspawn:
- description: Set the spawn area for a particular world
- aliases: [mvsets, mvss]
- usage: / -- Sets the spawn area of the current world to your location.
- mvspawn:
- description: Teleport to the spawn area
- aliases: [mvs]
- usage: / [player] -- Teleports you to the spawn area of your current world.
- mvcoord:
- description: Display World, Coordinates, Direction & Compression for a world.
- aliases: [mvco]
- usage: |
- / [world]
- / -- Shows the relevant coordinates in your current world.
- / creative -- Shows the relevant coordinates if you were in the 'creative' world.
- mvwho:
- description: Display online users per world.
- aliases: [mvw]
- usage: |
- / [world|--all]
- / -- Shows who is online in each world.
- / creative -- Shows who is online in the 'creative' world.
- mvreload:
- description: Reload Configuration files.
- aliases: [mvr]
- usage: /
- mvpurge:
- description: Purge the targetted world of creatures.
- usage: |
- / [WORLD|all] [all|animals|monsters|MOBNAME]
- / -- Purges the players world of all creatures.
- / creative all -- Purges the creative world of all Creatures.
- / creative creeper -- Purges the creative world of all CREEPERS.
- mvconfirm:
- description: Confirms sensitive decisions like deleting a world.
- usage: |
- /
- mvinfo:
- description: Gets world info.
- aliases: [mvi]
- usage: |
- / [world] [page]
- mvenv:
- description: Tells the user all possible environment types.
- usage: |
- /
- mvversion:
- description: Prints out version info.
- aliases: [mvv, mvver]
- usage: |
- / [-b|-h|-p] [--include-plugin-list]
- mvhelp:
- description: Displays the Multiverse Help.
- aliases: [mvsearch, mvh]
- usage: |
- / [filter] [page #]
- mvdebug:
- description: Turns on debugging.
- usage: |
- / [1|2|3|off|silent]
- mvgenerators:
- description: Displays all found world generators.
- aliases: [mvgens]
- usage: |
- /
- mvload:
- description: Loads a world into Multiverse.
- usage: |
- /
- mvregen:
- description: Regenerates a world Multiverse already knows about.
- usage: |
- / [-s seed]
- mvscript:
- description: Runs a script from the Multiverse scripts directory.
- usage: |
- /