Fixes, tweaks, changes

This commit is contained in:
Dico200
2015-05-14 02:46:54 +02:00
parent 83eb3a8885
commit 6fc168eb63
2 changed files with 50 additions and 54 deletions

View File

@@ -16,7 +16,7 @@ settingInformation = {
],
"furnace": [1,
"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",
aliases = ["set"],
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,
helpNoargs = True,
helpSubcmd = True,
@@ -54,7 +54,7 @@ def toggle_command(sender, command, label, args):
setting = args[0].lower()
info = settingInformation.get(setting)
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)
player = server.getPlayer(sender.getName())
@@ -91,14 +91,16 @@ def toggle_command(sender, command, label, args):
if arglen == 1:
item = fromStack(player.getItemInHand())
if 0 in (item[0], item[1]):
if uuid in values:
del values[uuid]
return " &aDisabled " + info[1]
values[uuid] = item
saveSettings()
return " &aEnabled %s, with currently held itemstack" % info[1]
if args[1].lower() == "info":
arg2 = args[1].lower()
if arg2 == "info":
return " &aSetting %s:\n &9%s" % (setting, info[2])
return "&cArgument '%s' was not recognized. \nUse /toggle %s info for more information." % setting
return " &cArgument '%s' was not recognized. \nUse /toggle %s info for more information." % (arg2, setting)
return None #This shouldn't happen
@@ -115,7 +117,6 @@ def isEnabled(toggleSetting, uuid):
@hook.event("block.BlockPlaceEvent", "monitor")
def on_block_place(event):
try:
if event.isCancelled():
return
player = event.getPlayer()
@@ -125,10 +126,13 @@ def on_block_place(event):
uuid = uid(player)
block = event.getBlockPlaced()
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
elif isEnabled("cauldron", uuid) and material == "CAULDRON":
block.setData(3) #3 layers of water, 3 signal strength
elif material == "FURNACE":
stack = get("furnace").get(uuid)
if stack == None:
@@ -136,13 +140,10 @@ def on_block_place(event):
state = block.getState()
state.getInventory().setSmelting(toStack(stack))
state.update()
except:
error(trace())
@hook.event("player.PlayerInteractEvent", "monitor")
def on_interact(event):
try:
player = event.getPlayer()
if (isEnabled("cauldron", uid(player))
and is_creative(player)
@@ -155,6 +156,3 @@ def on_interact(event):
server.getPluginManager().callEvent(event2)
if not event2.isCancelled():
block.setData(block.getData() - 1 if block.getData() > 0 else 3)
except:
error(trace())

View File

@@ -143,11 +143,9 @@ def on_interact(event):
checktime = data["timeout_on"] if powered else data["timeout_off"]
if checktime == -1:
event.setCancelled(True)
plugin_header(sender, "DamnSpam")
msg(sender, "&cThis %s is locked permanently." % (btype))
msg(sender, "&cThis %s is locked permanently by /damnspam." % (btype))
elif data["last_time"] + checktime > now():
event.setCancelled(True)
plugin_header(sender, "DamnSpam")
msg(sender, "&cThis %s has a timeout of %ss." % (btype, checktime))
msg(sender, "&cThis %s has a damnspam timeout of %ss." % (btype, checktime))
else:
inputs[pos_str]["last_time"] = round(now(), 2)