grandwazir / StarterKit

A plugin for Bukkit to give items to new players
http://grandwazir.github.com/StarterKit
GNU General Public License v3.0
4 stars 5 forks source link

Issue with ArmourKit #9

Closed malachy1681 closed 12 years ago

malachy1681 commented 12 years ago

I am running CB 1.2.5 and the StarterKit 1.1.2. The item kit sets up and works as expected; however, the armour kit seems to modify the slot indices after stopping and restarting the server. The config.yml has the following after saving:

==: ArmourKit
'3':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_HELMET
'2':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_CHESTPLATE
'1':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_LEGGINGS
'0':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_BOOTS

and is changed to the following after a server restart:

==: ArmourKit
'2':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_LEGGINGS
'0':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_BOOTS
'6':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_HELMET
'4':
  ==: org.bukkit.inventory.ItemStack
  type: LEATHER_CHESTPLATE

So the boots are in the correct slot, but the leggings are in the chest slot and the other two cause a Java array out of bounds exception. This is the errror upon new player join:

 [SEVERE] Could not pass event PlayerJoinEvent to StarterKit
 org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:459)
    at net.minecraft.server.ServerConfigurationManager.c(ServerConfigurationManager.java:132)
    at net.minecraft.server.NetLoginHandler.b(NetLoginHandler.java:129)
    at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:94)
    at net.minecraft.server.Packet1Login.handle(SourceFile:68)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:48)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:61)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:551)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:449)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
 Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
    at net.minecraft.server.PlayerInventory.setItem(PlayerInventory.java:279)
    at org.bukkit.craftbukkit.inventory.CraftInventory.setItem(CraftInventory.java:75)
    at org.bukkit.craftbukkit.inventory.CraftInventoryPlayer.setArmorContents(CraftInventoryPlayer.java:87)
    at name.richardson.james.bukkit.starterkit.PlayerJoinListener.giveKit(PlayerJoinListener.java:82)
    at name.richardson.james.bukkit.starterkit.PlayerJoinListener.onPlayerJoin(PlayerJoinListener.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
    ... 12 more

and this upon using /sk load:

 [SEVERE] null
 org.bukkit.command.CommandException: Unhandled exception executing command 'sk' in plugin StarterKit v1.1.2
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:479)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:821)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:781)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:764)
    at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:34)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:551)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:449)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
 Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
    at net.minecraft.server.PlayerInventory.setItem(PlayerInventory.java:279)
    at org.bukkit.craftbukkit.inventory.CraftInventory.setItem(CraftInventory.java:75)
    at org.bukkit.craftbukkit.inventory.CraftInventoryPlayer.setArmorContents(CraftInventoryPlayer.java:87)
    at name.richardson.james.bukkit.starterkit.management.LoadCommand.execute(LoadCommand.java:52)
    at name.richardson.james.bukkit.utilities.command.PluginCommand.onCommand(PluginCommand.java:138)
    at name.richardson.james.bukkit.utilities.command.CommandManager.onCommand(CommandManager.java:72)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
    ... 12 more
grandwazir commented 12 years ago

This is a duplicate of issue #14 and has been fixed in version 1.2.1 of StarterKit.