Add New api methods, Write location format better

Closes #411
This commit is contained in:
Eric Stokes 2012-01-22 14:21:18 -07:00
parent 21571bf54b
commit bf76b77cf6
4 changed files with 26 additions and 2 deletions

View File

@ -628,6 +628,14 @@ public class MVWorld implements MultiverseWorld {
return this.name;
}
/**
* {@inheritDoc}
*/
@Override
public String getPermissibleName() {
return this.name.toLowerCase();
}
/**
* {@inheritDoc}
*/

View File

@ -64,7 +64,7 @@ import java.util.logging.Logger;
* The implementation of the Multiverse-{@link Core}.
*/
public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
private static final int PROTOCOL = 11;
private static final int PROTOCOL = 12;
// Global Multiverse config variable, states whether or not
// Multiverse should stop other plugins from teleporting players
// to worlds.

View File

@ -145,6 +145,18 @@ public interface MultiverseWorld {
*/
String getName();
/**
* Gets the lowercased name of the world. This method is required, since the permissables
* lowercase all permissions when recalculating.
* <p>
* Note: This also means if a user has worlds named: world and WORLD, that they can both
* exist, and both be teleported to independently, but their permissions **cannot** be
* uniqueified at this time. See bug report #.
*
* @return The lowercased name of the world.
*/
String getPermissibleName();
/**
* Gets the alias of this world.
* <p>

View File

@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
import java.text.DecimalFormat;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
@ -57,7 +58,10 @@ public class LocationManipulation {
if (location == null) {
return "";
}
return String.format("%s:%.2f,%.2f,%.2f:%.2f:%.2f", location.getWorld().getName(),
// We set the locale to ENGLISH here so we always save with the format:
// world:1.2,5.4,3.6:1.8:21.3
// Otherwise we blow up when parsing!
return String.format(Locale.ENGLISH, "%s:%.2f,%.2f,%.2f:%.2f:%.2f", location.getWorld().getName(),
location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}