狡诈师


用protocol发包
发送title,改显示时间没效果,仍然是默认的
  1.   PacketContainer mainTitle = new PacketContainer(PacketType.Play.Server.TITLE);
  2.                 mainTitle.getTitleActions().write(0, TitleAction.TITLE);
  3.                 mainTitle.getChatComponents().write(0, WrappedChatComponent.fromText(mainText));
  4.                 mainTitle.getIntegers().write(0, 0); // 改不改都没用
  5.                 mainTitle.getIntegers().write(1, 20); // 改不改都没用
  6.                 mainTitle.getIntegers().write(2, 0); // 改不改都没用
复制代码



john180
http://wiki.vg/Protocol#Title
设定时间的封包和设定Title的封包是分开的,不能合在一起发的.
设定时间的封包得另外发
  1. PacketContainer timeTitle = new PacketContainer(PacketType.Play.Server.TITLE);
  2. timeTitle.getTitleActions().write(0, TitleAction.TIME);
  3. timeTitle.getIntegers().write(0, 0);
  4. timeTitle.getIntegers().write(1, 20);
  5. timeTitle.getIntegers().write(2, 0);
复制代码

大概是这样


狡诈师
john180 发表于 2018-4-20 20:09
http://wiki.vg/Protocol#Title
设定时间的封包和设定Title的封包是分开的,不能合在一起发的.
设定时间的封 ...

谢谢,原来如此(刚跟着站内教程学的,那贴貌似没讲)

john180
爱国民主 发表于 2018-4-20 20:43
谢谢,原来如此(刚跟着站内教程学的,那贴貌似没讲)

Bukkit本身就封装了这个功能,你干嘛非要用protocolLib实现

狡诈师
john180 发表于 2018-4-20 21:28
Bukkit本身就封装了这个功能,你干嘛非要用protocolLib实现

貌似被弃用了吧(划线),有人说有时不显示(有时没收到title)

Hai_tun
爱国民主 发表于 2018-4-20 22:13
貌似被弃用了吧(划线),有人说有时不显示(有时没收到title)

就1.8有点用,其他版本真的没啥用...