Serversigns hotfix
This commit is contained in:
2
main.py
2
main.py
@@ -23,6 +23,8 @@ def on_enable():
|
|||||||
shared["modules"]["blockplacemods"].schedule_torch_breaker()
|
shared["modules"]["blockplacemods"].schedule_torch_breaker()
|
||||||
if "imbusy" in shared["modules"]:
|
if "imbusy" in shared["modules"]:
|
||||||
shared["modules"]["imbusy"].replace_ess_commands()
|
shared["modules"]["imbusy"].replace_ess_commands()
|
||||||
|
if "serversigns" in shared["modules"]:
|
||||||
|
shared["modules"]["serversigns"].check_all_signs()
|
||||||
info("RedstonerUtils enabled!")
|
info("RedstonerUtils enabled!")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -266,8 +266,6 @@ def svs_command(sender, command, label, args):
|
|||||||
#-------------------------------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@hook.event("player.PlayerInteractEvent")
|
@hook.event("player.PlayerInteractEvent")
|
||||||
def on_click(event):
|
def on_click(event):
|
||||||
if str(event.getAction()) != "RIGHT_CLICK_BLOCK":
|
if str(event.getAction()) != "RIGHT_CLICK_BLOCK":
|
||||||
@@ -297,8 +295,6 @@ faces = {
|
|||||||
|
|
||||||
@hook.event("block.BlockBreakEvent", "monitor")
|
@hook.event("block.BlockBreakEvent", "monitor")
|
||||||
def on_break(event):
|
def on_break(event):
|
||||||
try:
|
|
||||||
global checking_block
|
|
||||||
if checking_block or event.isCancelled():
|
if checking_block or event.isCancelled():
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -314,22 +310,22 @@ def on_break(event):
|
|||||||
block3 = block.getRelative(BlockFace.UP)
|
block3 = block.getRelative(BlockFace.UP)
|
||||||
if block3.getType() == Material.SIGN_POST:
|
if block3.getType() == Material.SIGN_POST:
|
||||||
check_sign(event, block3)
|
check_sign(event, block3)
|
||||||
except:
|
|
||||||
error(trace())
|
|
||||||
|
|
||||||
|
|
||||||
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()))
|
loc = fromLoc(block.getLocation())
|
||||||
|
if block.getType() not in (Material.WALL_SIGN, Material.SIGN_POST) or getSign(loc) is None:
|
||||||
|
return
|
||||||
if not can_build2(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:
|
||||||
loc = fromLoc(block.getLocation())
|
|
||||||
del signs[loc]
|
del signs[loc]
|
||||||
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_build2(player, block):
|
def can_build2(player, block):
|
||||||
global checking_block
|
global checking_block
|
||||||
event = BlockBreakEvent(block, player)
|
event = BlockBreakEvent(block, player)
|
||||||
@@ -338,3 +334,8 @@ def can_build2(player, block):
|
|||||||
checking_block = False
|
checking_block = False
|
||||||
return not event.isCancelled()
|
return not event.isCancelled()
|
||||||
|
|
||||||
|
|
||||||
|
def check_all_signs():
|
||||||
|
for loc in signs:
|
||||||
|
if server.getWorld(loc[0]).getBlockAt(loc[1], loc[2], loc[3]).getType() not in (Material.WALL_SIGN, Material.SIGN_POST):
|
||||||
|
del signs[loc]
|
||||||
|
|||||||
Reference in New Issue
Block a user