diff --git a/pom.xml b/pom.xml index d9bbcc7..696da69 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer MiniPlayerTitle - 4.2.3 + 4.2.4 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 b8d2550..d20d327 100644 --- a/src/main/java/cn/lunadeer/miniplayertitle/commands/TitleManage.java +++ b/src/main/java/cn/lunadeer/miniplayertitle/commands/TitleManage.java @@ -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);