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.
@coolo1
It executes bound commands as the player using the tool.
So if I gave someone a powertool that they had the permission to use the command bound to it, the could use it? If so then I will get this plugin. If not, I will stick with the essentials version.
@ZerothAngel
Thanks for being a awesome dev man!
@lukecfairchild
Should be fixed now in dev build #26. Thanks once again!
I noticed something else. Whenever I reload our server all the powertool binds are lost even /powertool reload doesnt bring them back
Yeah I noticed that too, but I can live with that. The damage can be a problem. Especially since i am going to be using most my powertools to spy on possible griefers.
@lukecfairchild
Thanks. Looks like I broke that in 0.9.5. :P
Anyway, I fixed it (dev build).
I also discovered that targeting creative players up close (3 blocks or less away) is pretty flaky. I don't think there's anything I can do about it since I don't see any events (no arm swings, no interaction, no damage).
Only thing that works is to back away or hit them on the head (which seems to work most of the time).
I have a request. Make it so when you have a powertool it doesnt hurt people when you swing.
<3 <3 <3 <3 <3 <3
@lukecfairchild
Try this instead: /powertool left runalias /store %p
It looks like CommandHelper doesn't actually create a Bukkit "command" for each alias, so when PowerTool asks Bukkit to execute the command alias, nothing is found. CommandHelper provides the "runalias" command to get around that problem.
ok ZerothAngel, so I made a commandhelper to go along with powertools, but whenever i try to use powertools to fire the command that commandhelper made. It just says the unknown command.
This is what i am entering for powertools: /powertool left store %p
This is what i am entering for commandhelper: /store $value = store_value(concat('target.',player()),$value)
so what happens when i type /store test is it actually stores the value. If i use the powertool to fire the command or even replace %p with test it gives me that error. Any ideas why?
ZerothAngel Im happy with how your plugin is.
Not sure I follow the discussion. I only suggested CommandHelper because it allows you to create aliases (a single command that will execute many). Well, it does this and a whole lot more - it's basically a scripting language.
I thought multiple-commands-per-click was where lukecfairchild's request was leading to.
And @imilkywayz, I can't tell if you're for or against the multiple binds idea...
i personally havent done more than 2 bindings to one command. But some might do more.
@lukecfairchild
Not really, i would rather have 1 plugin that does it all, instead of that one plugin and another that slightly extends only part of the one that does it all. Multiple bindings? Seems pretty stupid how many commands you need to repeat so much that you ran out of items for individual bindings...?
wow the commandhelper plus this=awesome!
@lukecfairchild
Looks like Essentials sets up other aliases that you can use: /epowertool and /ept
As for multiple bindings, would they be executed sequentially? I'll have to think about that feature...
But anyway, using CommandHelper + PowerTool would probably be a friendlier alternative. In fact, I should probably test that combo...
One more thing and then your plugin makes the essentials 100% obsolete. Adding support for multiple bindings to one item.
You might format the command like this: /powertool left:# [command]
O also could you please please please change the format from /powertool to something else like /ptool or atleast make a way of getting to the essentials powertool. Because there is no way to just turn off the essentials powertool that i know of, so some need to still turn off its bindings. Its really annoying.
If you know how to turn off the essentials one please let me know!!
@lukecfairchild
Nice catch, I forgot about that case.
New build should be up. (Same link). #21 or higher.
Thanks for all your input, solving the creative targeting problem was really interesting. :P
Ok i have tested it and LOVE IT!!!!!! Only thing i suggest is. If a powertool has the %p but no player is detected revert any blocks destroyed just like with any other powertool.
same link?!??!?!?? < VERY EXCITED!!! YOU HAVE NO IDEA!!!!