Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.

Commit a27ad44

Browse files
committed
全面推进lambok
1 parent 699baf2 commit a27ad44

File tree

42 files changed

+1276
-2270
lines changed

Some content is hidden

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

42 files changed

+1276
-2270
lines changed

command/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,9 @@
6161
<groupId>io.github.minecraftchampions.dodoopenjava</groupId>
6262
<artifactId>core</artifactId>
6363
</dependency>
64+
<dependency>
65+
<groupId>org.projectlombok</groupId>
66+
<artifactId>lombok</artifactId>
67+
</dependency>
6468
</dependencies>
6569
</project>

command/src/main/java/io/github/minecraftchampions/dodoopenjava/command/CommandSender.java

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,92 +3,71 @@
33
import io.github.minecraftchampions.dodoopenjava.api.v2.ChannelMessageApi;
44
import io.github.minecraftchampions.dodoopenjava.api.v2.MemberApi;
55
import io.github.minecraftchampions.dodoopenjava.api.v2.RoleApi;
6+
import lombok.Getter;
67
import org.json.JSONObject;
78

89
import java.io.IOException;
910

1011
/**
1112
* 命令发送者
1213
*/
14+
@Getter
1315
public class CommandSender {
16+
/**
17+
* -- GETTER --
18+
* 获取DodoID
19+
*
20+
*/
1421
public String SenderDodoSourceId;
1522

16-
public String ChannelId;
17-
18-
public String IslandSourceId;
19-
20-
public String AvatarUrl;
21-
22-
public String SenderNickName;
23-
24-
public String SenderName;
25-
26-
public String JoinTime;
27-
28-
public String MessageId;
29-
3023
/**
31-
* 获取DodoID
24+
* -- GETTER --
25+
* 获取频道ID
3226
*
33-
* @return DodoID
3427
*/
35-
public String getSenderDodoSourceId() {
36-
return this.SenderDodoSourceId;
37-
}
28+
public String ChannelId;
3829

3930
/**
40-
* 获取频道ID
31+
* -- GETTER --
32+
* 获取群号
4133
*
42-
* @return 频道ID
4334
*/
44-
public String getChannelId() {
45-
return this.ChannelId;
46-
}
35+
public String IslandSourceId;
4736

4837
/**
49-
* 获取群号
38+
* -- GETTER --
39+
* 获取头像URL
5040
*
51-
* @return 群号
5241
*/
53-
public String getIslandSourceId() {
54-
return this.IslandSourceId;
55-
}
42+
public String AvatarUrl;
5643

5744
/**
58-
* 获取头像URL
45+
* -- GETTER --
46+
* 获取发送者群昵称
5947
*
60-
* @return 头像URL
6148
*/
62-
public String getAvatarUrl() {
63-
return this.AvatarUrl;
64-
}
49+
public String SenderNickName;
6550

6651
/**
67-
* 获取发送者群昵称
52+
* -- GETTER --
53+
* 获取发送者原本名称
6854
*
69-
* @return 群昵称
7055
*/
71-
public String getSenderNickName() {
72-
return this.SenderNickName;
73-
}
56+
public String SenderName;
7457

7558
/**
76-
* 获取发送者原本名称
59+
* -- GETTER --
60+
* 获取加入时间
7761
*
78-
* @return 原名
7962
*/
80-
public String getSenderName() {
81-
return this.SenderName;
82-
}
63+
public String JoinTime;
8364

8465
/**
85-
* 获取加入时间
66+
* -- GETTER --
67+
* 获取触发命令的消息ID
8668
*
87-
* @return 加入时间
8869
*/
89-
public String getJoinTime() {
90-
return this.JoinTime;
91-
}
70+
public String MessageId;
9271

9372
/**
9473
* 初始化发送者这个类型

configuration/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,9 @@
5454
<groupId>commons-io</groupId>
5555
<artifactId>commons-io</artifactId>
5656
</dependency>
57+
<dependency>
58+
<groupId>org.projectlombok</groupId>
59+
<artifactId>lombok</artifactId>
60+
</dependency>
5761
</dependencies>
5862
</project>

configuration/src/main/java/io/github/minecraftchampions/dodoopenjava/configuration/MemoryConfiguration.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.github.minecraftchampions.dodoopenjava.configuration;
22

3+
import lombok.Getter;
34
import org.apache.commons.lang3.Validate;
45

56
import java.util.Map;
@@ -8,6 +9,7 @@
89
* 这是一个配置实现,不保存或从任何源加载,只将所有值存储在内存中。这对于提供缺省值的临时配置非常有用。
910
*/
1011
public class MemoryConfiguration extends MemorySection implements Configuration {
12+
@Getter
1113
protected Configuration defaults;
1214
protected MemoryConfigurationOptions options;
1315

@@ -58,10 +60,6 @@ public void setDefaults(Configuration defaults) {
5860
this.defaults = defaults;
5961
}
6062

61-
public Configuration getDefaults() {
62-
return defaults;
63-
}
64-
6563
@Override
6664
public ConfigurationSection getParent() {
6765
return null;

configuration/src/main/java/io/github/minecraftchampions/dodoopenjava/configuration/MemorySection.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.minecraftchampions.dodoopenjava.configuration;
22

33
import io.github.minecraftchampions.dodoopenjava.utils.NumberUtil;
4+
import lombok.Getter;
45
import okio.ByteString;
56
import org.apache.commons.lang3.Validate;
67

@@ -11,7 +12,9 @@
1112
*/
1213
public class MemorySection implements ConfigurationSection {
1314
protected final Map<String, Object> map = new LinkedHashMap<>();
15+
@Getter
1416
private final Configuration root;
17+
@Getter
1518
private final ConfigurationSection parent;
1619
private final String path;
1720
private final String fullPath;
@@ -107,14 +110,6 @@ public String getName() {
107110
return path;
108111
}
109112

110-
public Configuration getRoot() {
111-
return root;
112-
}
113-
114-
public ConfigurationSection getParent() {
115-
return parent;
116-
}
117-
118113
public void addDefault(String path, Object value) {
119114
Validate.notNull(path, "Path cannot be null");
120115

configuration/src/main/java/io/github/minecraftchampions/dodoopenjava/configuration/file/YamlConfiguration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void loadFromString(String contents) throws InvalidConfigurationException
5656
}
5757

5858
String header = parseHeader(contents);
59-
if (header.length() > 0) {
59+
if (!header.isEmpty()) {
6060
options().header(header);
6161
}
6262

@@ -97,7 +97,7 @@ protected String parseHeader(String input) {
9797
}
9898

9999
foundHeader = true;
100-
} else if ((foundHeader) && (line.length() == 0)) {
100+
} else if ((foundHeader) && (line.isEmpty())) {
101101
result.append("\n");
102102
} else if (foundHeader) {
103103
readingHeader = false;
@@ -117,7 +117,7 @@ protected String buildHeader() {
117117
if ((def instanceof FileConfiguration filedefaults)) {
118118
String defaultsHeader = filedefaults.buildHeader();
119119

120-
if ((defaultsHeader != null) && (defaultsHeader.length() > 0)) {
120+
if ((defaultsHeader != null) && (!defaultsHeader.isEmpty())) {
121121
return defaultsHeader;
122122
}
123123
}
@@ -134,7 +134,7 @@ protected String buildHeader() {
134134
for (int i = lines.length - 1; i >= 0; i--) {
135135
builder.insert(0, "\n");
136136

137-
if ((startedHeader) || (lines[i].length() != 0)) {
137+
if ((startedHeader) || (!lines[i].isEmpty())) {
138138
builder.insert(0, lines[i]);
139139
builder.insert(0, COMMENT_PREFIX);
140140
startedHeader = true;

core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,9 @@
3838
<groupId>org.dom4j</groupId>
3939
<artifactId>dom4j</artifactId>
4040
</dependency>
41+
<dependency>
42+
<groupId>org.projectlombok</groupId>
43+
<artifactId>lombok</artifactId>
44+
</dependency>
4145
</dependencies>
4246
</project>
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package io.github.minecraftchampions.dodoopenjava.card.component;
22

3+
import lombok.Getter;
34
import org.json.JSONObject;
45

56
import java.io.Serializable;
67

78
/**
89
* 组件
910
*/
11+
@Getter
1012
public abstract class Component implements Serializable {
1113
protected JSONObject jsonCard = new JSONObject();
1214

@@ -16,7 +18,4 @@ public abstract class Component implements Serializable {
1618
public Component() {
1719
}
1820

19-
public JSONObject getJsonCard() {
20-
return jsonCard;
21-
}
2221
}

event-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@
5050
<artifactId>commons-lang3</artifactId>
5151
<scope>provided</scope>
5252
</dependency>
53+
<dependency>
54+
<groupId>org.projectlombok</groupId>
55+
<artifactId>lombok</artifactId>
56+
</dependency>
5357
</dependencies>
5458
</project>

event-core/src/main/java/io/github/minecraftchampions/dodoopenjava/event/EventManage.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ public static Class<?> getEventTriggerClass() {
129129
* @param an Authorization
130130
*/
131131
public static void init(String an) {
132-
Class<?> clazz = getEventTriggerClass();
133132
try {
134133
Class.forName("io.github.minecraftchampions.dodoopenjava.event.websocket.EventTrigger");
135134
getEventTriggerClass().getMethod("main", String.class).invoke(null, an);

0 commit comments

Comments
 (0)