领地提示语新增支持占位符
Java CI-CD with Maven / build (push) Successful in 6m41s Details

This commit is contained in:
zhangyuheng 2024-06-01 09:59:55 +08:00
parent a8e36f4759
commit c30e5d9d66
3 changed files with 13 additions and 6 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.30.10-beta</version>
<version>1.30.11-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>

View File

@ -141,14 +141,18 @@ public class Cache {
// Notification.info(player, "您已离开领地:%s", last_dominion.getName());
// else
// Notification.info(player, "您已离开子领地:%s", last_dominion.getName());
player.sendActionBar(Component.text(last_dominion.getLeaveMessage()));
String msg = last_dominion.getLeaveMessage();
msg = msg.replace("${DOM_NAME}", last_dominion.getName());
player.sendActionBar(Component.text(msg));
}
if (current_dom_id != -1) {
// if (current_dominion.getParentDomId() == -1)
// Notification.info(player, "您正在进入领地:%s", current_dominion.getName());
// else
// Notification.info(player, "您正在进入子领地:%s", current_dominion.getName());
player.sendActionBar(Component.text(current_dominion.getJoinMessage()));
String msg = current_dominion.getJoinMessage();
msg = msg.replace("${DOM_NAME}", current_dominion.getName());
player.sendActionBar(Component.text(msg));
}
lightOrNot(player, current_dominion); // 发光检查

View File

@ -111,12 +111,12 @@ public class DominionDTO {
for (Flag f : Flag.getAllDominionFlags()) {
sql += f.getFlagName() + ", ";
}
sql += "tp_location";
sql += "tp_location, join_message, leave_message";
sql += ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ";
for (Flag f : Flag.getAllDominionFlags()) {
sql += f.getDefaultValue() + ", ";
}
sql += "'default'";
sql += "'default', ?, ?)";
sql += ") RETURNING *;";
List<DominionDTO> dominions = query(sql,
dominion.getOwner(),
@ -127,7 +127,10 @@ public class DominionDTO {
dominion.getZ1(),
dominion.getX2(),
dominion.getY2(),
dominion.getZ2());
dominion.getZ2(),
"欢迎来到 ${DOM_NAME}",
"你正在离开 ${DOM_NAME},欢迎下次光临~"
);
if (dominions.size() == 0) return null;
return dominions.get(0);
}