More tweaks
This commit is contained in:
@@ -134,6 +134,7 @@ def svs_command(sender, command, label, args):
|
|||||||
#------------------------ Sub commands that require the block to be a sign -------------------------------
|
#------------------------ Sub commands that require the block to be a sign -------------------------------
|
||||||
if arg1 == "claim":
|
if arg1 == "claim":
|
||||||
Validate.isTrue(not sign, signsMsg("The %s was already claimed" % signName))
|
Validate.isTrue(not sign, signsMsg("The %s was already claimed" % signName))
|
||||||
|
Validate.isTrue(can_build2(block, player), signsMsg("You are not permitted to claim signs here"))
|
||||||
target = sender
|
target = sender
|
||||||
if arg2:
|
if arg2:
|
||||||
Validate.isTrue(player.hasPermission("utils.serversigns.admin"), signsMsg("You are not authorized to claim signs for other players"))
|
Validate.isTrue(player.hasPermission("utils.serversigns.admin"), signsMsg("You are not authorized to claim signs for other players"))
|
||||||
@@ -251,7 +252,7 @@ faces = {
|
|||||||
BlockFace.EAST : (5,),
|
BlockFace.EAST : (5,),
|
||||||
}
|
}
|
||||||
|
|
||||||
@hook.event("block.BlockBreakEvent", "lowest")
|
@hook.event("block.BlockBreakEvent", "monitor")
|
||||||
def on_break(event):
|
def on_break(event):
|
||||||
try:
|
try:
|
||||||
global checking_block
|
global checking_block
|
||||||
@@ -277,7 +278,7 @@ def on_break(event):
|
|||||||
def check_sign(event, block, attached = True):
|
def check_sign(event, block, attached = True):
|
||||||
player = event.getPlayer()
|
player = event.getPlayer()
|
||||||
sign = getSign(fromLoc(block.getLocation()))
|
sign = getSign(fromLoc(block.getLocation()))
|
||||||
if not can_build(player, block):
|
if not can_build2(player, block):
|
||||||
event.setCancelled(True)
|
event.setCancelled(True)
|
||||||
msg(event.getPlayer(), signsMsg("You cannot break %s" % ("the sign attached to that block" if attached else "that sign")))
|
msg(event.getPlayer(), signsMsg("You cannot break %s" % ("the sign attached to that block" if attached else "that sign")))
|
||||||
else:
|
else:
|
||||||
@@ -286,7 +287,7 @@ def check_sign(event, block, attached = True):
|
|||||||
save_signs()
|
save_signs()
|
||||||
msg(player, signsMsg("Reset the %s which you just broke" % identifySign(loc)))
|
msg(player, signsMsg("Reset the %s which you just broke" % identifySign(loc)))
|
||||||
|
|
||||||
def can_build(player, block):
|
def can_build2(player, block):
|
||||||
global checking_block
|
global checking_block
|
||||||
event = BlockBreakEvent(block, player)
|
event = BlockBreakEvent(block, player)
|
||||||
checking_block = True
|
checking_block = True
|
||||||
|
|||||||
Reference in New Issue
Block a user