diff options
author | Dico200 <dico.karssiens@gmail.com> | 2015-10-20 18:03:05 +0200 |
---|---|---|
committer | Dico200 <dico.karssiens@gmail.com> | 2015-10-20 18:03:05 +0200 |
commit | 9119c3d1500a02b49d078a8a0d01a271e630092b (patch) | |
tree | f4e46239d0739ca88a2192bd47e66bf846f2174a /helpers.py | |
parent | 2db8142b35a92e93459fb9a9505778db303291a9 (diff) |
Moved /signalstrength to its own file, added default configurability, added basecommands documentation, added can_build() to helpers
Diffstat (limited to 'helpers.py')
-rw-r--r-- | helpers.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -6,6 +6,7 @@ import org.bukkit as bukkit import org.bukkit.Location as Location import org.bukkit.entity.Player as Player import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause as TeleportCause +import org.bukkit.event.block.BlockBreakEvent as BlockBreakEvent import org.bukkit.block as bblock import org.bukkit.event.entity as entity import org.bukkit.command.ConsoleCommandSender @@ -143,6 +144,15 @@ def is_player(obj): return (isinstance(obj, Player)) +def can_build(player, block): + """ + return True if the player can change/build at the location of given block + """ + event = BlockBreakEvent(block, player) + server.getPluginManager().callEvent(event) + return not event.isCancelled() + + def checkargs(sender, args, amin, amax): """ check if a command has a valid amount of args, otherwise notify the sender |