SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.04k stars 364 forks source link

Trying to ride boats/chest boats crashes the server #6883

Closed derigin closed 3 weeks ago

derigin commented 4 weeks ago

Skript/Server Version

[Skript] Server Version: 1.21-2256-de2e7a7 (MC: 1.21)
[Skript] Skript Version: 2.9.0-pre1 (skriptlang-github)
[Skript] Installed Skript Addons: 
[Skript]  - skript-placeholders v1.6.0 (https://github.com/APickledWalrus/skript-placeholders)
[Skript]  - Skellett v2.0.10 (https://forums.skunity.com/resources/skellett.24/)
[Skript]  - skript-gui v1.3 (https://github.com/APickledWalrus/skript-gui)
[Skript]  - skript-yaml v1.5
[Skript]  - skUtilities v0.9.2 (https://tim740.github.io/)
[Skript]  - skRayFall v1.9.28 (https://sk.rayfall.net/)
[Skript]  - SkQuery v4.1.10
[Skript]  - Skript-Paper v1.3.0 (https://github.com/ShaneBeee/Skript-Paper)
[Skript]  - SkBee v3.5.6 (https://github.com/ShaneBeee/SkBee)
[Skript] Installed dependencies: 
[Skript]  - Vault v1.7.3-b131
[Skript]  - WorldGuard v7.0.11-beta1+a801a9d
[Skript]  - GriefPrevention v16.18.4

Bug Description

I am able to place a boat or chest boat (of all types, including rafts) just fine. As soon as I try to click it to ride it, the server crashes. I tried disabling Skript, and I am able to ride boats just fine. I then tried enabling Skript, but disabling all addons, and the crash still happens when I try to ride boats. This leads me to believe it's not caused by an addon. I've tested this out with other rideable entities (e.g. minecarts, pigs, horses) and they are still rideable with Skript enabled. For me, it just seems to impact boats.

Expected Behavior

I should be able to ride boats without the server crashing.

Steps to Reproduce

I entered a world, took out a boat, and placed it on the water. When I go to right click the boat to ride it, the server briefly hangs without any action being taken, and then crashes.

Errors or Screenshots

[16:09:03] [Server thread/ERROR]: #!#! Stack trace: [16:09:03] [Server thread/ERROR]: #!#! java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "stack" is null [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.entity.BoatChestData.isOfItemType(BoatChestData.java:114) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.classes.data.DefaultComparators$15.compare(DefaultComparators.java:314) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.classes.data.DefaultComparators$15.compare(DefaultComparators.java:300) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.events.EvtClick$2.check(EvtClick.java:208) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.lang.util.SimpleExpression.check(SimpleExpression.java:165) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.lang.util.SimpleLiteral.check(SimpleLiteral.java:179) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.lang.ExpressionList.check(ExpressionList.java:165) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.lang.ExpressionList.check(ExpressionList.java:177) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.events.EvtClick.check(EvtClick.java:204) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.SkriptEventHandler.lambda$execute$3(SkriptEventHandler.java:193) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.util.Task.callSync(Task.java:164) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.util.Task.callSync(Task.java:148) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.SkriptEventHandler.execute(SkriptEventHandler.java:192) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.SkriptEventHandler.check(SkriptEventHandler.java:138) [16:09:03] [Server thread/ERROR]: #!#! at Skript-2.9.0-pre1.jar//ch.njol.skript.SkriptEventHandler$PriorityListener.lambda$new$0(SkriptEventHandler.java:64) [16:09:03] [Server thread/ERROR]: #!#! at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) [16:09:03] [Server thread/ERROR]: #!#! at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) [16:09:03] [Server thread/ERROR]: #!#! at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) [16:09:03] [Server thread/ERROR]: #!#! at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) [16:09:03] [Server thread/ERROR]: #!#! at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.network.ServerGamePacketListenerImpl$4.performInteraction(ServerGamePacketListenerImpl.java:2798) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.network.ServerGamePacketListenerImpl$4.onInteraction(ServerGamePacketListenerImpl.java:2848) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAction.dispatch(ServerboundInteractPacket.java:138) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:89) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:2787) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:76) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:14) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:36) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.TickTask.run(TickTask.java:18) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1576) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:201) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1553) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1546) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1505) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1512) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1357) [16:09:03] [Server thread/ERROR]: #!#! at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:332) [16:09:03] [Server thread/ERROR]: #!#! at java.base/java.lang.Thread.run(Thread.java:1583)

Other

No response

Agreement

APickledWalrus commented 3 weeks ago

reproducible using a nonsense though valid script (when right clicking a boat):

on right click:
    event-entity is lava
    send "watch out!" to player

caused by boat data not checking that the ItemType has a valid ItemStack representation (e.g. that getRandom is not null). likely a lot of these cases due to 1.21 changes.