AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
>[danger] 这个工具可以自定义一些冷却时间 ``` import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; class CooldownUtil { static Table cooldown; static{ cooldown = HashBasedTable.create(); } /** * 判定玩家某个类型是否在冷却中 * * @param player 玩家 * @param type 自定义类型,如: "攻击冷却" * @return 在冷却中返回true */ static boolean isCooldown(Player player,String type){ int id = player.getEntityId(); if(!cooldown.contains(id,type)) return false; long cooldown = cooldown.get(id,type); return cooldown > System.currentTimeMillis(); } /** * 设置某个玩家的冷却 * * @param player 玩家 * @param type 自定义类型,如: "攻击冷却" * @param time 冷却时间,毫秒 */ static void setCooldown(Player player,String type,long time){ cooldown.put(player.getEntityId(),type,System.currentTimeMillis()+time); } } ```