diff --git a/pom.xml b/pom.xml index 931c750..54310ee 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer MiniPlayerTitle - 4.2.6 + 4.2.7 jar MiniPlayerTitle diff --git a/src/main/java/cn/lunadeer/miniplayertitle/commands/TitleManage.java b/src/main/java/cn/lunadeer/miniplayertitle/commands/TitleManage.java index d20d327..cd11e04 100644 --- a/src/main/java/cn/lunadeer/miniplayertitle/commands/TitleManage.java +++ b/src/main/java/cn/lunadeer/miniplayertitle/commands/TitleManage.java @@ -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) { diff --git a/src/main/java/cn/lunadeer/miniplayertitle/tuis/MyTitles.java b/src/main/java/cn/lunadeer/miniplayertitle/tuis/MyTitles.java index 712e16d..b2d2367 100644 --- a/src/main/java/cn/lunadeer/miniplayertitle/tuis/MyTitles.java +++ b/src/main/java/cn/lunadeer/miniplayertitle/tuis/MyTitles.java @@ -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());