Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-749

Instant potions throw NPE if Potion.fromItemStack is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • 1.8.1 craftbukkit

      Potion.fromItemStack(IS); causes this problem IS is itemstack

      and here is the log:
      /////////////////////////////////////////////////////////////////////////////////////////////////

      [Server thread/ERROR]: Could not pass event InventoryOpenEvent to GUI_Shop v0.0.1
      org.bukkit.event.EventException
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:297) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:36) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callInventoryOpenEvent(CraftEventFactory.java:692) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.EntityPlayer.openContainer(EntityPlayer.java:641) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.BlockChest.interact(SourceFile:339) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PlayerInteractManager.interact(PlayerInteractManager.java:495) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:693) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:50) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:80) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_11]
      	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_11]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:643) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:284) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:598) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:506) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at java.lang.Thread.run(Unknown Source) [?:1.8.0_11]
      Caused by: java.lang.IllegalArgumentException: Instant potions cannot be extended
      	at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.setHasExtendedDuration(Potion.java:268) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.extend(Potion.java:152) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.fromDamage(Potion.java:409) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.fromItemStack(Potion.java:418) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at shop.constant.items.PotionItem.<init>(PotionItem.java:16) ~[?:?]
      	at shop.constant.items.CustomItem.toCIFromItemStack(CustomItem.java:206) ~[?:?]
      	at shop.event.handler.InventoryEventHandler.serializeItem(InventoryEventHandler.java:100) ~[?:?]
      	at shop.event.handler.InventoryEventHandler.onInventoryOpen(InventoryEventHandler.java:48) ~[?:?]
      	at sun.reflect.GeneratedMethodAccessor627.invoke(Unknown Source) ~[?:?]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:295) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	... 19 more
      [03:13:04] [Server thread/ERROR]: Could not pass event InventoryCloseEvent to GUI_Shop v0.0.1
      org.bukkit.event.EventException
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:297) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:36) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.handleInventoryCloseEvent(CraftEventFactory.java:815) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:1301) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callInventoryOpenEvent(CraftEventFactory.java:684) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.EntityPlayer.openContainer(EntityPlayer.java:641) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.BlockChest.interact(SourceFile:339) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PlayerInteractManager.interact(PlayerInteractManager.java:495) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:693) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:50) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:80) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_11]
      	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_11]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:643) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:284) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:598) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:506) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at java.lang.Thread.run(Unknown Source) [?:1.8.0_11]
      Caused by: java.lang.IllegalArgumentException: Instant potions cannot be extended
      	at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.setHasExtendedDuration(Potion.java:268) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.extend(Potion.java:152) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.fromDamage(Potion.java:409) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.fromItemStack(Potion.java:418) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at shop.constant.items.PotionItem.<init>(PotionItem.java:16) ~[?:?]
      	at shop.constant.items.CustomItem.toCIFromItemStack(CustomItem.java:206) ~[?:?]
      	at shop.event.handler.InventoryEventHandler.serializeItem(InventoryEventHandler.java:100) ~[?:?]
      	at shop.event.handler.InventoryEventHandler.onInventoryClose(InventoryEventHandler.java:62) ~[?:?]
      	at sun.reflect.GeneratedMethodAccessor609.invoke(Unknown Source) ~[?:?]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:295) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	... 21 more
      [03:13:04] [Server thread/ERROR]: Could not pass event InventoryOpenEvent to GUI_Shop v0.0.1
      org.bukkit.event.EventException
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:297) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:36) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callInventoryOpenEvent(CraftEventFactory.java:692) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.EntityPlayer.openContainer(EntityPlayer.java:641) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.BlockChest.interact(SourceFile:339) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PlayerInteractManager.interact(PlayerInteractManager.java:495) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:693) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:50) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:80) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_11]
      	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_11]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:643) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:284) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:598) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:506) [craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at java.lang.Thread.run(Unknown Source) [?:1.8.0_11]
      Caused by: java.lang.IllegalArgumentException: Instant potions cannot be extended
      	at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.setHasExtendedDuration(Potion.java:268) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.extend(Potion.java:152) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.fromDamage(Potion.java:409) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at org.bukkit.potion.Potion.fromItemStack(Potion.java:418) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	at shop.constant.items.PotionItem.<init>(PotionItem.java:16) ~[?:?]
      	at shop.constant.items.CustomItem.toCIFromItemStack(CustomItem.java:206) ~[?:?]
      	at shop.event.handler.InventoryEventHandler.serializeItem(InventoryEventHandler.java:100) ~[?:?]
      	at shop.event.handler.InventoryEventHandler.onInventoryOpen(InventoryEventHandler.java:48) ~[?:?]
      	at sun.reflect.GeneratedMethodAccessor627.invoke(Unknown Source) ~[?:?]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:295) ~[craftbukkit-1.8.jar:git-Bukkit-40aaa31]
      	... 19 more
      

            Unassigned Unassigned
            tastybento tastybento
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: