Search in sources :

Example 1 with SetTitlePacket

use of org.dragonet.protocol.packets.SetTitlePacket in project DragonProxy by DragonetMC.

the class PCSetTitlePacketTranslator method translate.

@Override
public PEPacket[] translate(UpstreamSession session, ServerTitlePacket packet) {
    SetTitlePacket titlePacket = new SetTitlePacket();
    switch(packet.getAction()) {
        case ACTION_BAR:
            titlePacket.action = SetTitlePacket.SET_ACTIONBAR;
            titlePacket.text = packet.getActionBar().getFullText();
            break;
        case TITLE:
            titlePacket.action = SetTitlePacket.SET_TITLE;
            titlePacket.text = packet.getTitle().getText();
            break;
        case SUBTITLE:
            titlePacket.action = SetTitlePacket.SET_SUBTITLE;
            titlePacket.text = packet.getSubtitle().getText();
            break;
        case RESET:
        case CLEAR:
            titlePacket.action = SetTitlePacket.RESET;
            titlePacket.text = "";
            break;
        default:
            return null;
    }
    titlePacket.fadeIn = packet.getFadeIn();
    titlePacket.fadeOut = packet.getFadeOut();
    titlePacket.stay = packet.getStay();
    return new PEPacket[] { titlePacket };
}
Also used : PEPacket(org.dragonet.protocol.PEPacket) SetTitlePacket(org.dragonet.protocol.packets.SetTitlePacket)

Aggregations

PEPacket (org.dragonet.protocol.PEPacket)1 SetTitlePacket (org.dragonet.protocol.packets.SetTitlePacket)1