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

This commit is contained in:
czp 2018-03-13 23:43:59 +08:00
parent 4b4ee68cfc
commit 44fc73108f
5 changed files with 93 additions and 0 deletions

View File

@ -332,6 +332,7 @@ API 文档
| ReceiveDataPackageDebugEvent | 该事件用于调试, 收到任何 Data 数据包时都会触发 |
| RoomAdminsPackageEvent | 收到 ROOM_ADMINS 数据包 |
| RoomBlockMsgPackageEvent | 收到 ROOM_BLOCK_MSG 数据包 |
| RoomShieldPackageEvent | 收到 ROOM_SHIELD 数据包 |
| RoomSilentOffPackageEvent | 收到 ROOM_SILENT_OFF 数据包 |
| RoomSilentOnPackageEvent | 收到 ROOM_SILENT_ON 数据包 |
| SendGiftPackageEvent | 收到 SEND_GIFT 数据包 |

View File

@ -0,0 +1,11 @@
{
"cmd": "ROOM_SHIELD",
"type": 1,
"user": [],
"keyword": [
"暗号",
"摄像头",
"色相头"
],
"roomid": 505447
}

View File

@ -0,0 +1,67 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class RoomShieldEntity implements DataEntity {
/**
* cmd : ROOM_SHIELD
* type : 1
* user : []
* keyword : ["暗号","摄像头","色相头"]
* roomid : 505447
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("type")
private int type;
@SerializedName("roomid")
private long roomid;
@SerializedName("user")
private List<String> user;
@SerializedName("keyword")
private List<String> keyword;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public long getRoomid() {
return roomid;
}
public void setRoomid(long roomid) {
this.roomid = roomid;
}
public List<String> getUser() {
return user;
}
public void setUser(List<String> user) {
this.user = user;
}
public List<String> getKeyword() {
return keyword;
}
public void setKeyword(List<String> keyword) {
this.keyword = keyword;
}
}

View File

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

View File

@ -187,6 +187,11 @@ public class LiveClientHandler extends SimpleChannelInboundHandler<Package> {
eventCreationExpression = () -> new PreparingPackageEvent(this, GSON.fromJson(jsonObject, PreparingEntity.class));
}
break;
//房间屏蔽
case "ROOM_SHIELD": {
eventCreationExpression = () -> new RoomShieldPackageEvent(this, GSON.fromJson(jsonObject, RoomShieldEntity.class));
}
break;
default: {
LOGGER.error("Received unknown json below: \n{}", formatJson(jsonObject));
eventCreationExpression = () -> new UnknownPackageEvent(this, jsonObject);