WorldEdit

WorldEdit

45M Downloads

Invalid tree types make exception

josephjthomas opened this issue ยท 0 comments

commented

WorldEdit Version

WorldEdit version 7.2.8-SNAPSHOT+5980-29f1c66

Platform Version

git-Paper-391 (MC: 1.15.2)

Confirmations

  • I am using the most recent Minecraft release.
  • I am using a version of WorldEdit compatible with my Minecraft version.
  • I am using the latest or recommended version of my platform software.
  • I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
  • I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)

Bug Description

If you load WorldEdit on a version lower than 1.17 that does not support a few tree types, you get the following message:

[11:18:41] [Server thread/ERROR]: No TreeType mapping for TreeGenerator.TreeType.CRIMSON_FUNGUS
[11:18:41] [Server thread/ERROR]: No TreeType mapping for TreeGenerator.TreeType.WARPED_FUNGUS

That's fine, because the types don't exist back then, but you can still tab complete them ingame, but if you try to put a tree down, the following exception is fired:

[11:18:55] [Server thread/INFO]: User issued server command: /tool tree warpedfungus
[11:18:56] [Server thread/ERROR]: Could not dispatch event: com.sk89q.worldedit.event.platform.BlockInteractEvent@6820c288 to handler EventHandler{priority=NORMAL}
java.lang.reflect.InvocationTargetException: null
	at com.sk89q.worldedit.util.eventbus.EventHandler.handleEvent(EventHandler.java:75) ~[?:?]
	at com.sk89q.worldedit.util.eventbus.EventBus.dispatch(EventBus.java:193) ~[?:?]
	at com.sk89q.worldedit.util.eventbus.EventBus.post(EventBus.java:181) ~[?:?]
	at com.sk89q.worldedit.WorldEdit.handleBlockRightClick(WorldEdit.java:665) ~[?:?]
	at com.sk89q.worldedit.bukkit.WorldEditListener.onPlayerInteract(WorldEditListener.java:136) ~[?:?]
	at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1.execute(Unknown Source) ~[?:?]
	at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.15.2.jar:git-Paper-391]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.15.2.jar:git-Paper-391]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.15.2.jar:git-Paper-391]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.15.2.jar:git-Paper-391]
	at org.bukkit.craftbukkit.v1_15_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:471) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.PlayerInteractManager.a(PlayerInteractManager.java:456) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.PlayerConnection.a(PlayerConnection.java:1422) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:27) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:5) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.MinecraftServer.ba(MinecraftServer.java:1106) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:1099) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.MinecraftServer.sleepForTick(MinecraftServer.java:1060) ~[patched_1.15.2.jar:git-Paper-391]
	at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:975) ~[patched_1.15.2.jar:git-Paper-391]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.TreeType.ordinal()" because "type" is null
	at org.bukkit.craftbukkit.v1_15_R1.CraftWorld.generateTree(CraftWorld.java:805) ~[patched_1.15.2.jar:git-Paper-391]
	at org.bukkit.craftbukkit.v1_15_R1.CraftWorld.generateTree(CraftWorld.java:883) ~[patched_1.15.2.jar:git-Paper-391]
	at com.sk89q.worldedit.bukkit.BukkitWorld.generateTree(BukkitWorld.java:298) ~[?:?]
	at com.sk89q.worldedit.util.TreeGenerator$TreeType.generate(TreeGenerator.java:153) ~[?:?]
	at com.sk89q.worldedit.command.tool.TreePlanter.actPrimary(TreePlanter.java:62) ~[?:?]
	at com.sk89q.worldedit.extension.platform.PlatformManager.handleBlockInteract(PlatformManager.java:386) ~[?:?]
	at com.sk89q.worldedit.util.eventbus.MethodHandleEventHandler.dispatch(MethodHandleEventHandler.java:51) ~[?:?]
	at com.sk89q.worldedit.util.eventbus.EventHandler.handleEvent(EventHandler.java:73) ~[?:?]
	... 25 more

Expected Behavior

No exception and fail silently, the treetype mapping errors already tell you that you can't use the tree type in this version.
Additionally, don't tab invalid types ingame.

Reproduction Steps

  1. Try to use a tree type on a version it doesn't exist
  2. See the exception

Anything Else?

No response