Attempting to get my local to get rid of old files.

This commit is contained in:
Aki Tensai 2011-07-16 14:06:45 -06:00
parent 6a6d1a2a10
commit 2a7504c044
8 changed files with 0 additions and 556 deletions

View File

@ -1,60 +0,0 @@
package com.onarandombox.MultiverseCore.command.commands;
import java.io.File;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
import com.onarandombox.MultiverseCore.command.CommandManager;
public class CreateCommand extends BaseCommand {
public CreateCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Create World";
this.description = "Creates a new world of the specified type.";
this.usage = "/mvcreate" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]]";
this.minArgs = 2;
this.maxArgs = 6;
this.identifiers.add("mvcreate");
this.permission = "multiverse.world.create";
this.requiresOp = true;
}
@Override
public void execute(CommandSender sender, String[] args) {
if (args.length % 2 != 0) {
sender.sendMessage("You must preface your SEED with -s OR your GENERATOR with -g. Type /mv for help");
return;
}
String worldName = args[0];
String env = args[1];
String seed = CommandManager.getFlag("-s", args);
String generator = CommandManager.getFlag("-g", args);
if (new File(worldName).exists() || this.plugin.isMVWorld(worldName)) {
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 = this.plugin.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
sender.sendMessage(ChatColor.AQUA + "Starting world creation...");
if (this.plugin.addWorld(worldName, environment, seed, generator)) {
sender.sendMessage(ChatColor.GREEN + "Complete!");
} else {
sender.sendMessage(ChatColor.RED + "FAILED.");
}
return;
}
}

View File

@ -1,71 +0,0 @@
/**
* Copyright (C) 2011 DThielke <dave.thielke@gmail.com>
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or send a letter to
* Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
**/
package com.onarandombox.MultiverseCore.command.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
public class HelpCommand extends BaseCommand {
private static final int CMDS_PER_PAGE = 8;
public HelpCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Help";
this.description = "Displays the help menu.";
this.usage = ChatColor.AQUA + "/mv help " + ChatColor.GOLD + "[page#]";
this.minArgs = 0;
this.maxArgs = 1;
this.identifiers.add("mv");
this.identifiers.add("mv help");
this.permission = "multiverse.help";
this.requiresOp = false;
}
@Override
public void execute(CommandSender sender, String[] args) {
int page = 0;
if (args.length != 0) {
try {
page = Integer.parseInt(args[0]) - 1;
} catch (NumberFormatException e) {
}
}
// Get only the commands this player has access to
List<BaseCommand> commands = this.plugin.getCommandManager().getCommands(sender);
int numPages = commands.size() / CMDS_PER_PAGE;
if (commands.size() % CMDS_PER_PAGE != 0) {
numPages++;
}
if (page >= numPages || page < 0) {
page = 0;
}
sender.sendMessage(ChatColor.GREEN + "-----[ " + ChatColor.WHITE + this.plugin.getTag().replace("[", "").replace("]", "") + " Help <" + (page + 1) + "/" + numPages + ">" + ChatColor.GREEN + " ]-----");
int start = page * CMDS_PER_PAGE;
int end = start + CMDS_PER_PAGE;
if (end > commands.size()) {
end = commands.size();
}
for (int c = start; c < end; c++) {
BaseCommand cmd = commands.get(c);
sender.sendMessage(ChatColor.AQUA + " " + cmd.getUsage());
}
sender.sendMessage(ChatColor.GREEN + "For more info on a particular command, type '/<command> ?'");
}
}

View File

@ -1,74 +0,0 @@
package com.onarandombox.MultiverseCore.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
// This will contain all the properties that support the ADD/REMOVE
// Anything not in here will only support the SET action
public class ModifyAddCommand extends BaseCommand {
public ModifyAddCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Modify a World (Add a value)";
this.description = "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.";
this.usage = "/mvmodify " + ChatColor.GREEN + "ADD {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ";
this.minArgs = 3;
this.maxArgs = 4;
this.identifiers.add("mvmodify add");
this.permission = "multiverse.world.modify";
this.requiresOp = true;
}
@Override
public void execute(CommandSender sender, String[] args) {
// We NEED a world from the command line
Player p = null;
if (!(sender instanceof Player)) {
p = (Player) sender;
}
if (args.length == 3 && p == null) {
sender.sendMessage("From the command line, WORLD is required.");
sender.sendMessage(this.description);
sender.sendMessage(this.usage);
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String value = args[1];
String property = args[2];
if (args.length == 3) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args[3]);
}
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 wiki for more information: URLGOESHERE FERNFERRET DON'T FORGET IT!");
return;
}
if (world.addToList(property, value)) {
sender.sendMessage(value + " was added to " + property);
} else {
sender.sendMessage(value + " could not be added to " + property);
}
}
}

