1
0
mirror of https://github.com/Multiverse/Multiverse-Core.git synced 2025-03-12 06:43:05 +01:00

Lots of code cleanup

This commit is contained in:
Eric Stokes 2011-06-03 16:44:15 -04:00
parent 5223bef9d0
commit babc3a8d76
2 changed files with 85 additions and 86 deletions
src/com/onarandombox/MultiverseCore

View File

@ -304,16 +304,16 @@ public class MultiverseCore extends JavaPlugin {
* Setup commands to the Command Handler
*/
private void setupCommands() {
// commands.put("mvcreate", new CreateCommand(this));
// commands.put("mvimport", new ImportCommand(this));
// commands.put("mvcreate", new CreateCommand(this));
// commands.put("mvimport", new ImportCommand(this));
commands.put("mvremove", new MVRemove(this));
commands.put("mvmodify", new MVModify(this));
// commands.put("mvtp", new TeleportCommand(this));
// commands.put("mvlist", new ListCommand(this));
// commands.put("mvsetspawn", new SetSpawnCommand(this));
// commands.put("mvtp", new TeleportCommand(this));
// 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("mvwho", new WhoCommand(this));
// commands.put("mvcoord", new MVCoord(this));
// commands.put("mvwho", new WhoCommand(this));
commands.put("mvreload", new MVReload(this));
}
@ -326,8 +326,8 @@ public class MultiverseCore extends JavaPlugin {
// Grab all the Worlds from the Config.
List<String> worldKeys = configWorlds.getKeys("worlds");
// Check that the list actually contains any data.
if (worldKeys != null && worldKeys.size() > 0) {
// Check that the list is not null.
if (worldKeys != null) {
for (String worldKey : worldKeys) {
// Check if the World is already loaded within the Plugin.
if (worlds.containsKey(worldKey)) {
@ -338,12 +338,8 @@ public class MultiverseCore extends JavaPlugin {
String seedString = configWorlds.getString("worlds." + worldKey + ".seed", "");
Long seed = null;
// Work out the Environment
Environment env;
if (environment.equalsIgnoreCase("NETHER")) {
env = Environment.NETHER;
} else if(environment.equalsIgnoreCase("NETHER")) {
env = Environment.SKYLANDS;
} else {
Environment env = getEnvFromString(environment, null);
if(env == null) {
env = Environment.NORMAL;
}
// Output to the Log that wea re loading a world, specify the name and environment type.
@ -373,6 +369,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Get the worlds Seed.
*
* @param w World
* @return Seed
*/
@ -382,6 +379,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param environment Environment Type
*/
@ -413,6 +411,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Grab the players session if one exists, otherwise create a session then return it.
*
* @param player
* @return
*/
@ -427,6 +426,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Grab and return the Teleport class.
*
* @return
*/
public MVTeleport getTeleporter() {
@ -435,6 +435,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Grab the iConomy setup.
*
* @return
*/
public static iConomy getiConomy() {
@ -458,19 +459,11 @@ public class MultiverseCore extends JavaPlugin {
return true;
}
return commandManager.dispatch(sender, command, commandLabel, args);
// MVCommandHandler handler = commands.get(command.getName().toLowerCase());
//
// if (handler != null) {
// return handler.perform(sender, args);
// } else {
// return false;
// }
}
/**
* Print messages to the server Log as well as to our DebugLog.
* 'debugLog' is used to seperate Heroes information from the Servers Log Output.
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information from the Servers Log Output.
*
* @param level
* @param msg
*/
@ -480,8 +473,8 @@ public class MultiverseCore extends JavaPlugin {
}
/**
* Print messages to the Debug Log, if the servers in Debug Mode then we
* also wan't to print the messages to the standard Server Console.
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the standard Server Console.
*
* @param level
* @param msg
*/
@ -498,6 +491,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
* @return
*/
private String getAuthors() {
@ -525,8 +519,10 @@ public class MultiverseCore extends JavaPlugin {
public String getTag() {
return tag;
}
/**
* This code should get moved somewhere more appropriate, but for now, it's here.
*
* @param env
* @return
*/
@ -545,7 +541,10 @@ public class MultiverseCore extends JavaPlugin {
try {
environment = Environment.valueOf(env);
} catch (IllegalArgumentException e) {
// Sender will be null on loadWorlds
if (sender != null) {
sender.sendMessage(ChatColor.RED + "Environment type " + env + " does not exist!");
}
// TODO: Show the player the mvenvironments command.
}
return environment;

View File

@ -44,7 +44,7 @@ public class ListCommand extends BaseCommand {
continue;
}
ChatColor color;
ChatColor color = ChatColor.GREEN;
if (world.getEnvironment() == Environment.NETHER) {
color = ChatColor.RED;