documentation/Examples

Printing the items all players hold in their hands (as typed from console, no leading slash)

py for player in server.getOnlinePlayers():...
.print player.getItemInHand()
.

Define a function to let you easily teleport players (as typed from ingame, leading slash before the command)

/py def tp(name,x,y,z):...
.player = server.getPlayer(name)
.location = bukkit.Location(player.getWorld(),x,y,z)
.player.teleport(location)
.

then you can later on do:

/py tp("zaph34r",0,100,0)

Create a quick (and rather pointless) macro to teleport you to the spawn

/pymacro spawn self.teleport(self.getWorld().getSpawnLocation())

used later with

/py spawn

Create a macro to display who is online in all worlds

py for world in server.getWorlds():...
.print "Players in world '%s'"%world.getName()
.for player in world.getPlayers():
..print "    "+player.getName()
macro players_by_world

which can be called later via

py players_by_world

or saved as a script with

py save players_by_world census.py
py save players_by_world census

(both result in the same, the extension is added if necessary)
and then called via

py census.py

even after a server restart


Comments

Posts Quoted:
Reply
Clear All Quotes