Skip to content

Commit

Permalink
修复一系列bug:
Browse files Browse the repository at this point in the history
1. 修复在1.21下的CUI报错;
2. 现支持在1.20.1使用java17运行;
  • Loading branch information
ColdeZhang committed Oct 9, 2024
1 parent a86ce46 commit 5734c97
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 36 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ For detail functions and features of Dominion, you can view [Introduction](intro

- 1.20.1+ (Bukkit、Spigot、Paper、Folia)

> You need to use Java21 to run your server. If you are still using Java17, you can safely replace it with Java21. In
> theory, version 1.20.1+ can be directly upgraded to Java21.
> Although this plugin supports Spigot, we strongly recommend that you upgrade your core to Paper or its forked (such as
> Purpur) for a better performance experience.
Expand Down
3 changes: 0 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ Dominion 是一个完全开源、免费,专为高版本开发,面向未来

- 1.20.1+ (Bukkit、Spigot、Paper、Folia)

> 需要使用 Java21 运行你的服务端,如果你还在使用 Java17 可以放心替换为 Java21,理论上 1.20.1+ 版本的服务端核心可以直接升级到
> Java21 启动。
> 虽然本插件支持 Spigot,但是我们强烈建议您将您的核心升级到 Paper 或其分支核心(如 Purpur)以获得更好的性能体验。
## 帮助我们不断改进
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

// utf-8
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ plugins {

var BuildFull = properties["BuildFull"].toString() == "true"
var libraries = listOf<String>()
libraries = libraries + "cn.lunadeer:MinecraftPluginUtils:1.3.10"
libraries = libraries + "cn.lunadeer:MinecraftPluginUtils:2.0.2"

group = "cn.lunadeer"
version = "2.13.4-beta"
version = "2.13.5-beta"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

// utf-8
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

// utf-8
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/cn/lunadeer/dominion/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
"export_mca",
"export_db",
"import_db",
"version",
"sys_config",
"all_dominion",
"set_map_color",
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/cn/lunadeer/dominion/dtos/DominionDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static DominionDTO select(Integer id) {
String sql = "SELECT * FROM dominion WHERE id = ? AND id > 0;";
List<DominionDTO> dominions = query(sql, id);
if (dominions.isEmpty()) return null;
return dominions.getFirst();
return dominions.get(0);
}

public static List<DominionDTO> selectByParentId(World world, Integer parentId) {
Expand All @@ -113,7 +113,7 @@ public static DominionDTO select(String name) {
String sql = "SELECT * FROM dominion WHERE name = ? AND id > 0;";
List<DominionDTO> dominions = query(sql, name);
if (dominions.isEmpty()) return null;
return dominions.getFirst();
return dominions.get(0);
}

public static DominionDTO insert(DominionDTO dominion) {
Expand All @@ -133,7 +133,7 @@ public static DominionDTO insert(DominionDTO dominion) {
Cache.instance.loadDominions();
List<DominionDTO> dominions = getDTOFromRS(rs);
if (dominions.isEmpty()) return null;
return dominions.getFirst();
return dominions.get(0);
} catch (SQLException e) {
DatabaseManager.handleDatabaseError("DominionDTO.insert ", e, insert.toString());
return null;
Expand Down Expand Up @@ -237,7 +237,7 @@ private DominionDTO doUpdate(UpdateRow updateRow) {
List<DominionDTO> dominions = getDTOFromRS(rs);
if (dominions.isEmpty()) return null;
Cache.instance.loadDominions((Integer) id.value);
return dominions.getFirst();
return dominions.get(0);
} catch (SQLException e) {
DatabaseManager.handleDatabaseError("DominionDTO.doUpdate ", e, updateRow.toString());
return null;
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/cn/lunadeer/dominion/dtos/GroupDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public static GroupDTO create(String name, DominionDTO dominionDTO) {
try (ResultSet rs = insertRow.execute()) {
List<GroupDTO> groups = getDTOFromRS(rs);
if (groups.isEmpty()) return null;
Cache.instance.loadGroups(groups.getFirst().getId());
return groups.getFirst();
Cache.instance.loadGroups(groups.get(0).getId());
return groups.get(0);
} catch (Exception e) {
DatabaseManager.handleDatabaseError("GroupDTO.create ", e, "");
return null;
Expand All @@ -133,14 +133,14 @@ public static GroupDTO select(Integer id) {
String sql = "SELECT * FROM dominion_group WHERE id = ?;";
List<GroupDTO> groups = getDTOFromRS(DatabaseManager.instance.query(sql, id));
if (groups.isEmpty()) return null;
return groups.getFirst();
return groups.get(0);
}

public static GroupDTO select(Integer domID, String name) {
String sql = "SELECT * FROM dominion_group WHERE dom_id = ? AND name = ?;";
List<GroupDTO> groups = getDTOFromRS(DatabaseManager.instance.query(sql, domID, name));
if (groups.isEmpty()) return null;
return groups.getFirst();
return groups.get(0);
}

public static List<GroupDTO> selectAll() {
Expand Down Expand Up @@ -205,7 +205,7 @@ private GroupDTO doUpdate(UpdateRow updateRow) {
List<GroupDTO> groups = getDTOFromRS(rs);
if (groups.isEmpty()) return null;
Cache.instance.loadGroups((Integer) id.value);
return groups.getFirst();
return groups.get(0);
} catch (Exception e) {
DatabaseManager.handleDatabaseError("更新权限组失败: ", e, "");
return null;
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/cn/lunadeer/dominion/dtos/MemberDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private MemberDTO doUpdate(UpdateRow updateRow) {
List<MemberDTO> players = getDTOFromRS(rs);
if (players.isEmpty()) return null;
Cache.instance.loadMembers(getPlayerUUID());
return players.getFirst();
return players.get(0);
} catch (Exception e) {
DatabaseManager.handleDatabaseError("MemberDTO.doUpdate ", e, "");
return null;
Expand All @@ -76,7 +76,7 @@ public static MemberDTO insert(MemberDTO player) {
Cache.instance.loadMembers(player.getPlayerUUID());
List<MemberDTO> players = getDTOFromRS(rs);
if (players.isEmpty()) return null;
return players.getFirst();
return players.get(0);
} catch (Exception e) {
DatabaseManager.handleDatabaseError("MemberDTO.insert ", e, "");
return null;
Expand All @@ -87,7 +87,7 @@ public static MemberDTO select(UUID playerUUID, Integer dom_id) {
String sql = "SELECT * FROM dominion_member WHERE player_uuid = ? AND dom_id = ?;";
List<MemberDTO> p = query(sql, playerUUID.toString(), dom_id);
if (p.isEmpty()) return null;
return p.getFirst();
return p.get(0);
}

public static List<MemberDTO> select(Integer dom_id) {
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/cn/lunadeer/dominion/dtos/PlayerDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ public static PlayerDTO select(UUID uuid) {
String sql = "SELECT * FROM player_name WHERE uuid = ?;";
List<PlayerDTO> players = query(sql, uuid.toString());
if (players.isEmpty()) return null;
return players.getFirst();
return players.get(0);
}

public static PlayerDTO select(String name) {
String sql = "SELECT * FROM player_name WHERE last_known_name = ?;";
List<PlayerDTO> players = query(sql, name);
if (players.isEmpty()) return null;
return players.getFirst();
return players.get(0);
}

public static List<PlayerDTO> search(String name) {
Expand Down Expand Up @@ -114,7 +114,7 @@ private static PlayerDTO insert(PlayerDTO player) {
try (ResultSet rs = insertRow.execute()) {
List<PlayerDTO> players = getDTOFromRS(rs);
if (players.isEmpty()) return null;
return players.getFirst();
return players.get(0);
} catch (SQLException e) {
DatabaseManager.handleDatabaseError("PlayerDTO.insert ", e, insertRow.toString());
return null;
Expand All @@ -136,7 +136,7 @@ private static PlayerDTO update(PlayerDTO player) {
try (ResultSet rs = updateRow.execute()) {
List<PlayerDTO> players = getDTOFromRS(rs);
if (players.isEmpty()) return null;
return players.getFirst();
return players.get(0);
} catch (SQLException e) {
DatabaseManager.handleDatabaseError("PlayerDTO.update ", e, updateRow.toString());
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static PrivilegeTemplateDTO create(UUID creator, String name) {
try (ResultSet rs = insertRow.execute()) {
List<PrivilegeTemplateDTO> templates = getDTOFromRS(rs);
if (templates.isEmpty()) return null;
return templates.getFirst();
return templates.get(0);
} catch (Exception e) {
DatabaseManager.handleDatabaseError("PrivilegeTemplateDTO.create ", e, null);
return null;
Expand All @@ -70,7 +70,7 @@ private PrivilegeTemplateDTO doUpdate(UpdateRow updateRow) {
try (ResultSet rs = updateRow.execute()) {
List<PrivilegeTemplateDTO> templates = getDTOFromRS(rs);
if (templates.isEmpty()) return null;
return templates.getFirst();
return templates.get(0);
} catch (Exception e) {
DatabaseManager.handleDatabaseError("PrivilegeTemplateDTO.doUpdate ", e, null);
return null;
Expand All @@ -81,7 +81,7 @@ public static PrivilegeTemplateDTO select(UUID creator, String name) {
String sql = "SELECT * FROM privilege_template WHERE creator = ? AND name = ?;";
List<PrivilegeTemplateDTO> templates = query(sql, creator.toString(), name);
if (templates.isEmpty()) return null;
return templates.getFirst();
return templates.get(0);
}

public static List<PrivilegeTemplateDTO> selectAll(UUID creator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void handleData(String input) {
Map<Integer, Location> points = autoPoints(sender);
operator.getResponse().thenAccept(result -> {
if (Objects.equals(result.getStatus(), AbstractOperator.Result.SUCCESS)) {
DominionManage.show(sender, new String[]{"list"});
DominionManage.show(sender, new String[]{input});
}
});
DominionController.create(operator, input, points.get(0), points.get(1));
Expand Down
1 change: 0 additions & 1 deletion docs/en-us/operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

- 1.20.1 及以上;
- Spigot、Paper、Folia...;
- Java 21 及以上;

> 虽然本插件支持 Spigot 但是我们强烈推荐您升级到 Paper 或其分支核心(如 Purpur)以获得更好的性能体验。
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/manage-dominion/sub-dominion.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
## 权限

当玩家处在一个子领地内时,其行为只收到子领地的权限控制。
子领地的权限设置与傅领地完全相同,参考[权限管理](permission/README.md)
子领地的权限设置与父领地完全相同,参考[权限管理](permission/README.md)

## 关于子领地嵌套

Expand Down
1 change: 0 additions & 1 deletion docs/zh-cn/operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

- 1.20.1 及以上;
- Spigot、Paper、Folia...;
- Java 21 及以上;

> 虽然本插件支持 Spigot 但是我们强烈推荐您升级到 Paper 或其分支核心(如 Purpur)以获得更好的性能体验。
Expand Down
1 change: 0 additions & 1 deletion docs/zh-hk/operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

- 1.20.1 及以上;
- Spigot、Paper、Folia...;
- Java 21 及以上;

> 雖然本插件支持 Spigot 但是我們強烈推薦您升級到 Paper 或其分支核心(如 Purpur)以獲得更好的性能體驗。
Expand Down
2 changes: 1 addition & 1 deletion v1_20_1/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

// utf-8
Expand Down

0 comments on commit 5734c97

Please sign in to comment.