diff --git a/README.md b/README.md index 6ca616c..081e520 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ # 添加依赖 ## Gradle - compile group: 'com.hiczp', name: 'bilibili-api', version: '0.0.17' + compile group: 'com.hiczp', name: 'bilibili-api', version: '0.0.18' # 名词解释 B站不少参数都是瞎取的, 并且不统一, 经常混用, 以下给出一些常见参数对应的含义 @@ -329,9 +329,12 @@ API 文档 | GuardBuyPackageEvent | 收到 GUARD_BUY 数据包 | | GuardMsgPackageEvent | 收到 GUARD_MSG 数据包 | | LivePackageEvent | 收到 LIVE 数据包 | +| PkEndPackageEvent | 收到 PK_END 数据包 | | PkMatchPackageEvent | 收到 PK_MATCH 数据包 | | PkMicEndPackageEvent | 收到 PK_MIC_END 数据包 | | PkPrePackageEvent | 收到 PK_PRE 数据包 | +| PkProcessPackageEvent | 收到 PK_PROCESS 数据包 | +| PkSettlePackageEvent | 收到 PK_SETTLE 数据包 | | PkStartPackageEvent | 收到 PK_START 数据包 | | PreparingPackageEvent | 收到 PREPARING 数据包 | | RaffleEndPackageEvent | 收到 RAFFLE_END 数据包 | diff --git a/build.gradle b/build.gradle index 6ec8e6f..8a6147d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group = 'com.hiczp' -version = '0.0.17' +version = '0.0.18' description = 'Bilibili android client API library written in Java' apply plugin: 'idea' diff --git a/record/bullet_screen_stream_json/PK_END.json b/record/bullet_screen_stream_json/PK_END.json new file mode 100644 index 0000000..009151b --- /dev/null +++ b/record/bullet_screen_stream_json/PK_END.json @@ -0,0 +1,10 @@ +{ + "cmd": "PK_END", + "pk_id": 8797, + "pk_status": 400, + "data": { + "init_id": 8049573, + "match_id": 1409458, + "punish_topic": "惩罚:模仿面筋哥" + } +} diff --git a/record/bullet_screen_stream_json/PK_PROCESS.json b/record/bullet_screen_stream_json/PK_PROCESS.json new file mode 100644 index 0000000..62f1517 --- /dev/null +++ b/record/bullet_screen_stream_json/PK_PROCESS.json @@ -0,0 +1,12 @@ +{ + "cmd": "PK_PROCESS", + "pk_id": 8798, + "pk_status": 300, + "data": { + "uid": 0, + "init_votes": 30, + "match_votes": 20, + "user_votes": 0 + }, + "roomid": 346075 +} diff --git a/record/bullet_screen_stream_json/PK_SETTLE.json b/record/bullet_screen_stream_json/PK_SETTLE.json new file mode 100644 index 0000000..1fd27b1 --- /dev/null +++ b/record/bullet_screen_stream_json/PK_SETTLE.json @@ -0,0 +1,69 @@ +{ + "cmd": "PK_SETTLE", + "pk_id": 8806, + "pk_status": 400, + "data": { + "pk_id": 8806, + "init_info": { + "uid": 7799328, + "init_id": 10979759, + "uname": "筱宇淅淅", + "face": "http://i0.hdslb.com/bfs/face/e16515ac39329aa125bb8de5bb1fa9455f06337c.jpg", + "votes": 0, + "is_winner": false + }, + "match_info": { + "uid": 18654316, + "match_id": 430063, + "uname": "卖丸子尕害羞", + "face": "http://i1.hdslb.com/bfs/face/1c579a244ec0c66bbb6e2ad6c770a2a498268735.jpg", + "votes": 129, + "is_winner": true, + "vip_type": 0, + "exp": { + "color": 5805790, + "user_level": 31, + "master_level": { + "level": 26, + "color": 10512625 + } + }, + "vip": { + "vip": 0, + "svip": 0 + }, + "face_frame": "", + "badge": { + "url": "http://i0.hdslb.com/bfs/live/74b2f9a48ce14d752dd27559c4a0df297243a3fd.png", + "desc": "bilibili直播签约主播\r\n", + "position": 3 + } + }, + "best_user": { + "uid": 31459309, + "uname": "七友球球", + "face": "http://i1.hdslb.com/bfs/face/09406a4fe632dda9d523da14f3e3735ee02efbab.jpg", + "vip_type": 0, + "exp": { + "color": 6406234, + "user_level": 19, + "master_level": { + "level": 1, + "color": 6406234 + } + }, + "vip": { + "vip": 0, + "svip": 0 + }, + "privilege_type": 0, + "face_frame": "", + "badge": { + "url": "", + "desc": "", + "position": 0 + } + }, + "punish_topic": "惩罚:模仿一款表情包" + } +} diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkEndEntity.java b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkEndEntity.java new file mode 100644 index 0000000..bc4fae1 --- /dev/null +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkEndEntity.java @@ -0,0 +1,93 @@ +package com.hiczp.bilibili.api.live.socket.entity; + +import com.google.gson.annotations.SerializedName; + +public class PkEndEntity implements DataEntity { + /** + * cmd : PK_END + * pk_id : 8797 + * pk_status : 400 + * data : {"init_id":8049573,"match_id":1409458,"punish_topic":"惩罚:模仿面筋哥"} + */ + + @SerializedName("cmd") + private String cmd; + @SerializedName("pk_id") + private long pkId; + @SerializedName("pk_status") + private int pkStatus; + @SerializedName("data") + private Data data; + + @Override + public String getCmd() { + return cmd; + } + + public void setCmd(String cmd) { + this.cmd = cmd; + } + + public long getPkId() { + return pkId; + } + + public void setPkId(long pkId) { + this.pkId = pkId; + } + + public int getPkStatus() { + return pkStatus; + } + + public void setPkStatus(int pkStatus) { + this.pkStatus = pkStatus; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public static class Data { + /** + * init_id : 8049573 + * match_id : 1409458 + * punish_topic : 惩罚:模仿面筋哥 + */ + + @SerializedName("init_id") + private long initId; + @SerializedName("match_id") + private long matchId; + @SerializedName("punish_topic") + private String punishTopic; + + public long getInitId() { + return initId; + } + + public void setInitId(long initId) { + this.initId = initId; + } + + public long getMatchId() { + return matchId; + } + + public void setMatchId(long matchId) { + this.matchId = matchId; + } + + public String getPunishTopic() { + return punishTopic; + } + + public void setPunishTopic(String punishTopic) { + this.punishTopic = punishTopic; + } + } +} diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkProcessEntity.java b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkProcessEntity.java new file mode 100644 index 0000000..8415239 --- /dev/null +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkProcessEntity.java @@ -0,0 +1,115 @@ +package com.hiczp.bilibili.api.live.socket.entity; + +import com.google.gson.annotations.SerializedName; + +public class PkProcessEntity implements DataEntity { + /** + * cmd : PK_PROCESS + * pk_id : 8798 + * pk_status : 300 + * data : {"uid":0,"init_votes":30,"match_votes":20,"user_votes":0} + * roomid : 346075 + */ + + @SerializedName("cmd") + private String cmd; + @SerializedName("pk_id") + private long pkId; + @SerializedName("pk_status") + private int pkStatus; + @SerializedName("data") + private Data data; + @SerializedName("roomid") + private long roomId; + + @Override + public String getCmd() { + return cmd; + } + + public void setCmd(String cmd) { + this.cmd = cmd; + } + + public long getPkId() { + return pkId; + } + + public void setPkId(long pkId) { + this.pkId = pkId; + } + + public int getPkStatus() { + return pkStatus; + } + + public void setPkStatus(int pkStatus) { + this.pkStatus = pkStatus; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public long getRoomId() { + return roomId; + } + + public void setRoomId(long roomId) { + this.roomId = roomId; + } + + public static class Data { + /** + * uid : 0 + * init_votes : 30 + * match_votes : 20 + * user_votes : 0 + */ + + @SerializedName("uid") + private int userId; + @SerializedName("init_votes") + private int initVotes; + @SerializedName("match_votes") + private int matchVotes; + @SerializedName("user_votes") + private int userVotes; + + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + public int getInitVotes() { + return initVotes; + } + + public void setInitVotes(int initVotes) { + this.initVotes = initVotes; + } + + public int getMatchVotes() { + return matchVotes; + } + + public void setMatchVotes(int matchVotes) { + this.matchVotes = matchVotes; + } + + public int getUserVotes() { + return userVotes; + } + + public void setUserVotes(int userVotes) { + this.userVotes = userVotes; + } + } +} diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkSettleEntity.java b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkSettleEntity.java new file mode 100644 index 0000000..16d0ea6 --- /dev/null +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/PkSettleEntity.java @@ -0,0 +1,688 @@ +package com.hiczp.bilibili.api.live.socket.entity; + +import com.google.gson.annotations.SerializedName; + +public class PkSettleEntity implements DataEntity { + /** + * cmd : PK_SETTLE + * pk_id : 8806 + * pk_status : 400 + * data : {"pk_id":8806,"init_info":{"uid":7799328,"init_id":10979759,"uname":"筱宇淅淅","face":"http://i0.hdslb.com/bfs/face/e16515ac39329aa125bb8de5bb1fa9455f06337c.jpg","votes":0,"is_winner":false},"match_info":{"uid":18654316,"match_id":430063,"uname":"卖丸子尕害羞","face":"http://i1.hdslb.com/bfs/face/1c579a244ec0c66bbb6e2ad6c770a2a498268735.jpg","votes":129,"is_winner":true,"vip_type":0,"exp":{"color":5805790,"user_level":31,"master_level":{"level":26,"color":10512625}},"vip":{"vip":0,"svip":0},"face_frame":"","badge":{"url":"http://i0.hdslb.com/bfs/live/74b2f9a48ce14d752dd27559c4a0df297243a3fd.png","desc":"bilibili直播签约主播\r\n","position":3}},"best_user":{"uid":31459309,"uname":"七友球球","face":"http://i1.hdslb.com/bfs/face/09406a4fe632dda9d523da14f3e3735ee02efbab.jpg","vip_type":0,"exp":{"color":6406234,"user_level":19,"master_level":{"level":1,"color":6406234}},"vip":{"vip":0,"svip":0},"privilege_type":0,"face_frame":"","badge":{"url":"","desc":"","position":0}},"punish_topic":"惩罚:模仿一款表情包"} + */ + + @SerializedName("cmd") + private String cmd; + @SerializedName("pk_id") + private long pkId; + @SerializedName("pk_status") + private int pkStatus; + @SerializedName("data") + private Data data; + + @Override + public String getCmd() { + return cmd; + } + + public void setCmd(String cmd) { + this.cmd = cmd; + } + + public long getPkId() { + return pkId; + } + + public void setPkId(long pkId) { + this.pkId = pkId; + } + + public int getPkStatus() { + return pkStatus; + } + + public void setPkStatus(int pkStatus) { + this.pkStatus = pkStatus; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public static class Data { + /** + * pk_id : 8806 + * init_info : {"uid":7799328,"init_id":10979759,"uname":"筱宇淅淅","face":"http://i0.hdslb.com/bfs/face/e16515ac39329aa125bb8de5bb1fa9455f06337c.jpg","votes":0,"is_winner":false} + * match_info : {"uid":18654316,"match_id":430063,"uname":"卖丸子尕害羞","face":"http://i1.hdslb.com/bfs/face/1c579a244ec0c66bbb6e2ad6c770a2a498268735.jpg","votes":129,"is_winner":true,"vip_type":0,"exp":{"color":5805790,"user_level":31,"master_level":{"level":26,"color":10512625}},"vip":{"vip":0,"svip":0},"face_frame":"","badge":{"url":"http://i0.hdslb.com/bfs/live/74b2f9a48ce14d752dd27559c4a0df297243a3fd.png","desc":"bilibili直播签约主播\r\n","position":3}} + * best_user : {"uid":31459309,"uname":"七友球球","face":"http://i1.hdslb.com/bfs/face/09406a4fe632dda9d523da14f3e3735ee02efbab.jpg","vip_type":0,"exp":{"color":6406234,"user_level":19,"master_level":{"level":1,"color":6406234}},"vip":{"vip":0,"svip":0},"privilege_type":0,"face_frame":"","badge":{"url":"","desc":"","position":0}} + * punish_topic : 惩罚:模仿一款表情包 + */ + + @SerializedName("pk_id") + private long pkId; + @SerializedName("init_info") + private InitInfo initInfo; + @SerializedName("match_info") + private MatchInfo matchInfo; + @SerializedName("best_user") + private BestUser bestUser; + @SerializedName("punish_topic") + private String punishTopic; + + public long getPkId() { + return pkId; + } + + public void setPkId(long pkId) { + this.pkId = pkId; + } + + public InitInfo getInitInfo() { + return initInfo; + } + + public void setInitInfo(InitInfo initInfo) { + this.initInfo = initInfo; + } + + public MatchInfo getMatchInfo() { + return matchInfo; + } + + public void setMatchInfo(MatchInfo matchInfo) { + this.matchInfo = matchInfo; + } + + public BestUser getBestUser() { + return bestUser; + } + + public void setBestUser(BestUser bestUser) { + this.bestUser = bestUser; + } + + public String getPunishTopic() { + return punishTopic; + } + + public void setPunishTopic(String punishTopic) { + this.punishTopic = punishTopic; + } + + public static class InitInfo { + /** + * uid : 7799328 + * init_id : 10979759 + * uname : 筱宇淅淅 + * face : http://i0.hdslb.com/bfs/face/e16515ac39329aa125bb8de5bb1fa9455f06337c.jpg + * votes : 0 + * is_winner : false + */ + + @SerializedName("uid") + private long userId; + @SerializedName("init_id") + private long initId; + @SerializedName("uname") + private String username; + @SerializedName("face") + private String face; + @SerializedName("votes") + private int votes; + @SerializedName("is_winner") + private boolean isWinner; + + public long getUserId() { + return userId; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public long getInitId() { + return initId; + } + + public void setInitId(long initId) { + this.initId = initId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getFace() { + return face; + } + + public void setFace(String face) { + this.face = face; + } + + public int getVotes() { + return votes; + } + + public void setVotes(int votes) { + this.votes = votes; + } + + public boolean isIsWinner() { + return isWinner; + } + + public void setIsWinner(boolean isWinner) { + this.isWinner = isWinner; + } + } + + public static class MatchInfo { + /** + * uid : 18654316 + * match_id : 430063 + * uname : 卖丸子尕害羞 + * face : http://i1.hdslb.com/bfs/face/1c579a244ec0c66bbb6e2ad6c770a2a498268735.jpg + * votes : 129 + * is_winner : true + * vip_type : 0 + * exp : {"color":5805790,"user_level":31,"master_level":{"level":26,"color":10512625}} + * vip : {"vip":0,"svip":0} + * face_frame : + * badge : {"url":"http://i0.hdslb.com/bfs/live/74b2f9a48ce14d752dd27559c4a0df297243a3fd.png","desc":"bilibili直播签约主播\r\n","position":3} + */ + + @SerializedName("uid") + private long userId; + @SerializedName("match_id") + private long matchId; + @SerializedName("uname") + private String username; + @SerializedName("face") + private String face; + @SerializedName("votes") + private int votes; + @SerializedName("is_winner") + private boolean isWinner; + @SerializedName("vip_type") + private int vipType; + @SerializedName("exp") + private Exp exp; + @SerializedName("vip") + private Vip vip; + @SerializedName("face_frame") + private String faceFrame; + @SerializedName("badge") + private Badge badge; + + public long getUserId() { + return userId; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public long getMatchId() { + return matchId; + } + + public void setMatchId(long matchId) { + this.matchId = matchId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getFace() { + return face; + } + + public void setFace(String face) { + this.face = face; + } + + public int getVotes() { + return votes; + } + + public void setVotes(int votes) { + this.votes = votes; + } + + public boolean isIsWinner() { + return isWinner; + } + + public void setIsWinner(boolean isWinner) { + this.isWinner = isWinner; + } + + public int getVipType() { + return vipType; + } + + public void setVipType(int vipType) { + this.vipType = vipType; + } + + public Exp getExp() { + return exp; + } + + public void setExp(Exp exp) { + this.exp = exp; + } + + public Vip getVip() { + return vip; + } + + public void setVip(Vip vip) { + this.vip = vip; + } + + public String getFaceFrame() { + return faceFrame; + } + + public void setFaceFrame(String faceFrame) { + this.faceFrame = faceFrame; + } + + public Badge getBadge() { + return badge; + } + + public void setBadge(Badge badge) { + this.badge = badge; + } + + public static class Exp { + /** + * color : 5805790 + * user_level : 31 + * master_level : {"level":26,"color":10512625} + */ + + @SerializedName("color") + private int color; + @SerializedName("user_level") + private int userLevel; + @SerializedName("master_level") + private MasterLevel masterLevel; + + public int getColor() { + return color; + } + + public void setColor(int color) { + this.color = color; + } + + public int getUserLevel() { + return userLevel; + } + + public void setUserLevel(int userLevel) { + this.userLevel = userLevel; + } + + public MasterLevel getMasterLevel() { + return masterLevel; + } + + public void setMasterLevel(MasterLevel masterLevel) { + this.masterLevel = masterLevel; + } + + public static class MasterLevel { + /** + * level : 26 + * color : 10512625 + */ + + @SerializedName("level") + private int level; + @SerializedName("color") + private int color; + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getColor() { + return color; + } + + public void setColor(int color) { + this.color = color; + } + } + } + + public static class Vip { + /** + * vip : 0 + * svip : 0 + */ + + @SerializedName("vip") + private int vip; + @SerializedName("svip") + private int svip; + + public int getVip() { + return vip; + } + + public void setVip(int vip) { + this.vip = vip; + } + + public int getSvip() { + return svip; + } + + public void setSvip(int svip) { + this.svip = svip; + } + } + + public static class Badge { + /** + * url : http://i0.hdslb.com/bfs/live/74b2f9a48ce14d752dd27559c4a0df297243a3fd.png + * desc : bilibili直播签约主播 + *

