Package org.geysermc.geyser.session
Class GeyserSession
java.lang.Object
org.geysermc.geyser.session.GeyserSession
- All Implemented Interfaces:
org.geysermc.api.session.Connection,GeyserConnection,CommandSender
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeyserSession(GeyserImpl geyser, com.nukkitx.protocol.bedrock.BedrockServerSession bedrockServerSession, io.netty.channel.EventLoop eventLoop) -
Method Summary
Modifier and TypeMethodDescriptioncom.nukkitx.protocol.bedrock.data.AttributeDataAdjusts speed if the player is crawling.voidauthenticate(String username)voidauthenticate(String username, String password)voidPresent a form window to the user asking to log in with another web browservoidclose()voidconfirmTeleport(com.nukkitx.math.vector.Vector3d position)voidconnect()Send all necessary packets to load Bedrock into the serverprotected voidWill be overwritten for GeyserConnect.voiddisconnect(String reason)voidexecuteInEventLoop(Runnable runnable)Executes a task and prints a stack trace if an error occurs.Returns the locale of the command sender.intbooleanhasPermission(String permission)Checks if the given session's player has a permissionbooleanvoidlogin()name()voidrefreshEmotes(List<UUID> emotes)voidRemoves the following fog IDs from the client and the cache.scheduleInEventLoop(Runnable runnable, long duration, TimeUnit timeUnit)Schedules a task and prints a stack trace if an error occurs.voidSend an AdventureSettingsPacket to the client with the latest flagsvoidsendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)Send a packet to the remote server.voidSend the following fog IDs, as well as the cached ones, to the client.voidsendForm(org.geysermc.cumulus.form.Form form)voidsendForm(org.geysermc.cumulus.util.FormBuilder<?,?,?> formBuilder)voidsendGameRule(String gameRule, Object value)Send a gamerule value to the clientvoidSend a packet to the server to indicate client render distance, locale, skin parts, and hand preference.voidsendMessage(String message)voidsendUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)Queue a packet to be sent to player.voidsendUpstreamPacketImmediately(com.nukkitx.protocol.bedrock.BedrockPacket packet)Send a packet immediately to the player.voidsetAuthenticationData(AuthData authData)voidsetDaylightCycle(boolean doCycle)Changes the daylight cycle gamerule on the client This is used in the login screen along-side normal usagevoidsetFlying(boolean flying)voidsetReducedDebugInfo(boolean value)Update the cached value for the reduced debug info gamerule.voidsetServerRenderDistance(int renderDistance)voidsetSneaking(boolean sneaking)voidsetSwimming(boolean swimming)protected voidtick()Called every 50 milliseconds - one Minecraft tick.voidupdateStatistics(@NonNull Map<com.github.steveice10.mc.protocol.data.game.statistic.Statistic,Integer> statistics)Used for updating statistic values since we only get changes from the serveruuid()xuid()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geysermc.geyser.command.CommandSender
sendMessage
-
Field Details
-
sentSpawnPacket
protected boolean sentSpawnPacket
-
-
Constructor Details
-
GeyserSession
public GeyserSession(GeyserImpl geyser, com.nukkitx.protocol.bedrock.BedrockServerSession bedrockServerSession, io.netty.channel.EventLoop eventLoop)
-
-
Method Details
-
connect
public void connect()Send all necessary packets to load Bedrock into the server -
login
public void login() -
authenticate
-
authenticate
-
authenticateWithMicrosoftCode
public void authenticateWithMicrosoftCode()Present a form window to the user asking to log in with another web browser -
disconnect
-
close
public void close() -
executeInEventLoop
Executes a task and prints a stack trace if an error occurs. -
scheduleInEventLoop
Schedules a task and prints a stack trace if an error occurs. -
tick
protected void tick()Called every 50 milliseconds - one Minecraft tick. -
setAuthenticationData
-
setSneaking
public void setSneaking(boolean sneaking) -
setSwimming
public void setSwimming(boolean swimming) -
setFlying
public void setFlying(boolean flying) -
adjustSpeed
public com.nukkitx.protocol.bedrock.data.AttributeData adjustSpeed()Adjusts speed if the player is crawling.- Returns:
- not null if attributes should be updated.
-
disableSrvResolving
protected void disableSrvResolving()Will be overwritten for GeyserConnect. -
name
- Specified by:
namein interfaceCommandSender- Specified by:
namein interfaceorg.geysermc.api.session.Connection
-
uuid
- Specified by:
uuidin interfaceorg.geysermc.api.session.Connection
-
xuid
- Specified by:
xuidin interfaceorg.geysermc.api.session.Connection
-
sendMessage
- Specified by:
sendMessagein interfaceCommandSender
-
isConsole
public boolean isConsole()- Specified by:
isConsolein interfaceCommandSender- Returns:
- true if the specified sender is from the console.
-
getLocale
Description copied from interface:CommandSenderReturns the locale of the command sender. Defaults to the default locale atGeyserLocale.getDefaultLocale().- Specified by:
getLocalein interfaceCommandSender- Returns:
- the locale of the command sender.
-
setServerRenderDistance
public void setServerRenderDistance(int renderDistance) -
getSocketAddress
-
sendForm
public void sendForm(org.geysermc.cumulus.form.Form form) -
sendForm
public void sendForm(org.geysermc.cumulus.util.FormBuilder<?,?,?> formBuilder) -
getNextItemNetId
public int getNextItemNetId()- Returns:
- the next Bedrock item network ID to use for a new item
-
confirmTeleport
public void confirmTeleport(com.nukkitx.math.vector.Vector3d position) -
sendUpstreamPacket
public void sendUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)Queue a packet to be sent to player.- Parameters:
packet- the bedrock packet from the NukkitX protocol lib
-
sendUpstreamPacketImmediately
public void sendUpstreamPacketImmediately(com.nukkitx.protocol.bedrock.BedrockPacket packet)Send a packet immediately to the player.- Parameters:
packet- the bedrock packet from the NukkitX protocol lib
-
sendDownstreamPacket
public void sendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)Send a packet to the remote server.- Parameters:
packet- the java edition packet from MCProtocolLib
-
setReducedDebugInfo
public void setReducedDebugInfo(boolean value)Update the cached value for the reduced debug info gamerule. If enabled, also hides the player's coordinates.- Parameters:
value- The new value for reducedDebugInfo
-
setDaylightCycle
public void setDaylightCycle(boolean doCycle)Changes the daylight cycle gamerule on the client This is used in the login screen along-side normal usage- Parameters:
doCycle- If the cycle should continue
-
sendGameRule
Send a gamerule value to the client- Parameters:
gameRule- The gamerule to sendvalue- The value of the gamerule
-
hasPermission
Checks if the given session's player has a permission- Specified by:
hasPermissionin interfaceCommandSender- Parameters:
permission- The permission node to check- Returns:
- true if the player has the requested permission, false if not
-
sendAdventureSettings
public void sendAdventureSettings()Send an AdventureSettingsPacket to the client with the latest flags -
sendJavaClientSettings
public void sendJavaClientSettings()Send a packet to the server to indicate client render distance, locale, skin parts, and hand preference. -
updateStatistics
public void updateStatistics(@NonNull @NonNull Map<com.github.steveice10.mc.protocol.data.game.statistic.Statistic,Integer> statistics)Used for updating statistic values since we only get changes from the server- Parameters:
statistics- Updated statistics values
-
refreshEmotes
-
sendFog
Send the following fog IDs, as well as the cached ones, to the client. Fog IDs can be found here: https://wiki.bedrock.dev/documentation/fog-ids.html- Parameters:
fogNameSpaces- the fog ids to add
-
removeFog
Removes the following fog IDs from the client and the cache.- Parameters:
fogNameSpaces- the fog ids to remove
-