[INACTIVE][MISC] ItemCommand 1.2 - Execute commands with a right click of a tool [860]

Discussion in 'Inactive/Unsupported Plugins' started by IC3D, Jun 13, 2011.

  1. Offline

    IC3D

    ItemCommands: Execute commands with tool right clicks
    Version: 1.2
    Pretty simple :/ Just put an item name, command, and node in the config. When you right click air with that item in your hand, you will perform the command. IMPORTANT: The node you specify is NOT to execute the command, but for the ability to execute the command with the given tool. If you make the node itemcmd.stick, and the stick performs the command list, if they player that uses the stick cannot use list, nothing will happen.

    Features:
    • Perform commands easily
    • Add item command mappings in game
    • Ability to execute commands onEntityDamage
    • ^ That lets you do stuff like a banhammer, or a kickhammer, etc..
    Configuration:
    config.yml (open)

    The file config.yml will be created at /plugins/ItemCommand. It will look like this:
    Code:
    stick:
        Command: list
        Node: itemcmd.stick
    You can add as many items, commands, and nodes as you want, using that format. Make sure that the item name is LOWER CASE! That is important. For a command with more than one argument/word, be sure to add '', like this:
    Code:
    stick:
        Command: 'kill captainawesome7'
        Node: itemcmd.stick
    For a command that you want to use onEntityDamageByEntity (when you punch somebody or hit them with something), do it like this:
    Code:
    stone_sword:
        Command: kick %name Testing
        Node: itemcmd.kick
    That will kick the player with the reason Testing (if you have SimpleAdmin). If the Command is InstaKill, the entity/player is killed in one hit.

    Commands:
    There is only one command, /ic. /ic lets you add item command mappings in game, instead of in the config (they are added to the config through the commands though). The permissions node for /ic is itemcommand.edit. Follow these simple steps to create an in game item command:
    1. Type /ic add
    2. Type /ic id <name> - Replace <name> with an item name, such as grass
    3. Type /ic cmd <cmd> - Replace <cmd> with a command, it can be more than one word long
    4. Type /ic node <node> - Replace <node> with a permissions node, such as itemcmd.derpison
    5. Thats it! All of the values above are one value each, so if you type /ic id grasss instead of /ic id grass its fine, just type it again and fix your errors.
    Downloads
    The source code is included in the .jar

    Planned Changes:
    None
    Changelog:
    Version 1.2
    • Added in-game commands to add item to command mappings
    Version 1.1
    • Added onEntityDamageByEntity commands
    Version 1.0
    • Official Release
    Credits:
     
    DeanDip likes this.
  2. Offline

    DreadKyller

    really nice, I think I'll get it.

    EDIT : LOL, this is funny, I have a plugin with a command for suicide, now I can make it so is someone places a specific block they die.
     
  3. Offline

    Baummann

    Essentials' /powertool can do that.
     
  4. Offline

    captainawesome7

    So I've heard
     
  5. Offline

    terrab

    But then you have to use an entire suite of plugins for a single feature. I'm excited for this plugin as I've yet to replace the /powertool command since migrating away from Essentials. Please add the ability to bind commands in game. Thanks.
     
  6. Offline

    captainawesome7

    d
    done, let me edit the op
     
  7. Offline

    IC3D

    Added in-game commands!
     
  8. Offline

    DreadKyller

    awesome, so not you just go:

    /ic id 3
    /ic cmd some command
    /ic node icmd.dirt
    /ic add

    and that will add a new item to the config file with the value of dirt, which will activate whatever command you typed as long as you have the permission node specified?
     
  9. Offline

    Snaipe

    Whoa, that's awesome !

    I have two ideas though :

    1 - Could you add in the configuration the possibility to launch a command if the item is right-clicked on a specific bloc ?

    like, if i click with a stick on dirt it would launch /list but if click with the same stick on stone that time, it would execute /ping ( don't know if i'm clear... )

    2 - It would be really powerful to attach more than one command on an object :)
     
  10. Offline

    captainawesome7

    That could definitely be done. The specific blocks would override the standard right click.
     
  11. Offline

    DreadKyller

    it would probably be in a format like this then?

    Code:
    material:
        Command: /some command
        Node: itemcmd.material
        Special:
          - "somematerialname"
          - "someothermaterialname"
    and "~" or "*" could be all blocks
     
  12. Offline

    captainawesome7

    No, as it is now, ItemCommand only registers the right click if it is in air, so it wouldn't really be overriding anything. Just making a new command for a specific block.
     
  13. Offline

    DreadKyller

    you're making no sense... snaipe wants to have it possible to make some commands only happen when clicking on a specific block, and you said it's possible, so I'm just asking how the setup in the ymal file would look if the person decided to have specific blocks clicked, I'm just saying that adding a config item like a string list that holds a bunch or material names, if someone wants the command to only activate (example set the time to midday only if clicking with watch towards a diamond block) they could ad the materials, or just like ~ or * for all blocks. You don't have to chest for a right click block, but just check the:

    player.getTargetBlock()
     
  14. Offline

    funstein

    I'm getting a shitload of errors with this. I think it does not support build 1000. I'm posting the server.log :

    Code:
    2011-08-05 23:19:07 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'ic' in plugin ItemCommand v1.2
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:129)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:320)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:713)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:677)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:670)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:85)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NullPointerException
        at me.ic3d.ic.IC.onCommand(IC.java:101)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
        ... 12 more
    
    
    
    2011-08-05 23:19:35 [WARNING] Unexpected exception while parsing console command
    org.bukkit.command.CommandException: Unhandled exception executing command 'ic' in plugin ItemCommand v1.2
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:129)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:312)
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:480)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:465)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.command.ColouredConsoleSender cannot be cast to org.bukkit.entity.Player
        at me.ic3d.ic.IC.onCommand(IC.java:71)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
        ... 6 more
    And when I set things up from config file and boot up the server, now it wont do anything, not even give errors. I really need this plugin, so I'd appreciate if you could fix this.

    @captainawesome7 can you take a look?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  15. Offline

    Neclipse

    How do you set up the entity damage thing

    Also, you can't get rid of the stick command, which is annoying as I use it for a wand with defaultcommands...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  16. Offline

    Flyro

    Hey Could somone edit the mod for me ?
    I need it to support item damage values (map:1 map:2...etc...)
    I also need the command to be executed with "op permissions" even if the player is defaulted
    Important! i don't want to use any extra permissions plugin
     
  17. Offline

    captainawesome7

    Or, you know, you could do it yourself.
     
  18. Offline

    Flyro

    I want to, But i don't know how to open and edit the Source. :(
    iv'e downloaded and installed eclipse.
    Could you tell me how to open the source?
    I'm not good at writing my own scripts.
    But I'M PRO at cut/copy/editing.
    That't y i need to edit the source and cant write my own thingy :p
    (Hopefully bout 50% of what i just said made sense)
    // fly
     
  19. Offline

    captainawesome7

    Decompile with JD-GUI and copy/paste the code into eclipse.

    Edit: Some syntax may give errors, JD-GUI is known to not figure out list types correctly, and I'm fairly sure they are used in this plugin (I don't remember).
     

Share This Page