You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got some strage behavor when setting a player into Spactator in the config event. Hotbat invisible like spectator but player appears on clientsite as Creative or something, ,with block colisions and stuff.
Should there not be an error or something if it is not allowed?
Here is the my code: It's Kotlin
packagede.primecodesimportnet.minestom.server.MinecraftServerimportnet.minestom.server.entity.GameModeimportnet.minestom.server.event.player.AsyncPlayerConfigurationEventimportnet.minestom.server.event.player.PlayerBlockBreakEventimportnet.minestom.server.event.player.PlayerBlockPlaceEventimportnet.minestom.server.event.player.PlayerMoveEventimportnet.minestom.server.event.player.PlayerSpawnEventimportnet.minestom.server.instance.AnvilLoaderimportjava.net.InetSocketAddressfunmain() {
val server =MinecraftServer.init();
val instanceManager =MinecraftServer.getInstanceManager()
val loader =AnvilLoader("world")
val container = instanceManager.createInstanceContainer(loader)
val eventHandler =MinecraftServer.getGlobalEventHandler()
eventHandler.addListener(AsyncPlayerConfigurationEvent::class.java) { event ->
event.spawningInstance = container
event.player.gameMode =GameMode.SPECTATOR// Hotbar is not visible, blocks solid, and you can fly // event.player.gameMode = GameMode.CREATIVE // Works as expected
}
server.start(InetSocketAddress("0.0.0.0", 25565));
}
The text was updated successfully, but these errors were encountered:
You should set the game mode in the spawn event. Editing play-state values (like game mode) is not supported (though this should likely become an error).
I got some strage behavor when setting a player into Spactator in the config event. Hotbat invisible like spectator but player appears on clientsite as Creative or something, ,with block colisions and stuff.
Should there not be an error or something if it is not allowed?
Here is the my code: It's Kotlin
The text was updated successfully, but these errors were encountered: