InternalServerError-Need help please

Discussion in 'Plugin Development' started by wulfbear_joe, Aug 20, 2011.

Thread Status:
Not open for further replies.
  1. Hey there!
    Atm I am developing a little bukkitplugin called pvpoutfitter. It's in a very early phase so I just "code" the basics.
    One of this is the changing of a players armor. Therefore, I used "player.getInventory().setHelmet(new ItemStack(298, 1));". THIS works, no problem. But then, I want my players to be able to delete the armor. I tried to replace the 298 in the line above with a 0 for air. Whenever I execute the related command, it gives a Internal Server Error and I get kicked. When I relog, the armor disappeared, so the command might just worked? What can I do to solve the Server Error?
    Hopefully,
    my description is detailled enough. If not, just tell me what you need!

    Thanks,
    wulfbear_joe
     
  2. Offline

    Feed_Dante

    (No idea if this will work)
    Have you tried setHelmet(null)?
     
  3. Hey,
    tried it. That's what I get next:
    Code:
    2011-08-21 09:56:33 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'itsover' in plugin Bukkittest v0.1
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:129)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:352)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:737)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:701)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:694)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:89)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:454)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NullPointerException
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:28)
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:20)
        at me.wulfbear_joe.bukkittest.Bukkittest.onCommand(Bukkittest.java:67)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
        ... 12 more
     
  4. Offline

    bassfader

    never tried it but you could try using new ItemStack(298, 0) to delete it (e.g. setting the count of items just to 0 ^^)
     
  5. Offline

    bergerkiller

    Or you set the durability of the item to 0 so the game cleans it up automatically. (broken)
     
  6. @bassfader: I am sorry, but it didn't work.
    @bergerkiller: Which ItemStack event should I use for that?
     
Thread Status:
Not open for further replies.

Share This Page