Package io.github.kosmx.emotes.api.proxy
Interface INetworkInstance
- All Known Implementing Classes:
AbstractNetworkInstance
public interface INetworkInstance
To hold information about network
implement AbstractNetworkInstance if you want to implement only the necessary functions
use this interface if you want to do something completely different
-
Method Summary
Modifier and TypeMethodDescriptionGet the version from the other side.booleanisActive()Is the other side is available your send won't be invoke if you return falsebooleanDoes the track the emote play state of every player -> true The client has to resend the emote if a new player get close -> falsedefault intMaximum size of the data what the instance can senddefault voidDeprecated.communication changesdefault voidreceiveMessage(ByteBuffer byteBuffer, UUID player) Network instance has received a message, it will send it to EmoteX core to execute you can set your receive event to invoke this there are it's other forms inAbstractNetworkInstancestatic byte[]safeGetBytesFromBuffer(ByteBuffer byteBuffer) IfByteBufferis wrapped, it is safe to get the array but if is direct manual read is required.default voidsendC2SConfig(Consumer<EmotePacket.Builder> consumer) Client is sending config message to server.voidsendMessage(EmotePacket.Builder builder, @Nullable UUID target) The Proxy controller ask you to send the message, only ifisActive()is truedefault booleanDo send the sender's id to the servervoidsetVersions(HashMap<Byte, Byte> map) Receive (and save) versions from the other sidedefault booleanwhen receiving a message, it contains a player.
-
Method Details
-
getRemoteVersions
Get the version from the other side. null if default the map doesn't have to contain information about every module. these will be added automatically.do
HashMap#put(3, 0)to disable sound streaming. NBS can't be optimized and often very large- Returns:
- maybe null
-
setVersions
Receive (and save) versions from the other side- Parameters:
map- map
-
presenceResponse
Deprecated.communication changesInvoked after receiving the presence packetsetVersions(HashMap)Used to send server-side config/emotes -
sendPlayerID
default boolean sendPlayerID()Do send the sender's id to the server- Returns:
- true means send
-
sendMessage
The Proxy controller ask you to send the message, only ifisActive()is true- Parameters:
builder- packet buildertarget- target to send message, if null, everyone in the view distance on server-side target will be ignored- Throws:
IOException- when message write to bytes has failed
-
receiveMessage
Network instance has received a message, it will send it to EmoteX core to execute you can set your receive event to invoke this there are it's other forms inAbstractNetworkInstance- Parameters:
byteBuffer- received bufferplayer- player who plays the emote, Can be NULL but only iftrustReceivedPlayer()is true or message is not play or stop
-
sendC2SConfig
Client is sending config message to server. Vanilla clients will answer to the server configuration phase message. This might get invoked multiple times on the same network instance. -
trustReceivedPlayer
default boolean trustReceivedPlayer()when receiving a message, it contains a player. If you don't trust in this information, override this and return false- Returns:
- false if received info is untrusted
-
isActive
boolean isActive()Is the other side is available your send won't be invoke if you return false- Returns:
- is this channel working
-
isServerTrackingPlayState
boolean isServerTrackingPlayState()Does the track the emote play state of every player -> true The client has to resend the emote if a new player get close -> false -
maxDataSize
default int maxDataSize()Maximum size of the data what the instance can sendDefaults to
CommonData.MAX_PACKET_SIZE- Returns:
- max size of bytes[]
-
safeGetBytesFromBuffer
IfByteBufferis wrapped, it is safe to get the array but if is direct manual read is required.- Parameters:
byteBuffer- get the bytes from- Returns:
- the byte array
-