add custom title

This commit is contained in:
zhangyuheng 2024-01-10 01:05:42 +08:00
parent 874d90d2be
commit 2a92fdafc2
2 changed files with 18 additions and 10 deletions

View File

@ -233,14 +233,4 @@ public class XPlayer {
Notification.info(_player, "称号已购买至 " + title_bought.getExpireAtStr());
}
public void setTitle(Integer title_id, Long expire_at) {
if (!_titles.containsKey(title_id)) {
_titles.put(title_id, PlayerTitle.create(title_id, _player.getUniqueId()));
}
PlayerTitle title = _titles.get(title_id);
title.setExpireAt(expire_at);
Notification.info(_player, title.getTitle());
Notification.info(_player, "获得称号,有效期至 " + title.getExpireAtStr());
}
}

View File

@ -77,4 +77,22 @@ public class PlayerCommands {
xPlayer.buyTitle(saleTitle);
return true;
}
public static boolean custom(CommandSender sender, String[] args) {
if (!(sender instanceof org.bukkit.entity.Player)) {
XLogger.warn("该命令只能由玩家执行");
return true;
}
org.bukkit.entity.Player player = (org.bukkit.entity.Player) sender;
if (args.length != 2) {
Notification.warn(player, "用法: /mplt custom <称号>");
return true;
}
// todo add custom title
// add title
// description = player.getDisplayName() + "的自定义称号";
// add player title
// expire_at = -1
return true;
}
}