Option to specify item warm-up / delay before an action functions unless interrupted.
mibby opened this issue ยท 6 comments
Would it be possible to add an option so you can define a warm-up time of an item? That way for example it could be possible to have a command wait 30 seconds before executing and using a limited item, unless the player is interrupted due to movement or damage?
So basically you are wanting a feature similar to how Essentials has their "warm up" before teleporting?
Such as Teleport will commence in 3... 2.... 1... player moves Teleport cancelled..
The difference being it is an item countdown before the command commences but the interruption is "specifiable" so you could say command-warmup-action: MOVEMENT, DAMAGE as two options for interrupting the warmup? My plans for this will be item specific so you can have other items if you wanted which do not have this.
Something like that, yes, but being able to bind it to any command. A warm-up before the item is consumed and the command is used. In my specific case, to prevent people from teleporting if they are unsafe (moving / taking damage) with a limited consumable.
So is this specific to the (Exact Command) or can this be specific to the commands listed under the item.
So say you have an item that executes two commands, both of those would be on a warm-up which would execute normally after the warm-up.
Or are you wanting each individual command to have a warm-up so they execute say 30 seconds apart?
Also, you said limited consumable--you want this item to be consumed after the warmup when the command is succesfully executed correct? and if it is interrupted the command cancels but they keep the item?
For my case, I'd say the former -- with the item and commands not being used / processed until the warm-up has completed successfully (no interrupts).
Separating the commands could simply just be done with a delay.
you want this item to be consumed after the warmup when the command is succesfully executed correct? and if it is interrupted the command cancels but they keep the item?
That is correct. The idea is to have a craftable consumable which allows players to warp safely out of a PVP / Mob world. The intended way to leave the world would be through safe zones but they could use an item to warp out if they are not in any combat (DAMAGE) and/or movement (MOVEMENT) -- with an option to define either as interrupts or neither and just have a warm-up before use.
Edit: Likewise, is it possible at all to latch onto a custom item of another plugin in ItemJoin to force that item to use a warm-up / parse commands / consume it when used?
This has been added as of the latest snapshot; http://ci.craftationgaming.com/job/ItemJoin/238/
Specifying the warmup delay is as simple as adding commands-warmup: 5
to the individual item. Setting this to zero or undefined will bypass any item warmup.
What Cancels the warmup: Player moving one block in any direction (player movement) will cancel the warmup. Which includes damage, you will have to let me know if this is functioning how you would intend.
I have added changes to the lang.yml which include the warmup messages so you might have to reload your lang file or view the changes and add the missing lang messages found in the devlog; https://www.spigotmc.org/wiki/devlog/
Thanks! I no longer actually have a warm-up use at this time but it seems to work wonderfully from my quick testing. I'll definitely have to revisit this feature when I can think of a use for it. :)
Cancelling warmup logic seems fine to me but you may want to add an option for people that don't want it to cancel and just have it spin up the command actions after a wait time until it's executed.