增加弹幕推送流的数据包类型 CUT_OFF

This commit is contained in:
czp 2018-03-13 23:48:00 +08:00
parent 44fc73108f
commit f585e2be75
5 changed files with 63 additions and 0 deletions

View File

@ -321,6 +321,7 @@ API 文档
| ActivityEventPackageEvent | 收到 ACTIVITY_EVENT 数据包 |
| ConnectionCloseEvent | 连接断开(主动或被动) |
| ConnectSucceedEvent | 进房成功 |
| CutOffPackageEvent | 收到 CUT_OFF 数据包 |
| DanMuMsgPackageEvent | 收到 DANMU_MSG 数据包 |
| EventCmdPackageEvent | 收到 EVENT_CMD 数据包 |
| GuardBuyPackageEvent | 收到 GUARD_BUY 数据包 |

View File

@ -0,0 +1,5 @@
{
"cmd": "CUT_OFF",
"msg": "禁播游戏",
"roomid": 8446134
}

View File

@ -0,0 +1,43 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class CutOffEntity implements DataEntity {
/**
* cmd : CUT_OFF
* msg : 禁播游戏
* roomid : 8446134
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("msg")
private String msg;
@SerializedName("roomid")
private int roomid;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getRoomid() {
return roomid;
}
public void setRoomid(int roomid) {
this.roomid = roomid;
}
}

View File

@ -0,0 +1,9 @@
package com.hiczp.bilibili.api.live.socket.event;
import com.hiczp.bilibili.api.live.socket.entity.CutOffEntity;
public class CutOffPackageEvent extends ReceiveDataPackageEvent<CutOffEntity> {
public CutOffPackageEvent(Object source, CutOffEntity entity) {
super(source, entity);
}
}

View File

@ -192,6 +192,11 @@ public class LiveClientHandler extends SimpleChannelInboundHandler<Package> {
eventCreationExpression = () -> new RoomShieldPackageEvent(this, GSON.fromJson(jsonObject, RoomShieldEntity.class));
}
break;
// B站 管理员强制中断
case "CUT_OFF": {
eventCreationExpression = () -> new CutOffPackageEvent(this, GSON.fromJson(jsonObject, CutOffEntity.class));
}
break;
default: {
LOGGER.error("Received unknown json below: \n{}", formatJson(jsonObject));
eventCreationExpression = () -> new UnknownPackageEvent(this, jsonObject);