GabiJunkes / MultipleBedSpawn

A simple Minecraft plugin to allow players to choose which bed to respawn into.
GNU General Public License v3.0
9 stars 3 forks source link

Bug: Having more than 53 beds breaks the plugin #11

Closed ghost closed 1 year ago

ghost commented 1 year ago

[23:37:04] [Server thread/ERROR]: Could not pass event PlayerRespawnEvent to MultipleBedSpawn v1.4.3 org.bukkit.event.EventException: null at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?] at net.minecraft.server.players.PlayerList.respawn(PlayerList.java:770) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.players.PlayerList.a(PlayerList.java:682) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2518) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.network.protocol.game.PacketPlayInClientCommand.a(SourceFile:24) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.network.protocol.game.PacketPlayInClientCommand.a(SourceFile:6) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:31) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1154) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.MinecraftServer.bi(MinecraftServer.java:1133) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.MinecraftServer.i_(MinecraftServer.java:1110) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1021) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 63) at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[commons-lang-2.6.jar:2.6] at org.bukkit.craftbukkit.v1_19_R3.CraftServer.createInventory(CraftServer.java:1892) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3697-Spigot-6ad4b93-9381350] at org.bukkit.Bukkit.createInventory(Bukkit.java:1380) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?] at me.gabrielfj.multiplebedspawn.listeners.RespawnMenuHandler.openRespawnMenu(RespawnMenuHandler.java:137) ~[?:?] at me.gabrielfj.multiplebedspawn.listeners.PlayerRespawnListener.onPlayerRespawn(PlayerRespawnListener.java:61) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?] ... 22 more

If you have 54 or more registered beds the plugin will break because of the limited inventory size of 54. The easiest fix for that would be to cap the max-beds config option to 53.

GabiJunkes commented 1 year ago

Thanks for the report, as soon as I have the time I will work on it. (I knew it it be a problem some day)

ghost commented 1 year ago

Other way to fix would be adding buttons to switch between multiple inventories of beds. Then you could have (in theory) unlimited beds.

GabiJunkes commented 1 year ago

Closed by #14