Class ServerLoginPluginMessageEvent
java.lang.Object
com.velocitypowered.api.event.player.ServerLoginPluginMessageEvent
- All Implemented Interfaces:
ResultedEvent<ServerLoginPluginMessageEvent.ResponseResult>
@AwaitingEvent
public class ServerLoginPluginMessageEvent
extends Object
implements ResultedEvent<ServerLoginPluginMessageEvent.ResponseResult>
Fired when a server sends a login plugin message to the proxy. Plugins have the opportunity to
respond to the messages as needed. Velocity will wait on this event to finish. The server will
be responsible for continuing the login process once the server is satisfied with any login
plugin responses sent by proxy plugins (or messages indicating a lack of response).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe result class, containing a response to the login plugin message sent by the server.Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result -
Constructor Summary
ConstructorsConstructorDescriptionServerLoginPluginMessageEvent(ServerConnection connection, ChannelIdentifier identifier, byte[] contents, int sequenceId) Constructs a newServerLoginPluginMessageEvent. -
Method Summary
Modifier and TypeMethodDescriptionReturns the contents of the login plugin message sent by the server as anByteArrayDataInput.Returns the contents of the login plugin message sent by the server as anInputStream.Gets the connection from which the login plugin message was received.byte[]Returns a copy of the contents contained in the login plugin message sent by the server.Gets the identifier of the channel this login plugin message was sent on.Gets the currentServerLoginPluginMessageEvent.ResponseResultassociated with this plugin message event.intGets the sequence ID of the plugin message sent by the server.voidSets theServerLoginPluginMessageEvent.ResponseResultfor this plugin message event.toString()Returns a string representation of thisServerLoginPluginMessageEvent.
-
Constructor Details
-
ServerLoginPluginMessageEvent
public ServerLoginPluginMessageEvent(ServerConnection connection, ChannelIdentifier identifier, byte[] contents, int sequenceId) Constructs a newServerLoginPluginMessageEvent.- Parameters:
connection- the connection on which the plugin message was sentidentifier- the channel identifier for the message sentcontents- the contents of the messagesequenceId- the ID of the message
-
-
Method Details
-
getResult
Gets the currentServerLoginPluginMessageEvent.ResponseResultassociated with this plugin message event.If the result is
ServerLoginPluginMessageEvent.ResponseResult.unknown(), the proxy will indicate that it did not handle the plugin message and will return a negative response to the backend server.- Specified by:
getResultin interfaceResultedEvent<ServerLoginPluginMessageEvent.ResponseResult>- Returns:
- the result of this event
-
setResult
Sets theServerLoginPluginMessageEvent.ResponseResultfor this plugin message event.Use
ServerLoginPluginMessageEvent.ResponseResult.reply(byte[])to respond with data, orServerLoginPluginMessageEvent.ResponseResult.unknown()to indicate that the plugin message was not handled.- Specified by:
setResultin interfaceResultedEvent<ServerLoginPluginMessageEvent.ResponseResult>- Parameters:
result- the new result to apply to this event- Throws:
NullPointerException- ifresultis null
-
getConnection
Gets the connection from which the login plugin message was received.- Returns:
- the server connection
-
getIdentifier
Gets the identifier of the channel this login plugin message was sent on.- Returns:
- the channel identifier
-
getContents
public byte[] getContents()Returns a copy of the contents contained in the login plugin message sent by the server.- Returns:
- the contents of the message
-
contentsAsInputStream
Returns the contents of the login plugin message sent by the server as anInputStream.- Returns:
- the contents of the message as a stream
-
contentsAsDataStream
Returns the contents of the login plugin message sent by the server as anByteArrayDataInput.- Returns:
- the contents of the message as a
DataInput
-
getSequenceId
public int getSequenceId()Gets the sequence ID of the plugin message sent by the server.- Returns:
- the sequence ID
-
toString
Returns a string representation of thisServerLoginPluginMessageEvent.The output includes the connection, message channel identifier, sequence ID, base-16 encoded message content, and the current response result.
-