修复了无法卸下称号的问题
All checks were successful
Java CI-CD with Maven / build (push) Successful in 9m41s

This commit is contained in:
zhangyuheng 2024-07-01 00:28:45 +08:00
parent fc5f167587
commit 25fe5fbb09
2 changed files with 14 additions and 7 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>MiniPlayerTitle</artifactId>
<version>4.2.3</version>
<version>4.2.4</version>
<packaging>jar</packaging>
<name>MiniPlayerTitle</name>

View File

@ -148,7 +148,19 @@ public class TitleManage {
return;
}
Player player = (Player) sender;
PlayerTitleDTO title = PlayerTitleDTO.get(Integer.parseInt(args[1]));
PlayerInfoDTO playerInfo = PlayerInfoDTO.get((player).getUniqueId());
if (playerInfo == null) {
Notification.error(sender, "获取玩家信息时出现错误");
return;
}
int id = Integer.parseInt(args[1]);
if (id == -1) {
Notification.info(sender, "已卸下称号");
playerInfo.setUsingTitle(null);
updateName(player, null);
return;
}
PlayerTitleDTO title = PlayerTitleDTO.get(id);
if (title == null) {
Notification.error(sender, "称号不存在");
return;
@ -157,11 +169,6 @@ public class TitleManage {
Notification.error(sender, "该称号不属于你");
return;
}
PlayerInfoDTO playerInfo = PlayerInfoDTO.get((player).getUniqueId());
if (playerInfo == null) {
Notification.error(sender, "获取玩家信息时出现错误");
return;
}
if (title.isExpired()) {
Notification.error(sender, "称号 %s 已过期", title.getTitle().getTitlePlainText());
playerInfo.setUsingTitle(null);