View File

@ -1,66 +0,0 @@
package com.onarandombox.MultiverseCore.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
public class ModifyClearCommand extends BaseCommand {
public ModifyClearCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Modify a World (Clear a property)";
this.description = "Removes all values from a property. This will work on properties that contain lists.";
this.usage = "/mvmodify" + ChatColor.GREEN + " CLEAR {PROPERTY}" + ChatColor.GOLD + " [WORLD] ";
this.minArgs = 2;
this.maxArgs = 3;
this.identifiers.add("mvmodify clear");
this.permission = "multiverse.world.modify";
this.requiresOp = true;
}
@Override
public void execute(CommandSender sender, String[] args) {
// We NEED a world from the command line
Player p = null;
if (!(sender instanceof Player)) {
p = (Player) sender;
}
if (args.length == 2 && p == null) {
sender.sendMessage("From the command line, WORLD is required.");
sender.sendMessage(this.description);
sender.sendMessage(this.usage);
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String property = args[1];
if (args.length == 2) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args[2]);
}
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 wiki for more information: URLGOESHERE FERNFERRET DON'T FORGET IT!");
return;
}
if (world.clearList(property)) {
sender.sendMessage(property + " was cleared. It contains 0 values now.");
} else {
sender.sendMessage(property + " was NOT cleared.");
}
}
}

View File

@ -1,69 +0,0 @@
package com.onarandombox.MultiverseCore.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
public class ModifyRemoveCommand extends BaseCommand {
public ModifyRemoveCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Modify a World";
this.description = "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.";
this.usage = "/mvmodify" + ChatColor.GREEN + "REMOVE {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD] ";
this.minArgs = 3;
this.maxArgs = 4;
this.identifiers.add("mvmodify remove");
this.identifiers.add("mvmodify r");
this.permission = "multiverse.world.modify";
this.requiresOp = true;
}
@Override
public void execute(CommandSender sender, String[] args) {
// We NEED a world from the command line
Player p = null;
if (!(sender instanceof Player)) {
p = (Player) sender;
}
if (args.length == 3 && p == null) {
sender.sendMessage("From the command line, WORLD is required.");
sender.sendMessage(this.description);
sender.sendMessage(this.usage);
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String value = args[1];
String property = args[2];
if (args.length == 3) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args[3]);
}
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 wiki for more information: URLGOESHERE FERNFERRET DON'T FORGET IT!");
return;
}
if (world.removeFromList(property, value)) {
sender.sendMessage(value + " was removed from " + property);
} else {
sender.sendMessage(value + " could not be removed from " + property);
}
}
}

View File

@ -1,68 +0,0 @@
package com.onarandombox.MultiverseCore.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
public class ModifySetCommand extends BaseCommand {
public ModifySetCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Modify a World (Set a value)";
this.description = "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.";
this.usage = "/mvmodify" + ChatColor.GREEN + " SET {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD] ";
this.minArgs = 3;
this.maxArgs = 4;
this.identifiers.add("mvmodify set");
this.permission = "multiverse.world.modify";
this.requiresOp = true;
}
@Override
public void execute(CommandSender sender, String[] args) {
// We NEED a world from the command line
Player p = null;
if (!(sender instanceof Player)) {
p = (Player) sender;
}
if (args.length == 3 && p == null) {
sender.sendMessage("From the command line, WORLD is required.");
sender.sendMessage(this.description);
sender.sendMessage(this.usage);
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String value = args[1];
String property = args[2];
if (args.length == 3) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args[3]);
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Set, property)) {
sender.sendMessage("Sorry, you can't SET " + property);
sender.sendMessage("Please visit our wiki for more information: URLGOESHERE FERNFERRET DON'T FORGET IT!");
return;
}
if (world.setVariable(property, value)) {
sender.sendMessage("Property " + property + " was set to " + value);
} else {
sender.sendMessage("There was an error setting " + property);
}
}
}

