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

Potion Class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Not important

      There are two problems I have experienced with the Potion class.

      1. Using the method "fromItemStack(ItemStack item)" it throws an exception if the potion is a lingering potion or splash potion. Probably because of the ID switch in 1.9.

      Here is the stack trace:

      [Server thread/ERROR]: Could not pass event InventoryClickEvent to Feudal vBeta-1.0.0
      org.bukkit.event.EventException
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[my.jar:git-Spigot-3af4605-ed8cef0]
      	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[my.jar:git-Spigot-3af4605-ed8cef0]
      	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:1815) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PacketPlayInWindowClick.a(SourceFile:33) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PacketPlayInWindowClick.a(SourceFile:10) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_73]
      	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_73]
      	at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:721) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
      Caused by: java.lang.IllegalArgumentException: item is not a potion
      	at org.bukkit.potion.Potion.fromItemStack(Potion.java:417) ~[my.jar:git-Spigot-3af4605-ed8cef0]
      	at us.forseth11.feudal.classes.XP.inventoryClick(XP.java:436) ~[?:?]
      	at us.forseth11.feudal.core.EventManager.click(EventManager.java:235) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[my.jar:git-Spigot-3af4605-ed8cef0]
      

      2. Potions which do load return null when using the getType method in the Potion class.

      Stack trace:

      [Server thread/ERROR]: Could not pass event InventoryClickEvent to Feudal vBeta-1.0.0
      org.bukkit.event.EventException
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[my.jar:git-Spigot-3af4605-ed8cef0]
      	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[my.jar:git-Spigot-3af4605-ed8cef0]
      	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:1815) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PacketPlayInWindowClick.a(SourceFile:33) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PacketPlayInWindowClick.a(SourceFile:10) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_73]
      	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_73]
      	at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:721) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559) [my.jar:git-Spigot-3af4605-ed8cef0]
      	at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
      Caused by: java.lang.NullPointerException
      	at us.forseth11.feudal.classes.XP.inventoryClick(XP.java:442) ~[?:?]
      	at us.forseth11.feudal.core.EventManager.click(EventManager.java:235) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
      	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[my.jar:git-Spigot-3af4605-ed8cef0]
      

      I am assuming if problem 1 is solved then problem 2 will be resolved. Based on what is happening, I am assuming the method fromItemStack gets the potion using its durability data. Since 1.9 does not use durability data to define potions anymore, this becomes a problem.

            Unassigned Unassigned
            forseth11 Michael Forseth
            Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: