Rename Spawned Items when Spawned

Discussion in 'Archived: Plugin Requests' started by k21t11, Feb 12, 2013.

  1. Offline


    Hello Bukkit Community,

    As you may notice, I'm a little new here, I've been coming for plugins for a while, but just have never made an account :) I can't develop plugins, but do run a Minecraft server.

    Here's my request, thanks for reading :D

    Plugin category: Spawned Items

    Suggested name: SpawnedItems Renamer

    What I want: I think that it would be very helpful that, when using Essentials Spawning (/i or /give) that is renames the items based on the player that spawned it. For example, if I as a player, Joe, does /i dirt 1, the name of the item would become something like "Joe-Dirt". This way, if a server has a rule that says, "No giving out spawned items" it is super easy to figure out if, one, someone IS giving out spawned items, and 2, WHO spawned them! I am pretty sure this is possible, as you can currently do similar things with an anvil in-game, but as I said above, I am a little inexperienced with plugin development...

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: spawneditems.exempt: items spawn without the rename. (maybe default to op)

    When I'd like it by: Any time! It'd really be a help!
  2. Offline


    That a really good idea I might use it for my server !
  3. Offline


    I'll try it, but if I'm fairly new at plugin creation, so it could take a while for me to make, and I don't even know if I'm capable of this.
  4. Very useful, I would assume it would be hard to do..
  5. Offline


    Ill mess around in my free time with this.
  6. Offline


    Okay, I've started working on it. I need to know what permissions plugin you use.
  7. Offline


    That's a really good idea! Bukkit has API methods for naming items, so it's very possible.
  8. Offline


    I got pretty close. Like I said, I tried to make this. I failed. The way I tried to do it was to simply overwrite the existing commands to do something new. I tried to make it so that it would give you the item, but would make the item's name say the player's name followed by the actual block's name. Here's what ended up happening: first, you had to be holding an item in your hand. If you weren't holding an item, it didn't work. When you tried typing a command, it changed the name of the held block instead of the block added to your inventory. Also, by placing and picking the block back up, you got rid of the new name. I'll work more on it when I can, but I won't have Internet until next Wednesday.
  9. Offline


    If you send me your source and I can probably tell you how to fix it.
  10. Offline


    Seams simple enough however not sure if there is a way to detect if the item was given via a command or via just picking it up. I have an idea to do it if what I said above could not work. Ill give it a day for someone to claim before I do it.

    Also I think items wont stack if you rename every item someone gets.
    ElitexvxRampage likes this.
  11. Offline


    [quote uid=105174 name="Mango" post=1546544]eodomo
    If you send me your source and I can probably tell you how to fix it.[/quote]
    Here's the source:
    Download: <Edit by Moderator: Redacted mediafire url>
    Last edited by a moderator: Nov 8, 2016
  12. Offline


    Ok, thanks everyone, we use PermissionsEX, I think someone asked.

    Thanks :)
  13. Offline


    Seems good, I could see myself using this!
  14. Offline


    I am owner of the same server as k21t11 so if this gets made it will help us out tons.
  15. Offline


  16. Offline


    Hmm, actually I am pretty sure that wouldn't work, as that renames the items globally, no? It has to be a special name for the person who spawns it.

    Thanks for everyone's help so far :)
  17. Offline


    eodomo Your problem is that you assume that the item spawns into the player's hand. I'm looking through the JavaDoc for a solution right now.
  18. Offline


    Hey, any updates here? I'm really excited if this works :D
  19. Offline


    I could make this very quick. Can I add in a new command? Lol. The only problem is that you have to use the item ids instead of words to spawn.
  20. Offline



    Hmm... well, it would be nicer to have the actual names, I think there is a plugin out there that provides the framework for you to do this, unfortunately for the life of me can't remember what its called. :/
  21. Offline


    k21t11 eodomo iWareWolf
    It's done. I had to re-write almost all of it. GitHub. JAR Download. Fixed JAR.

    I decided to go with setting the "lore" of the item instead of the name. Try it out and you'll see why I prefer it.

    /i <item> [amount]
    Gives you a certain amount of the requested item. The resulting item will be tagged with your name.
    <item> can be a name or ID.
    [amount] is optional and defaults to 1 if not given.

    /give <name> <item> [amount]
    Gives another (online) player a certain amount of the requested item. The item will be tagged with the name of the person who typed the command.
    Once again, <item> can be a name or ID, and [amount] is optional and defaults to 1 if not given.

    Is this what you wanted?
    If you find any bugs, tell me.
  22. Offline


    Sounds good, thank you so much! I'll test and hopefully get back to you soon.

    Also, is there an exemption permission that allows you to be exempted from getting the name under it?


    Ok, so we put it into a test server (with essentials), and couldn't seem to get it to work. Any suggestions? It wouldn't give us access to spawning or anything, even with the permissions that were in the github.


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


    k21t11 Does it work without Essentials? I tested it without. I could do manual command overrides, but it would be dirty, and I'd rather find another solution.

    k21t11 I know what happened. I'm stupid, so I accidentally forgot to put the plugin.yml in that JAR. Here's the fix.

    EDIT: Tested with latest version of Essentials, and my commands override (this is a good thing).

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


    Ok thanks, i'll test and get back :)
  25. Offline


    I tested this plugin also and it works good at first. But it lacks the ability to persist.

    What I mean by this is that if you spawn 9 diamonds it will give you 9 diamonds that say my name since I spawned them but if I go and put them into a crafting table and turn into a diamond block it loses the name and switching back to diamonds will remove the name also.

    Another issue is if you place the dirt block down and break it then it will be readded to your inventory with no name on it.

    I am not sure if its possible to fix these or not.
  26. Offline


    JustinFatalx I honestly don't think it's possible. Minecraft provides no way to store that data. I'll keep trying for the moment.

    EDIT: Now that I think about it, it could technically be possible with complicated logging of block placements, but I think that's WAY out of the purpose of this plugin.
  27. Offline


    Actually its exactly what this plugin needs. To have a full proof method to track Donators from giving out spawned items.

    If they can just remove the name from it then what was the point of it to start with.
  28. Offline


    JustinFatalx Crafting wouldn't be that hard - I could make products of crafting recipes that included spawned items inherit the names of the people that spawned the items. For example, if you spawned some sand and gunpowder, they will have your name on them. If you craft it into TNT, the TNT will inherit your name. Block logging would get more complex. LogBlock's license allows me to use some of its code to make it happen.
  29. Offline


    Well if it can be done be much appreciated.

Share This Page