Title
This commit is contained in:
@@ -12,7 +12,9 @@ import mc.core.network.SCPacket;
|
||||
import mc.core.network.proto_1_12_2.packets.ChatMessageServerPacket;
|
||||
import mc.core.network.proto_1_12_2.packets.KeepAlivePacket;
|
||||
import mc.core.network.proto_1_12_2.packets.TimeUpdatePacket;
|
||||
import mc.core.network.proto_1_12_2.packets.TitlePacket;
|
||||
import mc.core.text.Text;
|
||||
import mc.core.text.Title;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -36,6 +38,33 @@ public class WrapperNetChannel implements NetChannel {
|
||||
writeAndFlush(new ChatMessageServerPacket(text, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTitle(Title title) {
|
||||
Text text = title.getTitle();
|
||||
if (text != null) write(new TitlePacket(TitlePacket.SET_TITLE, text));
|
||||
|
||||
text = title.getSubtitle();
|
||||
if (text != null) write(new TitlePacket(TitlePacket.SET_SUBTITLE, text));
|
||||
|
||||
text = title.getTextActionBar();
|
||||
if (text != null) write(new TitlePacket(TitlePacket.SET_ACTION_BAR, text));
|
||||
|
||||
Integer fadeIn = title.getFadeInTime();
|
||||
Integer stay = title.getStayTime();
|
||||
Integer fadeOut = title.getFadeOutTime();
|
||||
if (fadeIn != null && stay != null && fadeOut != null) {
|
||||
write(new TitlePacket(TitlePacket.SET_DISPLAY_TIME, fadeIn, stay, fadeOut));
|
||||
}
|
||||
|
||||
Boolean bool = title.getHide();
|
||||
if (bool != null && bool) write(new TitlePacket(TitlePacket.HIDE));
|
||||
|
||||
bool = title.getReset();
|
||||
if (bool != null && bool) write(new TitlePacket(TitlePacket.RESET));
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeAndFlush(SCPacket pkt) {
|
||||
channel.writeAndFlush(pkt);
|
||||
|
||||
Reference in New Issue
Block a user