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

public class GeyserSpigotWorldManager extends GeyserWorldManager
The base world manager to use when there is no supported NMS revision
  • Field Details

    • CLIENT_PROTOCOL_VERSION

      protected static final int CLIENT_PROTOCOL_VERSION
      The current client protocol version for ViaVersion usage.
  • Constructor Details

    • GeyserSpigotWorldManager

      public GeyserSpigotWorldManager(org.bukkit.plugin.Plugin plugin)
  • Method Details

    • getBlockAt

      public int getBlockAt(GeyserSession session, int x, int y, int z)
      Description copied from class: WorldManager
      Gets the Java block state at the specified location
      Overrides:
      getBlockAt in class GeyserWorldManager
      Parameters:
      session - the session
      x - the x coordinate to get the block at
      y - the y coordinate to get the block at
      z - 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: 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.

      Overrides:
      hasOwnChunkCache in class GeyserWorldManager
      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.
      Overrides:
      getLecternDataAt in class GeyserWorldManager
      Parameters:
      session - the session of the player
      x - the x coordinate of the lectern
      y - the y coordinate of the lectern
      z - the z coordinate of the lectern
      isChunkLoad - 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:
      shouldExpectLecternHandled in class GeyserWorldManager
      Returns:
      whether we should expect lectern data to update, or if we have to fall back on a workaround.
    • getGameRuleBool

      public Boolean getGameRuleBool(GeyserSession session, GameRule gameRule)
      Description copied from class: WorldManager
      Gets a gamerule value as a boolean
      Overrides:
      getGameRuleBool in class GeyserWorldManager
      Parameters:
      session - The session of the user that requested the value
      gameRule - The gamerule to fetch the value of
      Returns:
      The boolean representation of the value
    • getGameRuleInt

      public int getGameRuleInt(GeyserSession session, GameRule gameRule)
      Description copied from class: WorldManager
      Get a gamerule value as an integer
      Overrides:
      getGameRuleInt in class GeyserWorldManager
      Parameters:
      session - The session of the user that requested the value
      gameRule - The gamerule to fetch the value of
      Returns:
      The integer representation of the value
    • hasPermission

      public boolean hasPermission(GeyserSession session, String permission)
      Description copied from class: WorldManager
      Checks if the given session's player has a permission
      Overrides:
      hasPermission in class GeyserWorldManager
      Parameters:
      session - The session of the player to check the permission of
      permission - 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, and does 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