This commit is contained in:
walterhiggins 2013-02-10 17:53:08 +00:00
parent d6965a43ca
commit c44dd44e66

View file

@ -0,0 +1,24 @@
/************************************************************************
Utilities Module
================
Miscellaneous utility functions and classes to help with programming.
* locationToString(Location) - returns a bukkit Location object in string form.
* getPlayerObject(playerName) - returns the Player object for a named
player or `self` if no name is provided.
***/
var utils = utils || {
locationToString: function(location){
return JSON.stringify([""+location.world.name,location.x, location.y, location.z]);
},
getPlayerObject: function(playerName){
if (typeof playerName == "undefined")
return self;
if (typeof playerName == "string")
return org.bukkit.Bukkit.getPlayer(playerName);
return player;
}
};