Package org.geysermc.geyser.level
Class GeyserWorldManager
java.lang.Object
org.geysermc.geyser.level.WorldManager
org.geysermc.geyser.level.GeyserWorldManager
- Direct Known Subclasses:
GeyserSpigotWorldManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getBlockAt(GeyserSession session, int x, int y, int z)
Gets the Java block state at the specified locationgetGameRuleBool(GeyserSession session, GameRule gameRule)
Gets a gamerule value as a booleanint
getGameRuleInt(GeyserSession session, GameRule gameRule)
Get a gamerule value as an integercom.nukkitx.nbt.NbtMap
getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad)
Sigh.boolean
Checks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache.boolean
hasPermission(GeyserSession session, String permission)
Checks if the given session's player has a permissionvoid
setDifficulty(GeyserSession session, com.github.steveice10.mc.protocol.data.game.setting.Difficulty difficulty)
Change the difficulty of the Java servervoid
setGameRule(GeyserSession session, String name, Object value)
Updates a gamerule value on the Java servervoid
setPlayerGameMode(GeyserSession session, com.github.steveice10.mc.protocol.data.game.entity.player.GameMode gameMode)
Change the game mode of the given sessionboolean
Methods inherited from class org.geysermc.geyser.level.WorldManager
getBlockAt, getBlockAt
-
Constructor Details
-
GeyserWorldManager
public GeyserWorldManager()
-
-
Method Details
-
getBlockAt
Description copied from class:WorldManager
Gets the Java block state at the specified location- Specified by:
getBlockAt
in classWorldManager
- Parameters:
session
- the sessionx
- the x coordinate to get the block aty
- the y coordinate to get the block atz
- the z coordinate to get the block at- Returns:
- the block state at the specified location
-
hasOwnChunkCache
public boolean hasOwnChunkCache()Description copied from class:WorldManager
Checks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache.Some world managers (e.g. Spigot) can provide access to block data outside of the chunk cache, and even with chunk caching disabled. This method provides a means to check if this manager has this capability.
- Specified by:
hasOwnChunkCache
in classWorldManager
- Returns:
- whether or not this world manager has access to more block data than the chunk cache
-
getLecternDataAt
public com.nukkitx.nbt.NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad)Description copied from class:WorldManager
Sigh.
So, on Java Edition, the lectern is an inventory. Java opens it and gets the contents of the book there. On Bedrock, the lectern contents are part of the block entity tag. Therefore, Bedrock expects to have the contents of the lectern ready and present in the world. If the contents are not there, it takes at least two clicks for the lectern to update the tag and then present itself.
We solve this problem by querying all loaded lecterns, where possible, and sending their information in a block entity tag.- Specified by:
getLecternDataAt
in classWorldManager
- Parameters:
session
- the session of the playerx
- the x coordinate of the lecterny
- the y coordinate of the lecternz
- the z coordinate of the lecternisChunkLoad
- if this is called during a chunk load or not. Changes behavior in certain instances.- Returns:
- the Bedrock lectern block entity tag. This may not be the exact block entity tag - for example, Spigot's block handled must be done on the server thread, so we send the tag manually there.
-
shouldExpectLecternHandled
public boolean shouldExpectLecternHandled()- Specified by:
shouldExpectLecternHandled
in classWorldManager
- Returns:
- whether we should expect lectern data to update, or if we have to fall back on a workaround.
-
setGameRule
Description copied from class:WorldManager
Updates a gamerule value on the Java server- Specified by:
setGameRule
in classWorldManager
- Parameters:
session
- The session of the user that requested the changename
- The gamerule to changevalue
- The new value for the gamerule
-
getGameRuleBool
Description copied from class:WorldManager
Gets a gamerule value as a boolean- Specified by:
getGameRuleBool
in classWorldManager
- Parameters:
session
- The session of the user that requested the valuegameRule
- The gamerule to fetch the value of- Returns:
- The boolean representation of the value
-
getGameRuleInt
Description copied from class:WorldManager
Get a gamerule value as an integer- Specified by:
getGameRuleInt
in classWorldManager
- Parameters:
session
- The session of the user that requested the valuegameRule
- The gamerule to fetch the value of- Returns:
- The integer representation of the value
-
setPlayerGameMode
public void setPlayerGameMode(GeyserSession session, com.github.steveice10.mc.protocol.data.game.entity.player.GameMode gameMode)Description copied from class:WorldManager
Change the game mode of the given session- Specified by:
setPlayerGameMode
in classWorldManager
- Parameters:
session
- The session of the player to change the game mode ofgameMode
- The game mode to change the player to
-
setDifficulty
public void setDifficulty(GeyserSession session, com.github.steveice10.mc.protocol.data.game.setting.Difficulty difficulty)Description copied from class:WorldManager
Change the difficulty of the Java server- Specified by:
setDifficulty
in classWorldManager
- Parameters:
session
- The session of the user that requested the changedifficulty
- The difficulty to change to
-
hasPermission
Description copied from class:WorldManager
Checks if the given session's player has a permission- Specified by:
hasPermission
in classWorldManager
- Parameters:
session
- The session of the player to check the permission ofpermission
- The permission node to check- Returns:
- True if the player has the requested permission, false if not
-