PowerTool

This project is abandoned.

Whether this project is out of date or its author marked it as abandoned, this project is no longer maintained.

If you wish to take this project over, please report it and state your intentions.

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. (Has powertool.use.* and powertool.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 both powertool.use.golden_apple and powertool.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.

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.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of ZerothAngel ZerothAngel Mar 23, 2012 at 00:12 UTC - 0 likes

    @lukecfairchild: Go

    Thanks for the suggestions!

    Here's the dev version for anyone who would like to preview it or test things out.

    Not sure when I'll cut an actual release, especially since MC 1.2.4 came out today, but probably in the next few days.

    BFAK:ZerothAngel,90566764,079d521650974a1ac3fb552228a2240d1310edef5ea774c56eecb3ea3ffeab59

  • Avatar of lukecfairchild lukecfairchild Mar 21, 2012 at 06:15 UTC - 0 likes

    Breaking backwards compatibility is always fine in the name of progress.

    And to be honest I might recommend change the main command from: /powertool to: /tool or: /ptool or something else. Reason being it gets glitchy if you have essentials installed.

    Here is how i would suggest things:

    Reload config: /tool reload

    Assign command to right mouse button: /tool r [command] or /tool right [command]

    Assign command to left mouse button: /tool l [command] or /tool left [command]

    Clear assigned command to current item: /tool clear

    Clear all assigned commands: /tool clearall

    List all powetool items and their commands: /tool list

  • Avatar of ZerothAngel ZerothAngel Mar 20, 2012 at 23:01 UTC - 0 likes

    @lukecfairchild: Go

    Thanks for the bug report, I'm fixing that up now.

    The saving thing is planned and the code is actually mostly there... it just hasn't been hooked up to any commands. My issue is that the "powertool" command is already so overloaded, it's gonna get confusing. (/powertool -r, /powertool -c, /powertool -R...)

    I guess I might have to break backwards compatibility at some point.

    If you or anyone else has any ideas on the command line interface moving forward, I'm open to suggestions...

  • Avatar of lukecfairchild lukecfairchild Mar 20, 2012 at 07:52 UTC - 0 likes

    Ok so your plugin is better than the essentials version in my opinion, OTHER than yours does not save them. If you make it so it saves them this will stay on my server.

    Also the server keeps getting this error in the console:

    03:49:50 [SEVERE] Could not pass event PlayerItemHeldEvent to PowerTool
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:303)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:441)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:825)
            at net.minecraft.server.Packet16BlockItemSwitch.handle(SourceFile:24)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:116)
            at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:7
    8)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    Caused by: java.lang.NullPointerException
            at org.tyrannyofheaven.bukkit.PowerTool.PowerToolPlayerListener.onItemHe
    ldChange(PowerToolPlayerListener.java:139)
            at sun.reflect.GeneratedMethodAccessor535.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:301)
            ... 10 more
    
    Last edited Mar 20, 2012 by lukecfairchild
  • Avatar of ZerothAngel ZerothAngel Feb 23, 2012 at 05:30 UTC - 0 likes

    BTW, I added coordinate substitution and released 0.9.4. But the BukkitDev team must be busy since it's been stuck in limbo for over 26 hours now.

  • Avatar of ZerothAngel ZerothAngel Feb 21, 2012 at 20:45 UTC - 0 likes

    @Yazzeh: Go

    Hey there. Well, I'm not too happy with the way PowerTool is configured right now, so I've been meaning to re-do that part of it. But I haven't had time to really think about it so I've been putting it off... and off... and off... :)

    The %loc thing should be pretty easy, but in order to be really general, it raises a few questions:

    • Use commas or spaces to separate coordinates? "X, Y, Z" vs. "X Y Z"? Of course, having an option would be best.
    • Maybe it would be better to just substitute %x, %y, and %z separately?
    • It would also be nice to have an option to instead use the coordinates of the air block above the block you targeted.

    I'll look into adding it soon.

  • Avatar of Yazzeh Yazzeh Feb 21, 2012 at 16:38 UTC - 0 likes

    Hey ZerothAngel, thanks for making this great, simple plugin! I was wondering when you'd have the block target feature put in? I want to be able to use items with the spawnmob command and #target so I can have a game where the players on my server have to fight off hordes of mobs that I can spawn randomly around them! Will your future %loc substitution allow this? Thanks again!

  • Avatar of InflamedSebi InflamedSebi Feb 02, 2012 at 10:12 UTC - 0 likes

    @ZerothAngel: Go

    Hay thx again for doing this and "Thisguy128512" meant, that u change the command syntax from: "/pt <command>" to "/pt </command>" so it can be used as macro for chatting or somethimg:

    "/pt Pease read the rules first!" will get done in the chat:"Pease read the rules first!"

    but this will allow the meber to spam a lot easier ... @Thisguy128512: Go

    if u want it for chattung just use the /say or /broadcast command, so it would have the same effect and its not possible to spam for Members ...

    BFAK:90588743,5db0382f1faee93879c0f471084dbb330b887d856578a65afbb9771de6f75097 Click to visit my BLOG!

  • Avatar of ZerothAngel ZerothAngel Oct 18, 2011 at 17:29 UTC - 0 likes

    @Thisguy128512: Go

    I'm not sure I understand, and I'm not familiar with Tiki Toolkit (though if I did know about it, I probably wouldn't have created this :P)

    When you select an equipped item that has commands bound to it, the plugin will let you know what those commands are.

    The only issue right now is that when you swap your current item with a power tool (bound item) from your inventory, nothing is displayed. This is something I'll be looking into in the future.

  • Avatar of Thisguy128512 Thisguy128512 Oct 18, 2011 at 13:30 UTC - 0 likes

    So maybe you could have it so it says what's programmed in, not add a slash to it, like Tiki Toolkit does. Then this would be perfect- bind macros as well as commands, plus it'd be easier to understand the binding for some people.

    Last edited Oct 18, 2011 by Thisguy128512

Facts

Date created
Oct 03, 2011
Category
Last update
May 05, 2013
Development stage
Abandoned
Language
  • enUS
License
Apache License version 2.0
Downloads
34,335
Recent files
  • B: 0.9.10 for CB 1.5.2-R0.1 May 05, 2013
  • B: 0.9.9 for 1.5.1 Mar 23, 2013
  • B: 0.9.8 for CB 1.4.7-R1.0 Feb 16, 2013
  • B: 0.9.7 for CB 1.3.2-R3.0 Jul 01, 2012
  • B: 0.9.6 for CB 1.2.5-R1.0 May 06, 2012

Authors