Archived
0
This commit is contained in:
2018-06-24 16:37:51 +03:00
parent 222d14a24e
commit e4f7b6ba93
6 changed files with 181 additions and 0 deletions

View File

@@ -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);