修复了称号背包展示逻辑错误问题
All checks were successful
Java CI-CD with Maven / build (push) Successful in 9m16s

This commit is contained in:
zhangyuheng 2024-07-01 14:40:12 +08:00
parent ddf5ae711a
commit a007966d70
3 changed files with 24 additions and 24 deletions

View File

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

View File

@ -158,29 +158,29 @@ public class TitleManage {
Notification.info(sender, "已卸下称号");
playerInfo.setUsingTitle(null);
updateName(player, null);
return;
}
PlayerTitleDTO title = PlayerTitleDTO.get(id);
if (title == null) {
Notification.error(sender, "称号不存在");
return;
}
if (!title.getPlayerUuid().equals(player.getUniqueId())) {
Notification.error(sender, "该称号不属于你");
return;
}
if (title.isExpired()) {
Notification.error(sender, "称号 %s 已过期", title.getTitle().getTitlePlainText());
playerInfo.setUsingTitle(null);
updateName(player, null);
return;
}
boolean success = playerInfo.setUsingTitle(title.getTitle());
if (success) {
updateName((Player) sender, title.getTitle());
Notification.info(sender, "已使用称号");
} else {
Notification.error(sender, "使用称号失败,具体请查看控制台日志");
PlayerTitleDTO title = PlayerTitleDTO.get(id);
if (title == null) {
Notification.error(sender, "称号不存在");
return;
}
if (!title.getPlayerUuid().equals(player.getUniqueId())) {
Notification.error(sender, "该称号不属于你");
return;
}
if (title.isExpired()) {
Notification.error(sender, "称号 %s 已过期", title.getTitle().getTitlePlainText());
playerInfo.setUsingTitle(null);
updateName(player, null);
return;
}
boolean success = playerInfo.setUsingTitle(title.getTitle());
if (success) {
updateName((Player) sender, title.getTitle());
Notification.info(sender, "已使用称号");
} else {
Notification.error(sender, "使用称号失败,具体请查看控制台日志");
}
}
if (args.length == 3) {

View File

@ -47,7 +47,7 @@ public class MyTitles {
} else {
line.append("有效期至: " + title.getExpireAt().getYear() + "" + title.getExpireAt().getMonthValue() + "" + title.getExpireAt().getDayOfMonth() + "");
}
if (Objects.equals(playerInfo.getUsingTitle().getId(), title.getId())) {
if (Objects.equals(playerInfo.getUsingTitle().getId(), title.getTitle().getId())) {
line.append(Button.createRed("卸下").setExecuteCommand("/mplt use_title -1 " + page).build());
} else {
line.append(Button.createGreen("使用").setExecuteCommand("/mplt use_title " + title.getId() + " " + page).build());