优化转移领地所有权的逻辑校验
All checks were successful
Java CI-CD with Maven / build (push) Successful in 9m25s

This commit is contained in:
zhangyuheng 2024-07-26 14:10:09 +08:00
parent 46d15d01eb
commit bdfb368716
2 changed files with 5 additions and 5 deletions

View File

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

View File

@ -536,10 +536,6 @@ public class DominionController {
operator.setResponse(FAIL.addMessage("操作者信息丢失,请联系管理员"));
return;
}
if (Objects.equals(player_name, operatorDTO.getLastKnownName())) {
operator.setResponse(FAIL.addMessage("不能将领地转让给自己"));
return;
}
DominionDTO dominion = getExistDomAndIsOwner(operator, dom_name);
if (dominion == null) {
return;
@ -549,6 +545,10 @@ public class DominionController {
operator.setResponse(FAIL.addMessage("玩家 %s 不存在", player_name));
return;
}
if (Objects.equals(dominion.getOwner(), player.getUuid())) {
operator.setResponse(FAIL.addMessage("领地 %s 已经属于 %s无需转移", dom_name, player_name));
return;
}
if (dominion.getParentDomId() != -1) {
operator.setResponse(FAIL.addMessage("子领地无法转让,你可以通过将 %s 设置为管理员来让其管理领地 %s ", player_name, dom_name));
return;