Class GeyserSpigotWorldManager
java.lang.Object
org.geysermc.geyser.level.WorldManager
org.geysermc.geyser.level.GeyserWorldManager
org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager
- Direct Known Subclasses:
GeyserSpigot1_12WorldManager,GeyserSpigotFallbackWorldManager,GeyserSpigotNativeWorldManager
The base world manager to use when there is no supported NMS revision
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static intThe current client protocol version for ViaVersion usage. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetBlockAt(GeyserSession session, int x, int y, int z)Gets the Java block state at the specified locationintgetBlockNetworkId(org.bukkit.entity.Player player, org.bukkit.block.Block block, int x, int y, int z)getGameRuleBool(GeyserSession session, GameRule gameRule)Gets a gamerule value as a booleanintgetGameRuleInt(GeyserSession session, GameRule gameRule)Get a gamerule value as an integercom.nukkitx.nbt.NbtMapgetLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad)Sigh.booleanChecks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache.booleanhasPermission(GeyserSession session, String permission)Checks if the given session's player has a permissionbooleanisLegacy()This must be set to true if we are pre-1.13, anddoes not exist.booleanMethods inherited from class org.geysermc.geyser.level.GeyserWorldManager
setDifficulty, setGameRule, setPlayerGameModeMethods inherited from class org.geysermc.geyser.level.WorldManager
getBlockAt, getBlockAt
-
Field Details
-
CLIENT_PROTOCOL_VERSION
protected static final int CLIENT_PROTOCOL_VERSIONThe current client protocol version for ViaVersion usage.
-
-
Constructor Details
-
GeyserSpigotWorldManager
public GeyserSpigotWorldManager(org.bukkit.plugin.Plugin plugin)
-
-
Method Details
-
getBlockAt
Description copied from class:WorldManagerGets the Java block state at the specified location- Overrides:
getBlockAtin classGeyserWorldManager- 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
-
getBlockNetworkId
public int getBlockNetworkId(org.bukkit.entity.Player player, org.bukkit.block.Block block, int x, int y, int z) -
hasOwnChunkCache
public boolean hasOwnChunkCache()Description copied from class:WorldManagerChecks 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.
- Overrides:
hasOwnChunkCachein classGeyserWorldManager- 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:WorldManagerSigh.
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.- Overrides:
getLecternDataAtin classGeyserWorldManager- 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()- Overrides:
shouldExpectLecternHandledin classGeyserWorldManager- Returns:
- whether we should expect lectern data to update, or if we have to fall back on a workaround.
-
getGameRuleBool
Description copied from class:WorldManagerGets a gamerule value as a boolean- Overrides:
getGameRuleBoolin classGeyserWorldManager- 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:WorldManagerGet a gamerule value as an integer- Overrides:
getGameRuleIntin classGeyserWorldManager- 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
-
hasPermission
Description copied from class:WorldManagerChecks if the given session's player has a permission- Overrides:
hasPermissionin classGeyserWorldManager- 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
-
isLegacy
public boolean isLegacy()This must be set to true if we are pre-1.13, anddoes not exist. This should be set to true if we are post-1.13 but before the latest version, and we should convert the old block state id to the current one.- Returns:
- whether there is a difference between client block state and server block state that requires extra processing
-