From e1011d449f7f82b7f5baa5138a8a2a1ae49dbf14 Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 18 Mar 2023 21:20:43 +0100 Subject: [PATCH] Fixed %mmocore_in_combat% --- .../java/net/Indyuce/mmocore/player/CombatHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/CombatHandler.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/CombatHandler.java index bac97f04..c823c24c 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/CombatHandler.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/CombatHandler.java @@ -33,15 +33,20 @@ public class CombatHandler implements Closable { // Simply refreshing if (isInCombat()) { Bukkit.getScheduler().cancelTask(task.getTaskId()); - task = Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> quit(false), MMOCore.plugin.configManager.combatLogTimer / 50); + task = newTask(); // Entering combat } else { MMOCore.plugin.configManager.getSimpleMessage("now-in-combat").send(player.getPlayer()); Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true)); + task = newTask(); } } + private BukkitTask newTask() { + return Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> quit(false), MMOCore.plugin.configManager.combatLogTimer / 50); + } + public boolean isInPvpMode() { return pvpMode; }