Dev #29
83
bpm.py
83
bpm.py
@ -1,84 +1,67 @@
|
|||||||
from helpers import *
|
from helpers import *
|
||||||
import org.bukkit.block.BlockFace as BlockSide
|
|
||||||
import org.bukkit.Material as Material
|
import org.bukkit.Material as Material
|
||||||
|
|
||||||
"""
|
"""
|
||||||
remake of dicodes blockplacemods
|
remake of dicodes blockplacemods
|
||||||
"""
|
"""
|
||||||
|
|
||||||
slabToggle = []
|
|
||||||
cauldronToggle = []
|
|
||||||
inventoryToggle = []
|
|
||||||
|
|
||||||
blocks = {Material.DROPPER, Material.HOPPER, Material.FURNACE, Material.DISPENSER}
|
blocks = {Material.DROPPER, Material.HOPPER, Material.FURNACE, Material.DISPENSER}
|
||||||
info = "please use: &9Slab&3, &9Inventory&3, &9Cauldron &3or &9Help&3."
|
info = "please use: &9Slab&3, &9Inventory&3, &9Cauldron &3or &9Help&3."
|
||||||
|
|
||||||
togPerm = "utils.toggle"
|
togPerm = "utils.toggle"
|
||||||
|
|
||||||
@hook.event("block.BlockPlaceEvent", "monitor")
|
@hook.event("block.BlockPlaceEvent", "low")
|
||||||
def blockPlace(event):
|
def block_place(event):
|
||||||
block = event.getBlockPlaced()
|
try:
|
||||||
material = block.getType()
|
block = event.getBlockPlaced()
|
||||||
n = event.getPlayer().getName()
|
material = block.getType()
|
||||||
|
sender = event.getPlayer()
|
||||||
|
py_player = get_py_player(sender)
|
||||||
|
if (material in (Material.WOOD_STEP, Material.STEP)) and py_player.slab_toggle and block.getData() < 8:
|
||||||
|
block.setData(block.getData() + 8)
|
||||||
|
|
||||||
if (material in (Material.WOOD_STEP, Material.STEP)) and n in slabToggle:
|
elif (material == Material.CAULDRON) and py_player.cauldron_toggle:
|
||||||
block.setData(block.getData() + 8)
|
block.setData(block.getData() + 3)
|
||||||
|
except:
|
||||||
|
print trace()
|
||||||
|
|
||||||
elif (material == Material.CAULDRON) and n in cauldronToggle:
|
def help(sender):
|
||||||
block.setData(block.getData() + 3)
|
try:
|
||||||
|
msg(sender, "&a-=[&6BPM&a]=-")
|
||||||
|
msg(sender, "&6Aliases for /toggle: \n &e/set, /setting and /config\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, "&6Cauldron: \n&eThe cauldron setting fills cauldrons on placing them.\n")
|
||||||
|
except:
|
||||||
|
print trace()
|
||||||
|
|
||||||
elif (material in blocks) and n in inventoryToggle:
|
|
||||||
inv = user.getInventory().getItemInHand()
|
|
||||||
state = block.getState()
|
|
||||||
blockInv = state.getInventory()
|
|
||||||
blockInv.setItem(int(slot), toStack(inv))
|
|
||||||
def help():
|
|
||||||
msg(sender, "&a-=[&6BPM&a]=-")
|
|
||||||
msg(sender, "&6Aliases for /toggle: \n &e/set, /setting and /config\n")
|
|
||||||
msg(sender, "&6Available settings: \n &eSlab, Cauldron and Inventory\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, "&6Inventory: \n&eThe inventory setting puts a block in an item with an inventory.\n")
|
|
||||||
@hook.command("toggle")
|
@hook.command("toggle")
|
||||||
def toggleCommand(sender, cmd, label, args):
|
def toggle_command(sender, cmd, label, args):
|
||||||
name = sender.getName()
|
py_player = get_py_player(sender)
|
||||||
|
print py_player.player.getName()
|
||||||
try:
|
try:
|
||||||
if sender.hasPermission(togPerm) and sender.getWorld().getName() == "creative":
|
if sender.hasPermission(togPerm) and sender.getWorld().getName() == "creative":
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
if str(args[0]) == "slab":
|
if str(args[0]) == "slab":
|
||||||
if name in slabToggle:
|
if py_player.slab_toggle == True:
|
||||||
msg(sender, "&a Disabled automatically flipping slabs.")
|
msg(sender, "&a Disabled automatically flipping slabs.")
|
||||||
slabToggle.remove(name)
|
py_player.slab_toggle = False
|
||||||
else:
|
else:
|
||||||
msg(sender, "&a Enabled automatically flipping slabs.")
|
msg(sender, "&a Enabled automatically flipping slabs.")
|
||||||
slabToggle.append(name)
|
py_player.slab_toggle = True
|
||||||
|
|
||||||
elif str(args[0]) == "cauldron":
|
elif str(args[0]) == "cauldron":
|
||||||
if name in cauldronToggle:
|
if py_player.cauldron_toggle == True:
|
||||||
msg(sender, "&a Disabled automatically filling cauldrons.")
|
msg(sender, "&a Disabled automatically filling cauldrons.")
|
||||||
cauldronToggle.remove(name)
|
py_player.cauldron_toggle = False
|
||||||
else:
|
else:
|
||||||
msg(sender, "&a Enabled automatically filling cauldrons.")
|
msg(sender, "&a Enabled automatically filling cauldrons.")
|
||||||
cauldronToggle.append(name)
|
py_player.cauldron_toggle = True
|
||||||
|
|
||||||
elif str(args[0]) == "inv" or "inventory":
|
|
||||||
if name in cauldronToggle:
|
|
||||||
msg(sender, "&a Disabled automatically putting items in inventories.")
|
|
||||||
cauldronToggle.remove(name)
|
|
||||||
else:
|
|
||||||
msg(sender, "&a Enabled automatically putting items in inventories.")
|
|
||||||
cauldronToggle.append(name)
|
|
||||||
|
|
||||||
elif str(args[0]) == "help" or "?" or "wut":
|
|
||||||
help()
|
|
||||||
|
|
||||||
elif len(args) > 1:
|
|
||||||
msg(sender,"&aToo many arguments, \n&3&s") % info
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
msg(sender, "&9Unknown argument \n &3%s") % info
|
help(sender)
|
||||||
else:
|
else:
|
||||||
help()
|
help(sender)
|
||||||
|
|
||||||
|
|
||||||
elif sender.getWorld() != "creative":
|
elif sender.getWorld() != "creative":
|
||||||
|
Reference in New Issue
Block a user