Java Code Examples for com.nukkitx.protocol.bedrock.packet.TextPacket#setXuid()
The following examples show how to use
com.nukkitx.protocol.bedrock.packet.TextPacket#setXuid() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextSerializer_v354.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, TextPacket packet) { TextPacket.Type type = TextPacket.Type.values()[buffer.readUnsignedByte()]; packet.setType(type); packet.setNeedsTranslation(buffer.readBoolean()); switch (type) { case CHAT: case WHISPER: case ANNOUNCEMENT: packet.setSourceName(BedrockUtils.readString(buffer)); case RAW: case TIP: case SYSTEM: packet.setMessage(BedrockUtils.readString(buffer)); break; case TRANSLATION: case POPUP: case JUKEBOX_POPUP: packet.setMessage(BedrockUtils.readString(buffer)); BedrockUtils.readArray(buffer, packet.getParameters(), BedrockUtils::readString); break; } packet.setXuid(BedrockUtils.readString(buffer)); packet.setPlatformChatId(BedrockUtils.readString(buffer)); }
Example 2
Source File: TextSerializer_v388.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, TextPacket packet) { TextPacket.Type type = TextPacket.Type.values()[buffer.readUnsignedByte()]; packet.setType(type); packet.setNeedsTranslation(buffer.readBoolean()); switch (type) { case CHAT: case WHISPER: case ANNOUNCEMENT: packet.setSourceName(BedrockUtils.readString(buffer)); case RAW: case TIP: case SYSTEM: packet.setMessage(BedrockUtils.readString(buffer)); break; case TRANSLATION: case POPUP: case JUKEBOX_POPUP: packet.setMessage(BedrockUtils.readString(buffer)); BedrockUtils.readArray(buffer, packet.getParameters(), BedrockUtils::readString); break; } packet.setXuid(BedrockUtils.readString(buffer)); packet.setPlatformChatId(BedrockUtils.readString(buffer)); }
Example 3
Source File: TextSerializer_v340.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, TextPacket packet) { TextPacket.Type type = TextPacket.Type.values()[buffer.readUnsignedByte()]; packet.setType(type); packet.setNeedsTranslation(buffer.readBoolean()); switch (type) { case CHAT: case WHISPER: case ANNOUNCEMENT: packet.setSourceName(BedrockUtils.readString(buffer)); case RAW: case TIP: case SYSTEM: packet.setMessage(BedrockUtils.readString(buffer)); break; case TRANSLATION: case POPUP: case JUKEBOX_POPUP: packet.setMessage(BedrockUtils.readString(buffer)); BedrockUtils.readArray(buffer, packet.getParameters(), BedrockUtils::readString); break; } packet.setXuid(BedrockUtils.readString(buffer)); packet.setPlatformChatId(BedrockUtils.readString(buffer)); }
Example 4
Source File: TextSerializer_v313.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, TextPacket packet) { TextPacket.Type type = TextPacket.Type.values()[buffer.readUnsignedByte()]; packet.setType(type); packet.setNeedsTranslation(buffer.readBoolean()); switch (type) { case CHAT: case WHISPER: case ANNOUNCEMENT: packet.setSourceName(BedrockUtils.readString(buffer)); case RAW: case TIP: case SYSTEM: packet.setMessage(BedrockUtils.readString(buffer)); break; case TRANSLATION: case POPUP: case JUKEBOX_POPUP: packet.setMessage(BedrockUtils.readString(buffer)); BedrockUtils.readArray(buffer, packet.getParameters(), BedrockUtils::readString); break; } packet.setXuid(BedrockUtils.readString(buffer)); packet.setPlatformChatId(BedrockUtils.readString(buffer)); }
Example 5
Source File: TextSerializer_v361.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, TextPacket packet) { TextPacket.Type type = TextPacket.Type.values()[buffer.readUnsignedByte()]; packet.setType(type); packet.setNeedsTranslation(buffer.readBoolean()); switch (type) { case CHAT: case WHISPER: case ANNOUNCEMENT: packet.setSourceName(BedrockUtils.readString(buffer)); case RAW: case TIP: case SYSTEM: packet.setMessage(BedrockUtils.readString(buffer)); break; case TRANSLATION: case POPUP: case JUKEBOX_POPUP: packet.setMessage(BedrockUtils.readString(buffer)); BedrockUtils.readArray(buffer, packet.getParameters(), BedrockUtils::readString); break; } packet.setXuid(BedrockUtils.readString(buffer)); packet.setPlatformChatId(BedrockUtils.readString(buffer)); }
Example 6
Source File: TextSerializer_v332.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, TextPacket packet) { TextPacket.Type type = TextPacket.Type.values()[buffer.readUnsignedByte()]; packet.setType(type); packet.setNeedsTranslation(buffer.readBoolean()); switch (type) { case CHAT: case WHISPER: case ANNOUNCEMENT: packet.setSourceName(BedrockUtils.readString(buffer)); case RAW: case TIP: case SYSTEM: packet.setMessage(BedrockUtils.readString(buffer)); break; case TRANSLATION: case POPUP: case JUKEBOX_POPUP: packet.setMessage(BedrockUtils.readString(buffer)); BedrockUtils.readArray(buffer, packet.getParameters(), BedrockUtils::readString); break; } packet.setXuid(BedrockUtils.readString(buffer)); packet.setPlatformChatId(BedrockUtils.readString(buffer)); }
Example 7
Source File: TextSerializer_v291.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, TextPacket packet) { TextPacket.Type type = TextPacket.Type.values()[buffer.readUnsignedByte()]; packet.setType(type); packet.setNeedsTranslation(buffer.readBoolean()); switch (type) { case CHAT: case WHISPER: case ANNOUNCEMENT: packet.setSourceName(BedrockUtils.readString(buffer)); case RAW: case TIP: case SYSTEM: packet.setMessage(BedrockUtils.readString(buffer)); break; case TRANSLATION: case POPUP: case JUKEBOX_POPUP: packet.setMessage(BedrockUtils.readString(buffer)); BedrockUtils.readArray(buffer, packet.getParameters(), BedrockUtils::readString); break; } packet.setXuid(BedrockUtils.readString(buffer)); packet.setPlatformChatId(BedrockUtils.readString(buffer)); }
Example 8
Source File: JavaChatTranslator.java From Geyser with MIT License | 5 votes |
@Override public void translate(ServerChatPacket packet, GeyserSession session) { TextPacket textPacket = new TextPacket(); textPacket.setPlatformChatId(""); textPacket.setSourceName(""); textPacket.setXuid(session.getAuthData().getXboxUUID()); switch (packet.getType()) { case CHAT: textPacket.setType(TextPacket.Type.CHAT); break; case SYSTEM: textPacket.setType(TextPacket.Type.SYSTEM); break; case NOTIFICATION: textPacket.setType(TextPacket.Type.TIP); break; default: textPacket.setType(TextPacket.Type.RAW); break; } String locale = session.getClientData().getLanguageCode(); if (packet.getMessage() instanceof TranslationMessage) { textPacket.setType(TextPacket.Type.TRANSLATION); textPacket.setNeedsTranslation(true); List<String> paramsTranslated = MessageUtils.getTranslationParams(((TranslationMessage) packet.getMessage()).getTranslationParams(), locale); textPacket.setParameters(paramsTranslated); textPacket.setMessage(MessageUtils.insertParams(MessageUtils.getTranslatedBedrockMessage(packet.getMessage(), locale, true), paramsTranslated)); } else { textPacket.setNeedsTranslation(false); textPacket.setMessage(MessageUtils.getTranslatedBedrockMessage(packet.getMessage(), locale, false)); } session.sendUpstreamPacket(textPacket); }