Dev #29

Closed
Evanus wants to merge 13 commits from dev into dev
Showing only changes of commit ed4f60d5a3 - Show all commits

87
bpm.py
View File

@ -5,69 +5,50 @@ import org.bukkit.Material as Material
remake of dicodes blockplacemods remake of dicodes blockplacemods
""" """
blocks = {Material.DROPPER, Material.HOPPER, Material.FURNACE, Material.DISPENSER}
info = "please use: &9Slab&3, &9Inventory&3, &9Cauldron &3or &9Help&3."
togPerm = "utils.toggle" togPerm = "utils.toggle"
@hook.event("block.BlockPlaceEvent", "low") @hook.event("block.BlockPlaceEvent", "low")
def block_place(event): def block_place(event):
try: block = event.getBlockPlaced()
block = event.getBlockPlaced() material = block.getType()
material = block.getType() sender = event.getPlayer()
sender = event.getPlayer() py_player = get_py_player(sender)
py_player = get_py_player(sender) if (material in (Material.WOOD_STEP, Material.STEP)) and py_player.slab_toggle and block.getData() < 8:
if (material in (Material.WOOD_STEP, Material.STEP)) and py_player.slab_toggle and block.getData() < 8: block.setData(block.getData() + 8)
block.setData(block.getData() + 8) elif (material == Material.CAULDRON) and py_player.cauldron_toggle:
block.setData(block.getData() + 3)
elif (material == Material.CAULDRON) and py_player.cauldron_toggle:
block.setData(block.getData() + 3)
except:
print trace()
def help(sender): def help(sender):
try: msg(sender, "&a-=[&6BPM&a]=-")
msg(sender, "&a-=[&6BPM&a]=-") msg(sender, "&6Aliases for /toggle: \n &e/set, /setting and /config\n")
msg(sender, "&6Aliases for /toggle: \n &e/set, /setting and /config\n") msg(sender, "&6Available settings: \n &eSlab and Cauldron\n")
msg(sender, "&6Available settings: \n &eSlab and Cauldron\n") msg(sender, "&6Slab: \n&eThe slab setting flips slabs to the top half \nof the block on placing them.\n")
msg(sender, "&6Slab: \n&eThe slab setting flips slabs to the top half \nof the block on placing them.\n") msg(sender, "&6Cauldron: \n&eThe cauldron setting fills cauldrons on placing them.\n")
msg(sender, "&6Cauldron: \n&eThe cauldron setting fills cauldrons on placing them.\n")
except:
print trace()
@hook.command("toggle") @hook.command("toggle")
def toggle_command(sender, cmd, label, args): def toggle_command(sender, cmd, label, args):
py_player = get_py_player(sender) py_player = get_py_player(sender)
print py_player.player.getName() if sender.hasPermission(togPerm) and sender.getWorld().getName() == "creative":
try: if len(args) > 0:
if sender.hasPermission(togPerm) and sender.getWorld().getName() == "creative": if str(args[0]) == "slab":
if len(args) > 0: if py_player.slab_toggle == True:
if str(args[0]) == "slab": msg(sender, "&a Disabled automatically flipping slabs.")
if py_player.slab_toggle == True: py_player.slab_toggle = False
msg(sender, "&a Disabled automatically flipping slabs.")
py_player.slab_toggle = False
else:
msg(sender, "&a Enabled automatically flipping slabs.")
py_player.slab_toggle = True
elif str(args[0]) == "cauldron":
if py_player.cauldron_toggle == True:
msg(sender, "&a Disabled automatically filling cauldrons.")
py_player.cauldron_toggle = False
else:
msg(sender, "&a Enabled automatically filling cauldrons.")
py_player.cauldron_toggle = True
else: else:
help(sender) msg(sender, "&a Enabled automatically flipping slabs.")
py_player.slab_toggle = True
elif str(args[0]) == "cauldron":
if py_player.cauldron_toggle == True:
msg(sender, "&a Disabled automatically filling cauldrons.")
py_player.cauldron_toggle = False
else:
msg(sender, "&a Enabled automatically filling cauldrons.")
py_player.cauldron_toggle = True
else: else:
help(sender) help(sender)
elif sender.getWorld() != "creative":
msg(sender, "&aBPM doesn't work in this world.")
print sender.getWorld().getName()
else: else:
msg(sender, "&aNo permission.") help(sender)
except: elif sender.getWorld() != "creative":
print trace() msg(sender, "&aBPM doesn't work in this world.")
else:
msg(sender, "&aNo permission.")