first
This commit is contained in:
parent
d6965a43ca
commit
c44dd44e66
1 changed files with 24 additions and 0 deletions
24
src/main/javascript/utils/utils.js
Normal file
24
src/main/javascript/utils/utils.js
Normal 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;
|
||||
}
|
||||
};
|
Reference in a new issue