From 84e9a98778340d9caa27a81907af4ae45390748a Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 21 Feb 2021 19:00:57 +0100 Subject: [PATCH] Added CooldownHandler#getCooldown --- .../java/zone/themcgamer/core/cooldown/CooldownHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/zone/themcgamer/core/cooldown/CooldownHandler.java b/core/src/main/java/zone/themcgamer/core/cooldown/CooldownHandler.java index f66f8e8..9e1b0e5 100644 --- a/core/src/main/java/zone/themcgamer/core/cooldown/CooldownHandler.java +++ b/core/src/main/java/zone/themcgamer/core/cooldown/CooldownHandler.java @@ -63,7 +63,12 @@ public class CooldownHandler extends Module { return true; } + public static Cooldown getCooldown(Player player, String name) { + return getCooldowns(player).stream().filter(cooldown -> cooldown.getName().equals(name)).findFirst().orElse(null); + } + private static List getCooldowns(Player player) { return cooldowns.getOrDefault(player, new ArrayList<>()); } + } \ No newline at end of file