View File

@ -1,57 +0,0 @@
package com.onarandombox.MultiverseCore.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
public class SpawnCommand extends BaseCommand {
public SpawnCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Spawn";
this.description = "Teleports target player to the Spawn Point of the world they are in.";
this.usage = "/mvspawn" + ChatColor.GOLD + " [PLAYER]";
this.minArgs = 0;
this.maxArgs = 1;
this.identifiers.add("mvspawn");
this.permission = "multiverse.world.spawn.self";
this.requiresOp = false;
}
@Override
public void execute(CommandSender sender, String[] args) {
Player commandSender = null;
if (sender instanceof Player) {
commandSender = (Player) sender;
}
// If a persons name was passed in, you must be A. the console, or B have permissions
if (args.length == 1) {
if(commandSender != null && !this.plugin.ph.hasPermission(commandSender, "multiverse.world.spawn.other", true)) {
sender.sendMessage("You don't have permission to teleport another player to spawn.");
return;
}
Player target = this.plugin.getServer().getPlayer(args[0]);
if (target != null) {
target.sendMessage("Teleporting to this world's spawn...");
target.teleport(target.getWorld().getSpawnLocation());
if (commandSender != null) {
target.sendMessage("You were teleported by: " + ChatColor.YELLOW + commandSender.getName());
} else {
target.sendMessage("You were teleported by: " + ChatColor.LIGHT_PURPLE + "the console");
}
} else {
sender.sendMessage(args[0] + " is not logged on right now!");
}
} else {
if (commandSender != null) {
commandSender.sendMessage("Teleporting to this world's spawn...");
commandSender.teleport(commandSender.getWorld().getSpawnLocation());
} else {
sender.sendMessage("From the console, you must provide a PLAYER.");
}
}
}
}

View File

@ -1,91 +0,0 @@
package com.onarandombox.MultiverseCore.command.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.command.BaseCommand;
public class WhoCommand extends BaseCommand {
public WhoCommand(MultiverseCore plugin) {
super(plugin);
this.name = "Who";
this.description = "States who is in what world.";
this.usage = "/mvwho" + ChatColor.GOLD + " [WORLD]";
this.minArgs = 0;
this.maxArgs = 1;
this.identifiers.add("mvwho");
this.permission = "multiverse.world.list.who";
this.requiresOp = false;
}
@Override
public void execute(CommandSender sender, String[] args) {
// If this command was sent from a Player then we need to check Permissions
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
List<MVWorld> worlds = new ArrayList<MVWorld>();
if (args.length > 0) {
if (this.plugin.isMVWorld(args[0])) {
worlds.add(this.plugin.getMVWorld(args[0]));
} else {
sender.sendMessage(ChatColor.RED + "World does not exist");
return;
}
} else {
worlds = new ArrayList<MVWorld>(this.plugin.getMVWorlds());
}
for (MVWorld world : worlds) {
if (!(this.plugin.isMVWorld(world.getName()))) {
continue;
}
World w = this.plugin.getServer().getWorld(world.getName());
if (p != null && (!this.plugin.ph.canEnterWorld(p, w))) {
continue;
}
ChatColor color = ChatColor.GOLD;
Environment env = world.getEnvironment();
if (env == Environment.NETHER) {
color = ChatColor.RED;
} else if (env == Environment.NORMAL) {
color = ChatColor.GREEN;
} else if (env == Environment.SKYLANDS) {
color = ChatColor.AQUA;
}
List<Player> players = w.getPlayers();
String result = "";
if (players.size() <= 0) {
result = "Empty";
} else {
for (Player player : players) {
result += player.getName() + " ";
}
}
String worldName = world.getName();
if(world.getAlias() != null && world.getAlias().length() > 0) {
worldName = world.getAlias();
color = world.getAliasColor();
}
sender.sendMessage(color + worldName + ChatColor.WHITE + " - " + result);
}
return;
}
}