Moved /signalstrength to its own file, added default configurability, added basecommands documentation, added can_build() to helpers

This commit is contained in:
Dico200
2015-10-20 18:03:05 +02:00
parent 2db8142b35
commit 9119c3d150
4 changed files with 68 additions and 94 deletions

View File

@@ -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