You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tad Hardesty edited this page Jun 16, 2014
·
3 revisions
Importing
To import Java classes, such as Bukkit classes, the following is possible:
# use 'World' to refer to the World interfacefromorg.bukkitimportWorld# use 'Player', 'Creeper', and 'Zombie' to refer to the entity classesfromorg.bukkit.entityimportPlayer, Creeper, Zombie# access Java's System classfromjava.langimportSystem
Note that most of the time you don't need to import classes unless you plan to construct instances or use static methods or variables.
Accessing properties
Many objects have getters and setters - methods with signatures like int getThing() and void setThing(int thing). In Python, it's still possible to access these methods directly, but they also act as properties:
server=Bukkit.getServer()
maxPlayers=server.getMaxPlayers() # works as normalmaxPlayers=server.maxPlayers# also worksserver.setWhitelist(True) # works as normalserver.whitelist=True# also works