Code: Select all
#Kill Build script by Kuma
#Version 2.0
from commands import alias, add, admin
ENABLE = False
BLOCKS_PLACED = 0
TOTAL_BLOCKS = 10
#@admin
@alias('kb')
def killbuild(connection):
global ENABLE
protocol = connection.protocol
ENABLE = not ENABLE
if ENABLE:
protocol.send_chat("Kill build has been activated!")
else:
protocol.send_chat("Kill build has been deactivated")
add(killbuild)
def no_building(self):
no_build = ["NO BUILDING","NIE STROIT", "BAUE NICHT"]
for n in xrange(len(no_build)):
self.send_chat(" {0} {1} ".format(n+1, no_build[n]))
self.kill()
def blocks(self):
global BLOCKS_PLACED, TOTAL_BLOCKS
if BLOCKS_PLACED != TOTAL_BLOCKS-1:
BLOCKS_PLACED = BLOCKS_PLACED + 1
self.send_chat("Don't Build, You will die. Blocks left: {}".format(TOTAL_BLOCKS - BLOCKS_PLACED))
return False
elif BLOCKS_PLACED == TOTAL_BLOCKS-1:
no_building(self)
BLOCKS_PLACED = 0
return False
def apply_script(protocol, connection, config):
class buildConnection(connection):
def on_block_build_attempt(self, x, y, z):
global ENABLE
if ENABLE:
blocks(self)
else:
return connection.on_block_build_attempt(self, x, y, z)
def on_line_build_attempt(self, points):
global ENABLE
if ENABLE:
blocks(self)
else:
return connection.on_block_build_attempt(self, x, y, z)