PowerTool
PowerTool — Bind commands to items
Originally requested by InflamedSebi in this thread.
PowerTool allows you to bind commands to your in-hand items. Any item may be assigned commands for both left-click and right-click. Bound commands remain until you manually clear the binding.
Please post bugs and/or feature requests as dev.bukkit.org tickets.
Features
- Bound commands may include special tokens which are appropriately substituted when the item is used. Currently, these are:
Token | Description |
---|---|
%p | The name of the player you left-clicked or right-clicked. |
%x | X-coordinate of the block targeted by your crosshairs |
%y | Y-coordinate of the block targeted by your crosshairs |
%z | Z-coordinate of the block targeted by your crosshairs |
%Y | Y-coordinate of the nearest air block above the block targeted by your crosshairs |
All of these tokens are configurable.
-
Works in creative mode. Right-clicking and left-clicking players in creative mode will generally work, even when far away (up to 100 blocks).
-
Ability to define global power tools. These are administrator-defined binds that can be made available to whoever you want (based on permissions).
-
Fine-grained control over the use of power tools via permissions.
-
Global power tools may grant temporary permissions or even be run as the console. Needless to say, these features should be used with care.
-
The number of player-created binds may be limited based on group/permission.
-
Items may be further differentiated by custom display name (e.g. when given one via Anvils). Note this option is off by default, enable it in the configuration file.
Commands
There's only one command, /powertool
which may also be abbreviated /pt
or /ptool
:
/powertool left <the-command-to-bind>
— Binds the command (and its arguments) to the left-click action of the current item. The command must not include the first slash. This may also be abbreviated as/powertool l
./powertool right <the-command-to-bind>
— Binds the command (and its arguments) to the right-click action of the current item. This may also be abbreviated as/powertool r
./powertool left
— With no command to bind, the currently-bound left-click command is cleared from the current item. Use/powertool right
to clear the right-click command./powertool list
— Displays all player-defined power tools for the current player./powertool clear
— Clears all bound commands from the current item./powertool clear <item-id-or-name>
— Clears all bound commands from the specified item./powertool clear -a
— Clears all bound commands from all items./powertool on
— Enable power tools for this session (default is on)./powertool off
— Disable power tools for this session./powertool toggle
— Toggle power tools availability. Can also be abbreviated as/powertool t
./powertool reload
— Re-reads config.yml.
Permissions
PowerTool only supports Bukkit permissions (aka Superperms). By default, ops have all permissions.
powertool.use
— Allows the use and creation of power tools. (Haspowertool.use.*
andpowertool.create
as child permissions.)powertool.use.*
— Allows the use of all power tools.powertool.use.<item-id>
— Allows the use of a specific power tool identified by item-id. item-id may be numeric (e.g. 322 for golden apple), or the Bukkit Material name with or without underscores (e.g. GOLDEN_APPLE or GOLDENAPPLE). Note that Bukkit permissions are not case-sensitive, so bothpowertool.use.golden_apple
andpowertool.use.GOLDEN_APPLE
work fine.powertool.create
— Allows the creation of personal power tools. A player must be given this permission in order to use the left/right/list/clear subcommands.powertool.reload
— Allows use of/powertool reload
Additionally, per-group power tool limits may be defined using permissions. See the options
section in config.yml for details.
Global, Administrator-defined Binds
By editing config.yml, the server administrator can define binds for use by anyone with the powertool.use
permission.
For example:
powertools:
string:
left-click: plugins
right-click: version
The item ID ("string" in the above example) may be an integer item ID or a name. If using an integer item ID, you must quote it as a string, e.g. '287'
for "string." If using a name, you must use a standard Bukkit material name (found here). For example, for golden apples, you may use one of:
GOLDEN_APPLE
'golden apple'
(since it has a space, it must be quoted)goldenapple
Examples
-
Promote and demote users using the left-click and right-click actions of the current item:
/powertool l promote %p
/powertool r demote %p
-
Bind WorldEdit's copy & paste commands. Remember that many WorldEdit commands normally start with two slashes, but you must always omit the first slash.
/powertool left /copy
/powertool right /paste
License & Source
PowerTool is released under the Apache License, Version 2.0.
Sources may be found on GitHub:
Development builds of this project can be acquired at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk.
- PowerTool (Requires ToHPluginUtils.jar)
- PowerTool-standalone (includes ToHPluginUtils, like the version distributed on dev.bukkit.org)
To Do
- Allow setting/clearing global power tools from the command line (for those with the proper permission, of course).
- Allow player-specific power tools to override global ones.
- Allow global power tool flags (e.g. run-as-console) to be assigned to each individual action.
@Kitten_Tails
After some quick research, I don't think something like your Nether Star example is possible. There's nothing (available via the Bukkit API) that uniquely identifies one stack of items from another... other than inventory slot #. And that seems pretty awkward. Nether Star in quick slot #1 does this, Nether Star in quick slot #2 does that...?
Differentiating by name does seem possible and I'll go ahead and create a ticket for it. But like the change to add support for different item data types, it will be pretty significant and invasive. So I'm not sure when I can get to it. But it's definitely a cool idea.
Thanks for the suggestions!
Is there a possible way to bind a command to only one of an item?
Example: Right click with Nether Star [/ban] Right click with another Nether Star [/kick]
Also would this work if an item had a specific name?
Example: Gold Nugget renamed to "Money" [/stop] Gold Nugget renamed to "Stuff" [/deop]
@SanguineScythe
@CaptainBullDog
Dev build #239 and up should have the permission changes I described.
It's pretty much the only significant change since the last release, so I'm not sure when I'll be submitting it to Bukkit for review.
@SanguineScythe
That's a great idea. Here are my thoughts about implementation:
I'll convert
powertool.use
so it is a permission with two child permissions:powertool.use.*
andpowertool.create
. (So settingpowertool.use
to true sets both of those to true, and setting false sets both to false... For backwards compatibility.)powertool.create
behaves as you'd expect.powertool.use.*
allows the use of any power tool. And something likepowertool.use.GOLDEN_APPLE
allows you to grant usage only on specific items.Would this work?
@SanguineScythe
Good idea :D
+1 !
Is there any way to allow a user to use global items and their commands but not allow a user to set commands? If not could you implement this feature?
For example: I want users to be able to use an item to set their home with left-click and teleport to their set home with right-click. I do not want users to be able to set up their own power tools. It would be great if the permissions had both a 'powertool.use' and a 'powertool.create'.
This was actually available on the age-old ItemCommands plugin. I have not been able to find any substitutions to it until I found your plugin. It is a great plugin either way. Thanks for making it and for your time.
Will a command bind to a specific written item?
@slugsshell
I would really like that too! We need a developer here! Also it would be awesome with a cooldown between clicking, and I wonder, can you set up permissions for global(ONLY that one item not same id just that) to use?
@PapiDimmi
Yes, it's currently an option (so it affects everyone). Look for the "verbose" option in config.yml.
Oh I got it but thanks for the concern.
@ZerothAngel
That is my problem do you know any that would provide it?
@robster2999
Looks right. Which plugin is providing the /lightning command?
OK, every time i tried to bind lightning onto an object it would say "Unknown command". Am I doing this right? (/powertool right lightning)
Idiots does this work or not on 1.4.7
Is this compatible with 1.4.7?
What are some commands I can do? I have:
/powertool right [command]
but I don't know any commands...
update: just saw that there is already this option in combination with ToHPluginUtils but still it would be nice if you could simplify this for us :)
Also if i define this for command book nothing happens :( "warp -s world %p warppoint"
Question, is it possible to bind more then one command to a click, lets say something like this
Maybe even with a count-down something like this
somecommand1 &timeX somecommand2
This feature would be really great!
Thanks,
slugsshell
888888888888
Sixth
@Thrystor
You mean 1.4.5? I haven't been able to test it out lately, but the last few breaking Bukkit API changes did not affect PowerTool.
The latest and greatest can be found here.
Didn't see any problems in my quick testing of PowerTool 0.9.7 and CraftBukkit 1.4.5-R0.2.