Some more formatting.

This commit is contained in:
Rigby 2011-07-14 03:31:44 +01:00
parent 0925c37eb4
commit 00449e9206
12 changed files with 47 additions and 33 deletions

View File

@ -87,8 +87,8 @@ public class MVConfigMigrator {
private void migrateListItem(Configuration newConfig, Configuration oldConfig, String key, String oldProperty, String newProperty) {
List<String> list = Arrays.asList(oldConfig.getString("worlds." + key + oldProperty).split(","));
if(list.size() > 0) {
if(list.get(0).length() == 0) {
if (list.size() > 0) {
if (list.get(0).length() == 0) {
list = new ArrayList<String>();
}
}

View File

@ -35,7 +35,7 @@ public class MVPluginListener extends ServerListener {
if (Arrays.asList(AllPay.validEconPlugins).contains(event.getPlugin().getDescription().getName())) {
this.plugin.bank = this.plugin.banker.loadEconPlugin();
}
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("MultiVerse")) {
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("MultiVerse")) {
this.plugin.getServer().getPluginManager().disablePlugin(event.getPlugin());
this.plugin.log(Level.WARNING, "I just disabled the old version of Multiverse for you. You should remove the JAR now, your configs have been migrated.");
new DefaultConfiguration(this.plugin.getDataFolder(), "config.yml", this.plugin.migrator);

View File

@ -356,7 +356,7 @@ public class MVWorld {
/**
* This is the one people have access to. It'll handle the rest.
*
*
* @param name
* @param value
* @return
@ -510,7 +510,7 @@ public class MVWorld {
/**
* Sets the chat color from a string.
*
*
* @param aliasColor
*/
public void setAliasColor(String aliasColor) {

View File

@ -143,7 +143,7 @@ public class MultiverseCore extends JavaPlugin {
* Load the Configuration files OR create the default config files.
*/
public void loadConfigs() {
// Call the defaultConfiguration class to create the config files if they don't already exist.
new DefaultConfiguration(getDataFolder(), "config.yml", this.migrator);
new DefaultConfiguration(getDataFolder(), "worlds.yml", this.migrator);

View File

@ -9,7 +9,7 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
/**
* https://github.com/Nijikokun/iConomy3/blob/master/com/nijiko/coelho/iConomy/iConomy.java
*
*
* @author Nijikokun & Coelho
*/
public class DefaultConfiguration {

View File

@ -7,7 +7,7 @@ import org.bukkit.World;
public class BlockSafety {
/**
* This function checks whether the block at the given coordinates are above air or not.
*
*
* @param world
* @param x
* @param y
@ -27,7 +27,7 @@ public class BlockSafety {
/**
* This function checks whether the block at the coordinates given is safe or not by checking for Laval/Fire/Air etc. This also ensures there is enough space for a player to spawn!
*
*
* @param world
* @param x
* @param y
@ -40,7 +40,7 @@ public class BlockSafety {
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
upOne.setY(upOne.getY() + 1);
downOne.setY(downOne.getY() - 1);
if (actual.getBlock().getType() != Material.AIR || upOne.getBlock().getType() != Material.AIR)
return false;
@ -61,14 +61,14 @@ public class BlockSafety {
return true;
}
public void showDangers(Location l) {
Location actual = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
Location upOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
upOne.setY(upOne.getY() + 1);
downOne.setY(downOne.getY() - 1);
System.out.print("Location Up: " + upOne.getBlock().getType());
System.out.print(" " + upOne);
System.out.print("Location: " + actual.getBlock().getType());

View File

@ -1,5 +1,5 @@
package com.onarandombox.utils;
public class CommandCatcher extends Thread {
}

View File

@ -15,10 +15,12 @@ public class DebugLog {
private FileHandler fh;
private Logger log;
/**
* Creates a new debug logger.
*
* @param logger The name of the logger.
* @param file The file to log to.
* @param file The file to log to.
*/
public DebugLog(String logger, String file) {
this.log = Logger.getLogger(logger);
@ -38,8 +40,10 @@ public class DebugLog {
e.printStackTrace();
}
}
/**
* Log a message at a certain level
*
* @param level
* @param msg
*/

View File

@ -5,26 +5,28 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
public class Destination {
private String name;
private DestinationType type;
public Destination(String name, DestinationType type) {
this.name = name;
this.type = type;
}
public String getName() {
return this.name;
}
public DestinationType getType() {
return this.type;
}
private static Destination getBadDestination() {
return new Destination("", DestinationType.Invalid);
}
/**
* Takes the given string and returns a Destination. This will NEVER be NULL. It will return a destination of type Invalid if the destination is bad.
* @param dest The parceable string, ex: w:My World
*
* @param dest The parceable string, ex: w:My World
* @param plugin The MultiverseCore plugin used to find valid worlds/portals
* @return A new Destination from the parsed string.
*/
@ -32,17 +34,17 @@ public class Destination {
if (dest == null) {
return getBadDestination();
}
String[] items = dest.split(":");
if (items.length > 2) {
return getBadDestination();
}
// If we only found one param, assume world, but still check for validity
if (items.length == 1 && plugin.isMVWorld(items[0])) {
return new Destination(items[0], DestinationType.World);
}
if (items[0].equalsIgnoreCase("w") && plugin.isMVWorld(items[0])) {
return new Destination(items[1], DestinationType.World);
} else if (items[0].equalsIgnoreCase("p")) {

View File

@ -7,6 +7,7 @@ public class LocationManipulation {
/**
* Convert a Location into a Colon separated string to allow us to store it in text.
*
* @param location
* @return
*/
@ -22,6 +23,7 @@ public class LocationManipulation {
/**
* Convert a String to a Location.
*
* @param world
* @param xStr
* @param yStr
@ -42,6 +44,7 @@ public class LocationManipulation {
/**
* Convert a Location to XYZ Coordinates.
*
* @param l
* @return
*/
@ -55,6 +58,7 @@ public class LocationManipulation {
/**
* Return the NESW Direction a Location is facing.
*
* @param location
* @return
*/

View File

@ -14,13 +14,13 @@ import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class PurgeWorlds {
MultiverseCore plugin;
public PurgeWorlds(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* Synchronizes the given world with it's settings
*/
@ -32,8 +32,10 @@ public class PurgeWorlds {
this.purgeWorld(sender, world);
}
}
/**
* Convince method for clearing all the animals that do not belong according to the config.
*
* @param sender
* @param world
*/
@ -45,17 +47,18 @@ public class PurgeWorlds {
allMobs.addAll(world.getMonsterList());
purgeWorld(sender, world, allMobs, !world.allowAnimalSpawning(), !world.allowMonsterSpawning());
}
public void purgeWorld(CommandSender sender, MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters) {
if (mvworld == null)
if (mvworld == null) {
return;
}
World world = this.plugin.getServer().getWorld(mvworld.getName());
if (world == null) {
return;
}
int entitiesKilled = 0;
for (Entity e : world.getEntities()) {
// Check against Monsters
if (killMonster(mvworld, e, thingsToKill, negateMonsters)) {
entitiesKilled++;
@ -66,13 +69,13 @@ public class PurgeWorlds {
entitiesKilled++;
continue;
}
}
if (sender != null) {
sender.sendMessage(entitiesKilled + " entities purged from the world.");
}
}
private boolean killCreature(MVWorld mvworld, Entity e, List<String> creaturesToKill, boolean negate) {
String entityName = e.toString().replaceAll("Craft", "").toUpperCase();
if (e instanceof Squid || e instanceof Animals) {
@ -90,10 +93,10 @@ public class PurgeWorlds {
}
return false;
}
/**
* Will kill the monster if it's in the list UNLESS the NEGATE boolean is set, then it will kill it if it's NOT
*
*
* @param mvworld
* @param e
* @param creaturesToKill
@ -117,5 +120,5 @@ public class PurgeWorlds {
}
return false;
}
}

View File

@ -79,6 +79,7 @@ public class UpdateChecker {
/**
* Convert the given Version String to a Normalised Version String so we can compare it.
*
* @param version
* @return
*/