Fixes, tweaks, changes
This commit is contained in:
@@ -16,7 +16,7 @@ settingInformation = {
|
|||||||
],
|
],
|
||||||
"furnace": [1,
|
"furnace": [1,
|
||||||
"automatically filling furnaces upon placement",
|
"automatically filling furnaces upon placement",
|
||||||
"Sets your preferred default furnace contents to your currently held itemstack. Use an empty hand to disable this feature."
|
"Sets your preferred default furnace contents to your currently held itemstack. Use an empty hand to disable this feature. The command is &o/toggle furnace"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ def saveSettings():
|
|||||||
@simplecommand("toggle",
|
@simplecommand("toggle",
|
||||||
aliases = ["set"],
|
aliases = ["set"],
|
||||||
usage = "<setting> [value|info]",
|
usage = "<setting> [value|info]",
|
||||||
description = "Toggles or sets your preferences for our redstone utilities.\nThe following settings are available:\n" + ", ".join([x for x in settingInformation]),
|
description = "Toggles or sets your preferences for our redstone \nutilities. The following settings are available:\n" + ", ".join([x for x in settingInformation]),
|
||||||
senderLimit = 0,
|
senderLimit = 0,
|
||||||
helpNoargs = True,
|
helpNoargs = True,
|
||||||
helpSubcmd = True,
|
helpSubcmd = True,
|
||||||
@@ -54,7 +54,7 @@ def toggle_command(sender, command, label, args):
|
|||||||
setting = args[0].lower()
|
setting = args[0].lower()
|
||||||
info = settingInformation.get(setting)
|
info = settingInformation.get(setting)
|
||||||
if info == None:
|
if info == None:
|
||||||
return "&cThat setting could not be found. For command help, use &o/toggle"
|
return " &cThat setting could not be found.\n For command help, use &o/toggle &cor &o/set"
|
||||||
|
|
||||||
values = get(setting)
|
values = get(setting)
|
||||||
player = server.getPlayer(sender.getName())
|
player = server.getPlayer(sender.getName())
|
||||||
@@ -77,28 +77,30 @@ def toggle_command(sender, command, label, args):
|
|||||||
elif arg2 in ("off", "disable"):
|
elif arg2 in ("off", "disable"):
|
||||||
new = False
|
new = False
|
||||||
else:
|
else:
|
||||||
return "&cArgument '%s' was not recognized. \nTry one of the following: &oon, off, toggle" % arg2
|
return " &cArgument '%s' was not recognized. \nTry one of the following: &oon, off, toggle" % arg2
|
||||||
if enabled == new:
|
if enabled == new:
|
||||||
return "&cAlready %s: &a%s" % ("enabled" if enabled else "disabled", info[1])
|
return " &cAlready %s: &a%s" % ("enabled" if enabled else "disabled", info[1])
|
||||||
if new:
|
if new:
|
||||||
values.remove(uuid)
|
values.remove(uuid)
|
||||||
else:
|
else:
|
||||||
values.append(uuid)
|
values.append(uuid)
|
||||||
saveSettings()
|
saveSettings()
|
||||||
return ("&aEnabled " if new else "&aDisabled ") + info[1]
|
return (" &aEnabled " if new else " &aDisabled ") + info[1]
|
||||||
|
|
||||||
elif info[0] == 1: # Save ItemStack in hand
|
elif info[0] == 1: # Save ItemStack in hand
|
||||||
if arglen == 1:
|
if arglen == 1:
|
||||||
item = fromStack(player.getItemInHand())
|
item = fromStack(player.getItemInHand())
|
||||||
if 0 in (item[0], item[1]):
|
if 0 in (item[0], item[1]):
|
||||||
del values[uuid]
|
if uuid in values:
|
||||||
return "&aDisabled " + info[1]
|
del values[uuid]
|
||||||
|
return " &aDisabled " + info[1]
|
||||||
values[uuid] = item
|
values[uuid] = item
|
||||||
saveSettings()
|
saveSettings()
|
||||||
return "&aEnabled %s, with currently held itemstack" % info[1]
|
return " &aEnabled %s, with currently held itemstack" % info[1]
|
||||||
if args[1].lower() == "info":
|
arg2 = args[1].lower()
|
||||||
return "&aSetting %s:\n&9%s" % (setting, info[2])
|
if arg2 == "info":
|
||||||
return "&cArgument '%s' was not recognized. \nUse /toggle %s info for more information." % setting
|
return " &aSetting %s:\n &9%s" % (setting, info[2])
|
||||||
|
return " &cArgument '%s' was not recognized. \nUse /toggle %s info for more information." % (arg2, setting)
|
||||||
|
|
||||||
return None #This shouldn't happen
|
return None #This shouldn't happen
|
||||||
|
|
||||||
@@ -115,46 +117,42 @@ def isEnabled(toggleSetting, uuid):
|
|||||||
|
|
||||||
@hook.event("block.BlockPlaceEvent", "monitor")
|
@hook.event("block.BlockPlaceEvent", "monitor")
|
||||||
def on_block_place(event):
|
def on_block_place(event):
|
||||||
try:
|
if event.isCancelled():
|
||||||
if event.isCancelled():
|
return
|
||||||
return
|
player = event.getPlayer()
|
||||||
player = event.getPlayer()
|
if not is_creative(player):
|
||||||
if not is_creative(player):
|
return
|
||||||
return
|
|
||||||
|
|
||||||
uuid = uid(player)
|
uuid = uid(player)
|
||||||
block = event.getBlockPlaced()
|
block = event.getBlockPlaced()
|
||||||
material = str(block.getType())
|
material = str(block.getType())
|
||||||
if isEnabled("slab", uuid) and material in ("WOOD_STEP", "STEP") and block.getData() < 8:
|
|
||||||
block.setData(block.getData() + 8) # Flip upside down
|
if isEnabled("slab", uuid) and material in ("WOOD_STEP", "STEP") and block.getData() < 8:
|
||||||
elif isEnabled("cauldron", uuid) and material == "CAULDRON":
|
block.setData(block.getData() + 8) # Flip upside down
|
||||||
block.setData(3) #3 layers of water, 3 signal strength
|
|
||||||
elif material == "FURNACE":
|
elif isEnabled("cauldron", uuid) and material == "CAULDRON":
|
||||||
stack = get("furnace").get(uuid)
|
block.setData(3) #3 layers of water, 3 signal strength
|
||||||
if stack == None:
|
|
||||||
return
|
elif material == "FURNACE":
|
||||||
state = block.getState()
|
stack = get("furnace").get(uuid)
|
||||||
state.getInventory().setSmelting(toStack(stack))
|
if stack == None:
|
||||||
state.update()
|
return
|
||||||
except:
|
state = block.getState()
|
||||||
error(trace())
|
state.getInventory().setSmelting(toStack(stack))
|
||||||
|
state.update()
|
||||||
|
|
||||||
|
|
||||||
@hook.event("player.PlayerInteractEvent", "monitor")
|
@hook.event("player.PlayerInteractEvent", "monitor")
|
||||||
def on_interact(event):
|
def on_interact(event):
|
||||||
try:
|
player = event.getPlayer()
|
||||||
player = event.getPlayer()
|
if (isEnabled("cauldron", uid(player))
|
||||||
if (isEnabled("cauldron", uid(player))
|
and is_creative(player)
|
||||||
and is_creative(player)
|
and str(event.getAction()) == "RIGHT_CLICK_BLOCK"
|
||||||
and str(event.getAction()) == "RIGHT_CLICK_BLOCK"
|
and (not event.hasItem() or str(event.getItem().getType()) == "REDSTONE")
|
||||||
and (not event.hasItem() or str(event.getItem().getType()) == "REDSTONE")
|
and str(event.getClickedBlock().getType()) == "CAULDRON"
|
||||||
and str(event.getClickedBlock().getType()) == "CAULDRON"
|
):
|
||||||
):
|
block = event.getClickedBlock()
|
||||||
block = event.getClickedBlock()
|
event2 = BlockBreakEvent(block, player)
|
||||||
event2 = BlockBreakEvent(block, player)
|
server.getPluginManager().callEvent(event2)
|
||||||
server.getPluginManager().callEvent(event2)
|
if not event2.isCancelled():
|
||||||
if not event2.isCancelled():
|
block.setData(block.getData() - 1 if block.getData() > 0 else 3)
|
||||||
block.setData(block.getData() - 1 if block.getData() > 0 else 3)
|
|
||||||
except:
|
|
||||||
error(trace())
|
|
||||||
|
|
||||||
|
|||||||
@@ -143,11 +143,9 @@ def on_interact(event):
|
|||||||
checktime = data["timeout_on"] if powered else data["timeout_off"]
|
checktime = data["timeout_on"] if powered else data["timeout_off"]
|
||||||
if checktime == -1:
|
if checktime == -1:
|
||||||
event.setCancelled(True)
|
event.setCancelled(True)
|
||||||
plugin_header(sender, "DamnSpam")
|
msg(sender, "&cThis %s is locked permanently by /damnspam." % (btype))
|
||||||
msg(sender, "&cThis %s is locked permanently." % (btype))
|
|
||||||
elif data["last_time"] + checktime > now():
|
elif data["last_time"] + checktime > now():
|
||||||
event.setCancelled(True)
|
event.setCancelled(True)
|
||||||
plugin_header(sender, "DamnSpam")
|
msg(sender, "&cThis %s has a damnspam timeout of %ss." % (btype, checktime))
|
||||||
msg(sender, "&cThis %s has a timeout of %ss." % (btype, checktime))
|
|
||||||
else:
|
else:
|
||||||
inputs[pos_str]["last_time"] = round(now(), 2)
|
inputs[pos_str]["last_time"] = round(now(), 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user