mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-16 12:31:59 +01:00
Starting on the create command
This commit is contained in:
parent
f2b9b95dc9
commit
00b7af5c84
@ -45,11 +45,10 @@ import com.onarandombox.MultiverseCore.command.CommandManager;
|
||||
import com.onarandombox.MultiverseCore.command.commands.CoordCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.HelpCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.ListCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.CreateCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.SetSpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.WhoCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.TeleportCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.MVCoord;
|
||||
import com.onarandombox.MultiverseCore.commands.MVCreate;
|
||||
import com.onarandombox.MultiverseCore.commands.MVImport;
|
||||
import com.onarandombox.MultiverseCore.commands.MVModify;
|
||||
import com.onarandombox.MultiverseCore.commands.MVReload;
|
||||
@ -296,13 +295,14 @@ public class MultiverseCore extends JavaPlugin {
|
||||
commandManager.addCommand(new ListCommand(this));
|
||||
commandManager.addCommand(new WhoCommand(this));
|
||||
commandManager.addCommand(new SetSpawnCommand(this));
|
||||
commandManager.addCommand(new CreateCommand(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup commands to the Command Handler
|
||||
*/
|
||||
private void setupCommands() {
|
||||
commands.put("mvcreate", new MVCreate(this));
|
||||
// commands.put("mvcreate", new CreateCommand(this));
|
||||
commands.put("mvimport", new MVImport(this));
|
||||
commands.put("mvremove", new MVRemove(this));
|
||||
commands.put("mvmodify", new MVModify(this));
|
||||
@ -310,7 +310,7 @@ public class MultiverseCore extends JavaPlugin {
|
||||
// commands.put("mvlist", new ListCommand(this));
|
||||
// commands.put("mvsetspawn", new SetSpawnCommand(this));
|
||||
commands.put("mvspawn", new MVSpawn(this));
|
||||
commands.put("mvcoord", new MVCoord(this));
|
||||
// commands.put("mvcoord", new MVCoord(this));
|
||||
// commands.put("mvwho", new WhoCommand(this));
|
||||
commands.put("mvreload", new MVReload(this));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
package com.onarandombox.MultiverseCore.command.commands;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -6,44 +6,52 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVCommandHandler;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
||||
|
||||
public class MVCreate extends MVCommandHandler {
|
||||
public class CreateCommand extends BaseCommand {
|
||||
|
||||
public MVCreate(MultiverseCore plugin) {
|
||||
public CreateCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
name = "Create World";
|
||||
description = "Creates a new world of the specified type";
|
||||
usage = "/mvcoord" + ChatColor.GREEN + "{NAME} {TYPE}";
|
||||
minArgs = 2;
|
||||
maxArgs = 2;
|
||||
identifiers.add("mvcoord");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perform(CommandSender sender, String[] args) {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
// TODO: Permissions, check
|
||||
if (args.length != 2) {
|
||||
sender.sendMessage("Not enough parameters to create a new world");
|
||||
sender.sendMessage(ChatColor.RED + "/mvcreate WORLDNAME ENVIRONMENT - Create a new World.");
|
||||
sender.sendMessage(ChatColor.RED + "Example - /mvcreate hellworld nether");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (new File(args[0].toString()).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 true;
|
||||
return;
|
||||
}
|
||||
// String name = args[0].toString();
|
||||
String env = args[1].toString();
|
||||
Environment environment = null;
|
||||
if (env.equalsIgnoreCase("NETHER"))
|
||||
if (env.equalsIgnoreCase("NETHER") || env.equalsIgnoreCase("HELL"))
|
||||
environment = Environment.NETHER;
|
||||
|
||||
if (env.equalsIgnoreCase("NORMAL"))
|
||||
environment = Environment.NORMAL;
|
||||
|
||||
if (env.equalsIgnoreCase("SKYLANDS") || env.equalsIgnoreCase("SKYLAND"))
|
||||
environment = Environment.SKYLANDS;
|
||||
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Environment type does not exist!");
|
||||
sender.sendMessage(ChatColor.RED + "Only Normal & Nether exist as Environments");
|
||||
return false;
|
||||
sender.sendMessage(ChatColor.RED + "Environment type " + env + " does not exist!");
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.onarandombox.MultiverseCore.command.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
||||
|
||||
public class EnvironmentCommand extends BaseCommand{
|
||||
|
||||
public EnvironmentCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
name = "Create World";
|
||||
description = "Creates a new world of the specified type";
|
||||
usage = "/mvcoord" + ChatColor.GREEN + "{NAME} {TYPE}";
|
||||
minArgs = 2;
|
||||
maxArgs = 2;
|
||||
identifiers.add("mvcoord");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
|
||||
sender.sendMessage(ChatColor.GREEN + "NORMAL");
|
||||
sender.sendMessage(ChatColor.RED + "NETHER");
|
||||
sender.sendMessage(ChatColor.AQUA + "SKYLANDS");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user