Class PluginMessageEvent
- java.lang.Object
-
- com.velocitypowered.api.event.connection.PluginMessageEvent
-
- All Implemented Interfaces:
ResultedEvent<PluginMessageEvent.ForwardResult>
@AwaitingEvent public final class PluginMessageEvent extends Object implements ResultedEvent<PluginMessageEvent.ForwardResult>
This event is fired when a plugin message is sent to the proxy, either from a client (Player) or a server (ServerConnection). Velocity will wait on this event to finish firing before discarding the sent plugin message (if handled) or forwarding it to the server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPluginMessageEvent.ForwardResultA result determining whether or not to forward this message on.-
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
-
Constructor Summary
Constructors Constructor Description PluginMessageEvent(ChannelMessageSource source, ChannelMessageSink target, ChannelIdentifier identifier, byte[] data)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteArrayDataInputdataAsDataStream()ByteArrayInputStreamdataAsInputStream()byte[]getData()ChannelIdentifiergetIdentifier()PluginMessageEvent.ForwardResultgetResult()Returns the result associated with this event.ChannelMessageSourcegetSource()ChannelMessageSinkgetTarget()voidsetResult(PluginMessageEvent.ForwardResult result)Sets the result of this event.StringtoString()
-
-
-
Constructor Detail
-
PluginMessageEvent
public PluginMessageEvent(ChannelMessageSource source, ChannelMessageSink target, ChannelIdentifier identifier, byte[] data)
Creates a new instance.- Parameters:
source- the source of the plugin messagetarget- the destination of the plugin messageidentifier- the channel for this plugin messagedata- the payload of the plugin message
-
-
Method Detail
-
getResult
public PluginMessageEvent.ForwardResult getResult()
Description copied from interface:ResultedEventReturns the result associated with this event.- Specified by:
getResultin interfaceResultedEvent<PluginMessageEvent.ForwardResult>- Returns:
- the result of this event
-
setResult
public void setResult(PluginMessageEvent.ForwardResult result)
Description copied from interface:ResultedEventSets the result of this event. The result must be non-null.- Specified by:
setResultin interfaceResultedEvent<PluginMessageEvent.ForwardResult>- Parameters:
result- the new result
-
getSource
public ChannelMessageSource getSource()
-
getTarget
public ChannelMessageSink getTarget()
-
getIdentifier
public ChannelIdentifier getIdentifier()
-
getData
public byte[] getData()
-
dataAsInputStream
public ByteArrayInputStream dataAsInputStream()
-
dataAsDataStream
public ByteArrayDataInput dataAsDataStream()
-
-