Skip to content

Commit e098d3e

Browse files
authored
Merge pull request #101 from anlingyi/release
1.6.6-beta
2 parents 235f9d8 + c64801c commit e098d3e

51 files changed

Lines changed: 746 additions & 129 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# XEChat-Idea
22

3-
> Version 1.6.5-beta
3+
> Version 1.6.6-beta
44
55
> 基于Netty的IDEA即时聊天插件:让你能够在IDEA里实现聊天、下棋、斗地主!(理论上支持JetBrains全系列开发工具🙂)
66
7+
> 浏览器端:[XEChat-Web](https://github.com/anlingyi/xechat-web)
8+
79
- [目录](#xechat-idea)
810
- [项目介绍](#项目介绍)
911
- [项目结构](#项目结构)
@@ -103,6 +105,7 @@
103105
* [实现一个自定义命令](https://xeblog.cn/articles/79)
104106
* [实现一个自定义消息](https://xeblog.cn/articles/100)
105107
* [实现一个联机对战游戏](https://xeblog.cn/articles/95)
108+
* [WebSocket协议接入文档](https://xeblog.cn/articles/112)
106109

107110
## 运行 & 部署
108111

xechat-commons/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>cn.xeblog</groupId>
88
<artifactId>xechat-commons</artifactId>
9-
<version>1.6.5-beta</version>
9+
<version>1.6.6-beta</version>
1010
<build>
1111
<plugins>
1212
<plugin>

xechat-commons/src/main/java/cn/xeblog/commons/entity/LoginDTO.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.xeblog.commons.entity;
22

3+
import cn.xeblog.commons.enums.Platform;
34
import cn.xeblog.commons.enums.UserStatus;
45
import lombok.AllArgsConstructor;
56
import lombok.Data;
@@ -16,16 +17,63 @@
1617
@AllArgsConstructor
1718
public class LoginDTO implements Serializable {
1819

20+
/**
21+
* 昵称
22+
*/
1923
private String username;
2024

25+
/**
26+
* 状态
27+
*/
2128
private UserStatus status;
2229

30+
/**
31+
* 是否是重连
32+
*/
2333
private boolean reconnected;
2434

35+
/**
36+
* 插件版本
37+
*/
2538
private String pluginVersion;
2639

40+
/**
41+
* 令牌
42+
*/
2743
private String token;
2844

45+
/**
46+
* 全局唯一ID
47+
*/
2948
private String uuid;
3049

50+
/**
51+
* 来源平台
52+
*/
53+
private Platform platform;
54+
55+
public void setStatus(UserStatus status) {
56+
this.status = status;
57+
}
58+
59+
public void setStatus(String status) {
60+
try {
61+
this.status = UserStatus.valueOf(status);
62+
} catch (Exception e) {
63+
this.status = UserStatus.FISHING;
64+
}
65+
}
66+
67+
public void setPlatform(Platform platform) {
68+
this.platform = platform;
69+
}
70+
71+
public void setPlatform(String platform) {
72+
try {
73+
this.platform = Platform.valueOf(platform);
74+
} catch (Exception e) {
75+
this.platform = Platform.IDEA;
76+
}
77+
}
78+
3179
}

xechat-commons/src/main/java/cn/xeblog/commons/entity/Request.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.xeblog.commons.entity;
22

33
import cn.xeblog.commons.enums.Action;
4+
import cn.xeblog.commons.enums.Protocol;
45
import lombok.AllArgsConstructor;
56
import lombok.Data;
67
import lombok.NoArgsConstructor;
@@ -30,4 +31,21 @@ public class Request<T> implements Serializable {
3031
*/
3132
private Action action;
3233

34+
private Protocol protocol;
35+
36+
public Request(T body, Action action) {
37+
this.body = body;
38+
this.action = action;
39+
}
40+
41+
public void setAction(Action action) {
42+
this.action = action;
43+
}
44+
45+
public void setAction(String action) {
46+
try {
47+
this.action = Action.valueOf(action);
48+
} catch (Exception e) {
49+
}
50+
}
3351
}

xechat-commons/src/main/java/cn/xeblog/commons/entity/User.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.xeblog.commons.entity;
22

33
import cn.xeblog.commons.enums.Permissions;
4+
import cn.xeblog.commons.enums.Platform;
45
import cn.xeblog.commons.enums.UserStatus;
56
import io.netty.channel.Channel;
67
import lombok.*;
@@ -74,6 +75,10 @@ public class User implements Serializable {
7475
@Setter
7576
private int permit;
7677

78+
@Getter
79+
@Setter
80+
private Platform platform;
81+
7782
/**
7883
* 通道
7984
*/
@@ -98,6 +103,7 @@ public User(String id, String username, UserStatus status, String ip, IpRegion r
98103
this.ip = ip;
99104
this.region = region;
100105
this.channel = channel;
106+
this.platform = Platform.IDEA;
101107
}
102108

103109
public void send(Response response) {

xechat-commons/src/main/java/cn/xeblog/commons/entity/UserMsgDTO.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,12 @@ public boolean hasUser(String username) {
5454
return false;
5555
}
5656

57+
public void setMsgType(MsgType msgType) {
58+
this.msgType = msgType;
59+
}
60+
61+
public void setMsgType(String msgType) {
62+
this.msgType = MsgType.valueOf(msgType);
63+
}
64+
5765
}

xechat-commons/src/main/java/cn/xeblog/commons/entity/WeatherDTO.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ public class WeatherDTO implements Serializable {
2828
*/
2929
private String location;
3030

31+
public void setType(WeatherType type) {
32+
this.type = type;
33+
}
34+
35+
public void setType(String type) {
36+
this.type = WeatherType.build(type);
37+
}
38+
3139
}

xechat-commons/src/main/java/cn/xeblog/commons/entity/game/GameInviteResultDTO.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,12 @@ public GameInviteResultDTO(InviteStatus status) {
2424
this.status = status;
2525
}
2626

27+
public void setStatus(InviteStatus status) {
28+
this.status = status;
29+
}
30+
31+
public void setStatus(String status) {
32+
this.status = InviteStatus.valueOf(status);
33+
}
34+
2735
}

xechat-commons/src/main/java/cn/xeblog/commons/entity/game/GameRoomMsgDTO.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,12 @@ public enum MsgType {
6666
ROOM_CLOSE;
6767
}
6868

69+
public void setMsgType(MsgType msgType) {
70+
this.msgType = msgType;
71+
}
72+
73+
public void setMsgType(String msgType) {
74+
this.msgType = MsgType.valueOf(msgType);
75+
}
76+
6977
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cn.xeblog.commons.enums;
2+
3+
/**
4+
* 平台
5+
*
6+
* @author anlingyi
7+
* @date 2023/9/1 8:20 PM
8+
*/
9+
public enum Platform {
10+
11+
/**
12+
* Jetbrains平台
13+
*/
14+
IDEA,
15+
/**
16+
* Web平台
17+
*/
18+
WEB
19+
20+
}

0 commit comments

Comments
 (0)