mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2025-01-27 10:23:59 +08:00
修复了创建领地失败,提示数据库错误的问题。
This commit is contained in:
parent
08d6e93e7e
commit
7b4d26970b
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cn.lunadeer</groupId>
|
||||
<artifactId>Dominion</artifactId>
|
||||
<version>1.30.12-beta</version>
|
||||
<version>1.30.13-beta</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Dominion</name>
|
||||
|
@ -106,19 +106,19 @@ public class DominionDTO {
|
||||
}
|
||||
|
||||
public static DominionDTO insert(DominionDTO dominion) {
|
||||
String sql = "INSERT INTO dominion (" +
|
||||
"owner, name, world, x1, y1, z1, x2, y2, z2, ";
|
||||
StringBuilder sql = new StringBuilder("INSERT INTO dominion (" +
|
||||
"owner, name, world, x1, y1, z1, x2, y2, z2, ");
|
||||
for (Flag f : Flag.getAllDominionFlags()) {
|
||||
sql += f.getFlagName() + ", ";
|
||||
sql.append(f.getFlagName()).append(", ");
|
||||
}
|
||||
sql += "tp_location, join_message, leave_message";
|
||||
sql += ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ";
|
||||
sql.append("tp_location, join_message, leave_message");
|
||||
sql.append(") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ");
|
||||
for (Flag f : Flag.getAllDominionFlags()) {
|
||||
sql += f.getDefaultValue() + ", ";
|
||||
sql.append(f.getDefaultValue()).append(", ");
|
||||
}
|
||||
sql += "'default', ?, ?)";
|
||||
sql += ") RETURNING *;";
|
||||
List<DominionDTO> dominions = query(sql,
|
||||
sql.append("'default', ?, ?");
|
||||
sql.append(") RETURNING *;");
|
||||
List<DominionDTO> dominions = query(sql.toString(),
|
||||
dominion.getOwner(),
|
||||
dominion.getName(),
|
||||
dominion.getWorld(),
|
||||
|
@ -9,22 +9,25 @@ import java.util.*;
|
||||
public class PlayerPrivilegeDTO {
|
||||
|
||||
public static PlayerPrivilegeDTO insert(PlayerPrivilegeDTO player) {
|
||||
String sql = "INSERT INTO player_privilege (player_uuid, admin, dom_id, ";
|
||||
StringBuilder sql = new StringBuilder("INSERT INTO player_privilege (player_uuid, admin, dom_id, ");
|
||||
|
||||
for (Flag f : Flag.getAllPrivilegeFlags()) {
|
||||
sql += f.getFlagName() + ", ";
|
||||
sql.append(f.getFlagName()).append(", ");
|
||||
}
|
||||
sql = sql.substring(0, sql.length() - 2);
|
||||
sql = new StringBuilder(sql.substring(0, sql.length() - 2));
|
||||
|
||||
sql += ") VALUES ('" + player.getPlayerUUID() + "', " + player.getAdmin() + ", " + player.getDomID() + ", ";
|
||||
sql.append(") VALUES ('")
|
||||
.append(player.getPlayerUUID()).append("', ")
|
||||
.append(player.getAdmin()).append(", ")
|
||||
.append(player.getDomID()).append(", ");
|
||||
|
||||
for (Flag f : Flag.getAllPrivilegeFlags()) {
|
||||
sql += player.getFlagValue(f) + ", ";
|
||||
sql.append(player.getFlagValue(f)).append(", ");
|
||||
}
|
||||
sql = sql.substring(0, sql.length() - 2);
|
||||
sql = new StringBuilder(sql.substring(0, sql.length() - 2));
|
||||
|
||||
sql += ") RETURNING *;";
|
||||
List<PlayerPrivilegeDTO> players = query(sql);
|
||||
sql.append(") RETURNING *;");
|
||||
List<PlayerPrivilegeDTO> players = query(sql.toString());
|
||||
if (players.size() == 0) return null;
|
||||
return players.get(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user