Filled Takeaway item

Discussion in 'Plugin Requests' started by matija131, Nov 20, 2019.

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

    matija131

    Hey guys, I got another plugin request :)
    So I need a plugin that will take an item from a player with a command that can be executed by console!
    Lets say I type /take or /takeaway stick 1 matija131 (if matija131 has 1 stick in his inventory it will take it away).
    It needs to be executable from both the player and the console!

    Need it for 1.8 :D
    Thanks!

    EDIT: If a stick has a different display name, or a lore, it should still be taken away
     
    Last edited: Nov 20, 2019
  2. Offline

    CraftCreeper6

    @matija131
    Not saying I will do this.

    If a stick has item meta, I.E. a different display name, or a lore, should it still be taken away?
     
  3. Offline

    matija131

    Oh yes it should, I forgot to mention that :D
     
  4. Offline

    Maroka

    Made it! :>
    It works with the ForcedItems plugin, so it won't remove the item if it's one of the 'hotkeys'.
    There's tab completion for the items and players. The command works as follows: /take 'item' 'amount' 'player'

    Here it is:
    https://drive.google.com/open?id=1TxHeUum_boYci9YRGihWDZvNo7K7RP1c

    Hope it works as expected! ^^
     
    Last edited: Nov 21, 2019
  5. Offline

    matija131

    Doesnt seem to be working,
    This is the error message when I try using the command from the console:
    Code:
     Unexpected exception while parsing console command "take"
    org.bukkit.command.CommandException: Unhandled exception executing command 'take' in plugin Steal v1.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchServerCommand(CraftServer.java:632) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.aM(DedicatedServer.java:353) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:317) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
            at com.marokag.steal.StealCommand.onCommand(StealCommand.java:24) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            ... 8 more
    
    And this when I use it ingame:
    Code:
    [23:37:08 INFO]: matija131 issued server command: /take
    [23:37:08 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'take' in plugin Steal v1.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerConnection.java:1115) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:950) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:26) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:53) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_221]
            at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_221]
            at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:696) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
            at com.marokag.steal.StealCommand.onCommand(StealCommand.java:24) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot-1.8.jar:git-Spigot-c3c767f-33d5de3]
            ... 14 more
    
     
  6. Offline

    Maroka

    You can't just type /take
    You have to provide it with arguments. As I said the command works as follows: /take 'item' 'amount' 'player'
    So for example /take stick 2 matija131
    I forgot to check the arguments length for zero, that's why you're getting the error.
     
    Last edited: Nov 21, 2019
  7. Offline

    CraftCreeper6

    @matija131
    It seems like a problem with args length, it can be avoided by running the full command, easily fixed by the developer.

    /take 'item' 'amount' 'player'
     
    Last edited: Nov 21, 2019
  8. Offline

    matija131

    Yup youre right! Thanks

    Thanks alot! It works as expected :)
     
Thread Status:
Not open for further replies.

Share This Page