+ * position : 3 + */ + + @SerializedName("url") + private String url; + @SerializedName("desc") + private String description; + @SerializedName("position") + private int position; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + } + } + + public static class BestUser { + /** + * uid : 31459309 + * uname : 七友球球 + * face : http://i1.hdslb.com/bfs/face/09406a4fe632dda9d523da14f3e3735ee02efbab.jpg + * vip_type : 0 + * exp : {"color":6406234,"user_level":19,"master_level":{"level":1,"color":6406234}} + * vip : {"vip":0,"svip":0} + * privilege_type : 0 + * face_frame : + * badge : {"url":"","desc":"","position":0} + */ + + @SerializedName("uid") + private long userId; + @SerializedName("uname") + private String username; + @SerializedName("face") + private String face; + @SerializedName("vip_type") + private int vipType; + @SerializedName("exp") + private ExpX exp; + @SerializedName("vip") + private VipX vip; + @SerializedName("privilege_type") + private int privilegeType; + @SerializedName("face_frame") + private String faceFrame; + @SerializedName("badge") + private BadgeX badge; + + public long getUserId() { + return userId; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getFace() { + return face; + } + + public void setFace(String face) { + this.face = face; + } + + public int getVipType() { + return vipType; + } + + public void setVipType(int vipType) { + this.vipType = vipType; + } + + public ExpX getExp() { + return exp; + } + + public void setExp(ExpX exp) { + this.exp = exp; + } + + public VipX getVip() { + return vip; + } + + public void setVip(VipX vip) { + this.vip = vip; + } + + public int getPrivilegeType() { + return privilegeType; + } + + public void setPrivilegeType(int privilegeType) { + this.privilegeType = privilegeType; + } + + public String getFaceFrame() { + return faceFrame; + } + + public void setFaceFrame(String faceFrame) { + this.faceFrame = faceFrame; + } + + public BadgeX getBadge() { + return badge; + } + + public void setBadge(BadgeX badge) { + this.badge = badge; + } + + public static class ExpX { + /** + * color : 6406234 + * user_level : 19 + * master_level : {"level":1,"color":6406234} + */ + + @SerializedName("color") + private int color; + @SerializedName("user_level") + private int userLevel; + @SerializedName("master_level") + private MasterLevelX masterLevel; + + public int getColor() { + return color; + } + + public void setColor(int color) { + this.color = color; + } + + public int getUserLevel() { + return userLevel; + } + + public void setUserLevel(int userLevel) { + this.userLevel = userLevel; + } + + public MasterLevelX getMasterLevel() { + return masterLevel; + } + + public void setMasterLevel(MasterLevelX masterLevel) { + this.masterLevel = masterLevel; + } + + public static class MasterLevelX { + /** + * level : 1 + * color : 6406234 + */ + + @SerializedName("level") + private int level; + @SerializedName("color") + private int color; + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getColor() { + return color; + } + + public void setColor(int color) { + this.color = color; + } + } + } + + public static class VipX { + /** + * vip : 0 + * svip : 0 + */ + + @SerializedName("vip") + private int vip; + @SerializedName("svip") + private int svip; + + public int getVip() { + return vip; + } + + public void setVip(int vip) { + this.vip = vip; + } + + public int getSvip() { + return svip; + } + + public void setSvip(int svip) { + this.svip = svip; + } + } + + public static class BadgeX { + /** + * url : + * desc : + * position : 0 + */ + + @SerializedName("url") + private String url; + @SerializedName("desc") + private String description; + @SerializedName("position") + private int position; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + } + } + } +} diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkEndPackageEvent.java b/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkEndPackageEvent.java new file mode 100644 index 0000000..bd45fd9 --- /dev/null +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkEndPackageEvent.java @@ -0,0 +1,10 @@ +package com.hiczp.bilibili.api.live.socket.event; + +import com.hiczp.bilibili.api.live.socket.LiveClient; +import com.hiczp.bilibili.api.live.socket.entity.PkEndEntity; + +public class PkEndPackageEvent extends ReceiveDataPackageEvent { + public PkEndPackageEvent(LiveClient source, PkEndEntity entity) { + super(source, entity); + } +} diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkProcessPackageEvent.java b/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkProcessPackageEvent.java new file mode 100644 index 0000000..e6dc6a8 --- /dev/null +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkProcessPackageEvent.java @@ -0,0 +1,10 @@ +package com.hiczp.bilibili.api.live.socket.event; + +import com.hiczp.bilibili.api.live.socket.LiveClient; +import com.hiczp.bilibili.api.live.socket.entity.PkProcessEntity; + +public class PkProcessPackageEvent extends ReceiveDataPackageEvent { + public PkProcessPackageEvent(LiveClient source, PkProcessEntity entity) { + super(source, entity); + } +} diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkSettlePackageEvent.java b/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkSettlePackageEvent.java new file mode 100644 index 0000000..573a51e --- /dev/null +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/event/PkSettlePackageEvent.java @@ -0,0 +1,10 @@ +package com.hiczp.bilibili.api.live.socket.event; + +import com.hiczp.bilibili.api.live.socket.LiveClient; +import com.hiczp.bilibili.api.live.socket.entity.PkSettleEntity; + +public class PkSettlePackageEvent extends ReceiveDataPackageEvent { + public PkSettlePackageEvent(LiveClient source, PkSettleEntity entity) { + super(source, entity); + } +} diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/handler/LiveClientHandler.java b/src/main/java/com/hiczp/bilibili/api/live/socket/handler/LiveClientHandler.java index 9fde273..3ecad3c 100644 --- a/src/main/java/com/hiczp/bilibili/api/live/socket/handler/LiveClientHandler.java +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/handler/LiveClientHandler.java @@ -124,10 +124,22 @@ public class LiveClientHandler extends SimpleChannelInboundHandler { eventCreationExpression = () -> new PkStartPackageEvent(liveClient, GSON.fromJson(jsonObject, PkStartEntity.class)); } break; + case "PK_PROCESS": { + eventCreationExpression = () -> new PkProcessPackageEvent(liveClient, GSON.fromJson(jsonObject, PkProcessEntity.class)); + } + break; + case "PK_END": { + eventCreationExpression = () -> new PkEndPackageEvent(liveClient, GSON.fromJson(jsonObject, PkEndEntity.class)); + } + break; case "PK_MIC_END": { eventCreationExpression = () -> new PkMicEndPackageEvent(liveClient, GSON.fromJson(jsonObject, PkMicEndEntity.class)); } break; + case "PK_SETTLE": { + eventCreationExpression = () -> new PkSettlePackageEvent(liveClient, GSON.fromJson(jsonObject, PkSettleEntity.class)); + } + break; //系统消息(小电视等) case "SYS_MSG": { eventCreationExpression = () -> new SysMsgPackageEvent(liveClient, GSON.fromJson(jsonObject, SysMsgEntity.class));