Item Renaming Plugin, Need help!

Discussion in 'Plugin Development' started by rotflking142, Jan 23, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    rotflking142

    Hello Bukkiters.
    This is a plugin I am trying to make and I do not know how,
    1.) I do not want you to make the plugin for me ;) I want to learn to code
    2.) If you want you can teach me what you know about coding.

    Anyways, continuing on,
    The plugin I am making is a item renaming plugin,
    At the moment the plugin gets the players inv, and item in hand after typing "rename"
    How do I create code so I could make it,
    '/rename [itemname] [itemcolour]'

    Also after the .getItemInHand(); What do I do next?

    Post below if you can help :/
     
  2. Offline

    BlackDereker

    itemcolour?
     
  3. Offline

    rotflking142

    So you can change the colour of the item
    Example: /rename Pickaxe Gold
     
  4. Offline

    BlackDereker

  5. Offline

    rotflking142

    Thats awesome, However.
    I want it to be variable, So I can have all of the colours as an option not just yellow :p
     
  6. Offline

    Konato_K

    @rotflking142 Normally most plugins use the "&" character for color stuff, so players can do something like

    /rename &6Pickaxe

    Then you can use ChatColor#translateAlternateColorCodes in that, however, this will also allow them to use any color or format code, so you may want to check that.

    Alternatively, read the second parameter and get the CharColor based on the name.
     
  7. Offline

    rotflking142

  8. Offline

    mythbusterma

    @rotflking142

    Well, it might have to with the fact that you assume the sender is a Player, and that the command has arguments when it very well may not.
     
Thread Status:
Not open for further replies.

Share This Page