1.13 support Skulls

Discussion in 'Spigot Plugin Development' started by MLGEditz, Jul 18, 2018.

  1. Hi there,

    I'm busy by updating my plugin to 1.13 but I got a problem with the Skulls.

    I'm talking about the following code:

    Code (Java):
    Location firstSkull = firstPlace.getBlock().getLocation().add(0, 1, 0);
                 Location secondSkull = secondPlace.getBlock().getLocation().add(0, 1, 0);
                 Location thirdSkull = thirdPlace.getBlock().getLocation().add(0, 1, 0);
               
                 firstSkull.getBlock().setType(MaterialManager.getMaterial(OldMaterial.SKULL));
                 secondSkull.getBlock().setType(MaterialManager.getMaterial(OldMaterial.SKULL));
                 thirdSkull.getBlock().setType(MaterialManager.getMaterial(OldMaterial.SKULL));
    But
    Code (Java):
    firstSkull.getBlock().setType(MaterialManager.getMaterial(OldMaterial.SKULL));
    Gives the following error:

    Code (Java):
    [13:05:48 ERROR]: Could not pass event PlayerInteractEvent to ParkourPlus v2.0.2
    org.bukkit.event.EventException: null
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:235) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:202) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.BlockPressurePlateWeighted.e(BlockPressurePlateWeighted.java:32) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.BlockPressurePlateAbstract.a(BlockPressurePlateAbstract.java:96) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.BlockPressurePlateAbstract.a(BlockPressurePlateAbstract.java:89) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.Entity.checkBlockCollisions(Entity.java:961) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.Entity.move(Entity.java:542) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.EntityLiving.a(EntityLiving.java:1811) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.EntityHuman.a(EntityHuman.java:1426) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.EntityLiving.n(EntityLiving.java:2122) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.EntityHuman.n(EntityHuman.java:348) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.EntityLiving.B_(EntityLiving.java:1944) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.EntityHuman.B_(EntityHuman.java:145) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.EntityPlayer.playerTick(EntityPlayer.java:304) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.PlayerConnection.e(PlayerConnection.java:139) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.NetworkManager.a(NetworkManager.java:233) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.ServerConnection.c(ServerConnection.java:140) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:845) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
    Caused by: java.lang.NullPointerException
            at org.bukkit.craftbukkit.v1_12_R1.block.CraftBlock.setType(CraftBlock.java:123) ~[spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at org.bukkit.craftbukkit.v1_12_R1.block.CraftBlock.setType(CraftBlock.java:118) ~[spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            at nl.mlgeditz.parkour.leaderboards.Leaderboard.<init>(Leaderboard.java:190) ~[?:?]
            at nl.mlgeditz.parkour.Main.createLeaderBoard(Main.java:851) ~[?:?]
            at nl.mlgeditz.parkour.Main.onParkourFinish(Main.java:517) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
            at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.12.jar:git-Spigot-3d850ec-809c399]
            ... 25 more
    So my question is how can i fix this?
     
  2. is MaterialManager your class or a spigot 1.13 class? (Good chance the #getMaterial method is returning null)
     
    • Funny Funny x 1
  3. I do know that SKULL_ITEM is now PLAYER_HEAD. thats as far as I know as I had to update my CustomSkullManager for player skulls. and the wall variation of the head is PLAYER_WALL_HEAD. I just updated my enums to the new one tbh for me. Not all of them are legacy atm.