Block2Block / HubParkour

A fun Hub Parkour plugin with checkpoints, rewards and more!
Apache License 2.0
9 stars 10 forks source link

1.17 Support #7

Closed Bubbycolditz closed 3 years ago

Bubbycolditz commented 3 years ago

1.17 Support

HubParkour recognizes that 1.17 is a non-legacy version and will enable on launch. However, there is only one function, that I know of and tested, that is not operational.

Errors Present in Build

When going on a pressure plate to receive a checkpoint, the plugin provides an error to the console:

[13:44:21 ERROR]: Could not pass event PlayerMoveEvent to HubParkour v2.4.2
java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null
        at me.block2block.hubparkour.entities.HubParkourPlayer.checkpoint(HubParkourPlayer.java:111) ~[?:?]
        at me.block2block.hubparkour.listeners.PressurePlateListener.onPressurePlate(PressurePlateListener.java:178) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor215.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleMovePlayer(ServerGamePacketListenerImpl.java:1440) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundMovePlayerPacket.handle(ServerboundMovePlayerPacket.java:114) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot.handle(ServerboundMovePlayerPacket.java:16) ~[?:?]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:36) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1340) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.server.MinecraftServer.shouldRun(MinecraftServer.java:193) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1319) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1312) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1273) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1184) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
        at java.lang.Thread.run(Thread.java:831) [?:?]

This error also refers to #5, dealing with the same issue. This issue seems to be non-existent in all versions except 1.17, however no additional reproduction steps were noted in #5 so it is unclear on how this error was triggered for them.

Block2Block commented 3 years ago

One of the changes you've made, namely the change to how unbreakable items are created in older versions, would break older versions of the plugin as ItemStack#setUnbreakable does not exist in versions below 1.13. 1.17 support will come with other updates and will be coming soon.

Block2Block commented 3 years ago

Taking a further look at the error it looks like configuration files have had changes in newer versions so will require me to spend some time looking into the issue

Bubbycolditz commented 3 years ago

It seems that the main issue of PlayerMoveEvent occurring is having the outdated configs. Using an old config seems to break the plugin since new options and features were introduced in version v2.4.0. There is currently no config-version for the plugin to check whether it has the most updated version of the config. If a config-version was implemented, this would introduce an easy way to combat the PlayerMoveEvent error and future errors because it forces a new version of the config for the plugin to interact with. I am not sure how you plan on approaching this, but everything else is operational in 1.17.

If you receive the error I had mentioned, just remove your config and have the plugin regenerate it.