Filled Simple Save and Give Item

Discussion in 'Plugin Requests' started by Xp10d3, Jun 22, 2020.

  1. Offline

    Xp10d3

    Plugin category: I don't really know :p

    Minecraft version: 1.8.9

    Suggested name: Save/GiveItem

    What I want: Super simple. Basically you hold an item in your hand and type /saveitem <id>. It will save every single attribute of the item: the NBT tags, lore, name, custom model data, etc. <id> is the ID of the item that will be saved into a config file (you could probably do something like 1.yml or something to save the attributes). You can then do /giveitem <player> <id> to give the item based on it's ID and it will give the player specified (or if you're just doing /giveitem <id> it will give the item to whoever ran the command) the item based on it's ID. Please also include an @p, @s, @a, etc. I need this plugin for MythicMobs so that upon death it will run a command to drop an item. If you can hook into MythicMobs so that in case this plugin doesn't work that would be great. (This is technically a bridge between MyItems and MythicMobs so that I can create an item using MyItems and then have a custom mob drop the item)

    Ideas for commands:
    /giveitem <player | @p | @s | @a> <id>: Gives a certain item to whoever specified based on it's ID.
    /saveitem <id>: Saves an item as an ID. If an ID/item already exists, it will send a message saying, "Item already exists. Do you want to override it? [Confirm] [Cancel]". Clicking [Confirm] will confirm the process, clicking [Cancel] will cancel. You can use a different method than clicking chat if needed.
    /getitems: Sends a list of items saved by ID. It can be a GUI or a chat; whichever is easiest :)

    Ideas for permissions:
    saveitem.give: Allows use of /giveitem.
    saveitem.save: Allows use of /saveitem.
    saveitem.get: Allows use of /getitems.

    When I'd like it by: A.S.A.P.
     
    Last edited: Jun 24, 2020
  2. Offline

    Xp10d3

  3. Offline

    Xp10d3

  4. Offline

    Plootonix

    Seems simple enough. I'll start initial tests/ configuration to see what I can do.
     
  5. Offline

    Xp10d3

    Alright. Thanks :) Keep in mind that I mainly just need the lore copied. I have no clue whether NBT data exists in 1.8.9, but if it does be sure to have that be saved as well. Thanks for doing this :D
     
  6. Offline

    gochi9

    @Xp10d3 Wait if you just wanted the material, lore and the name i would've done this in less than a hour

    EDIT: if @Plootonix wants to do it than i am not gonna take it from him. I'll do it if he gives up tho
     
    Last edited: Jun 26, 2020
    Xp10d3 likes this.
  7. Offline

    Xp10d3

    @gochi9 Alright, thank you :) FYI I think NBT data exists in Minecraft 1.8.9 so if you're doing this please include taht as well :D
    @Plootonix
    If you can include that as well, that would be great :)
     
  8. Offline

    Plootonix

    @gochi9 free time is a bit of an issue at the moment, so you can take it.
     
  9. Offline

    gochi9

    ok then

    This is the plugin

    Commands:

    /saveitem <id> - permission: saveitem.save
    /giveitem <id> <amount> Player/@p/@a/@r - permission: giveitem.save
    /overrideitem <id> - permission: overrideitem.save
    /removeitem <id> - permission: removeitem.save
    /getitems - permission: listitem.save
    /getinfo <id> - permission: infoitem.save
    /slreload - permission: reloadconfig.save

    Haven't tested it much. Report any bugs. If it works as intended mark the request as filled

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 27, 2020
    Xp10d3 likes this.
  10. Offline

    Xp10d3

    Thank you! I'll be sure to test this and get back to you once I've tried it out.
    EDIT: /giveitem 1 5 doesn't seem to work if the item is non-stackable. Could you make that a feature? The item is an iron sword with NBT data and lore.
    Error:
    Code:
    > [14:50:00 INFO]: Eltik issued server command: /saveitem 1
    > [14:50:04 INFO]: Eltik issued server command: /getinfo 1
    > [14:51:42 INFO]: Eltik issued server command: /giveitem 1 5
    > [14:51:42 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'giveitem' in plugin SaveGiveItem v1.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) ~[patched.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) ~[patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [patched.jar:git-PaperSpigot-"4c7641d"]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [patched.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [patched.jar:git-PaperSpigot-"4c7641d"]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
    at main.deadshotmdf.SaveGiveItem.Commands.GiveItemCommand.onCommand(GiveItemCommand.java:62) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched.jar:git-PaperSpigot-"4c7641d"]
    ... 15 more
    > [14:53:01 INFO]: Eltik issued server command: /removeitem 1
    > [14:53:04 INFO]: Eltik issued server command: /getinfo 1
    > [14:53:07 INFO]: Eltik issued server command: /getitems
    > [14:53:11 INFO]: Eltik issued server command: /saveitem 1
    > [14:53:13 INFO]: Eltik issued server command: /getitems
    > [14:53:15 INFO]: Eltik issued server command: /getinfo 1
    > [14:53:33 INFO]: Eltik issued server command: /overrideitem 1
    > [14:53:36 INFO]: Eltik issued server command: /getinfo 1
    > [14:53:45 INFO]: Eltik lost connection: Disconnected
    
    Otherwise, all other commands work! I haven't tried giving non-stackable items or stackable items in only one amount. Thanks for doing this :)
    @gochi9 let me know once the error has been fixed :D
     
    Last edited: Jun 28, 2020
  11. Offline

    gochi9

    @Xp10d3
    Sorry to tell you but the command is /giveitem <id> <amount> Player/@p/@a/@r
    You only entered /giveitem <id> <amount> You must enter a player or @a or @p or @r, you didn't put any input there so of course it is an error. Maybe i can add a message but you still need to put something there
     
    Xp10d3 likes this.
  12. Offline

    gochi9

    Please report any bugs or mark it as solved
     
    Xp10d3 likes this.
  13. Offline

    Xp10d3

    Sorry didn't get around to testing. Finally did and it works perfectly! Thank you so much :D
    @gochi9 marking as solved
     

Share This Page