Just something very simple...

Discussion in 'Archived: Plugin Requests' started by Masterflapdrol, Dec 30, 2012.

  1. Offline

    Masterflapdrol

    Hey everyone this is just a very small plugin request.. just something very simple...
    I was going to make a server using this: http://dev.bukkit.org/server-mods/itemrenamer/
    And this: http://dev.bukkit.org/server-mods/epicboss/files/33-epic-boss-2-3-9/
    is there a way i could have players craft items.. but with custom item names so for example craft a diamond block with 5 dirt. But then get a blue dirt rock item. And not diamond. I don't mind if you could for example craft the blue rock back in to 9 diamonds. What i'm going for here is that players can craft custom named items. and use it to execute a command. In this case: a boss.
    is it possible to do it? Does it already exist? I couldn't find it tough...
     
  2. Offline

    ImDeJay

    cant create new items with bukkit.

    this would have to be a client side mod. not server side
     
  3. Offline

    Masterflapdrol

    Its not custom items... its renamed items. You can do that on any vanilla server with an object called anvil.
     
  4. Offline

    andrewpo

    Last edited by a moderator: May 30, 2016
  5. Offline

    Masterflapdrol

    I even linked it in the post. maybe i'm not clear enough.. :( i want players on my server to craft custom named items. for example the blue rock, diamond block. use it (right or left click) to execute a command. it only works with that item. so you can't execute it with a normal diamond block. thats all :)

    Edit: i don't know anything about coding. The idea seemed simple to me. maybe its bedrock hard to code.. :/ i don't know. i've had soo many more requests and people ditnt make it not because it wasn't possible. but because it was really big and tuff to make :p
     
  6. Offline

    andrewpo

    Well you'd need to set up a listener for CraftItemEvent
    Code:java
    1.  
    2. @EventHandler(priority = EventPriority.NORMAL)
    3. public void onCraftItemEvent(CraftItemEvent event) {
    4.  
    5. ItemStack selectedStack = event.getInventory().getResult();
    6. int selectedStackTypeId = selectedStack.getTypeId();
    7. short selectedStackDamageValue = selectedStack.getDurability();
    8.  
    9.  
    10. // re-name the item stack here
    11.  
    12. }


    I can't find anything in the Bukkit API to do the renaming at the moment, and I don't want to mess around with vanilla minecraft code since updates will probably break it.

    A problem I encountered was if you click the slot where the crafted item should be but the slot is empty when you click it, it throws severe errors to the console a/o server log
     
  7. Offline

    jtjj222

    I believe ItemMeta has a setName method. I can look into it further if you want. You shouldn't need to use nms code :D
     
  8. Offline

    aciid

    I'm pretty sure this is possible by attaching xyz MetaData to a diamond block but I'm too busy to look into it, sorry.
     
  9. Offline

    jtjj222

    You don't have to mess around with nbt tags and metadata. Bukkit has a class called itemmeta that handles it for you.
    2012-12-31_11.29.49.png
    Now, I just need to check the display name of a crafted object, and if it is a certain value, execute the command specified in the lore. Is that good Masterflapdrol?
     
  10. Offline

    Masterflapdrol

    Exactly! Perfect! :) thank you! But I don't have any coding program of some sort. But its very interesting to look at your codes... maybe a config would be great! (edit: would the command then be executed by normal diamond blocks as well? That could be a problem)
    oh and the command isn't used on the craft event. but on the player interaction. after that the item is taken away
     

Share This Page