From 0c20cd0b6274c1c64c54176abc62d33d97b30240 Mon Sep 17 00:00:00 2001 From: ASangarin Date: Sun, 11 Oct 2020 16:57:50 +0200 Subject: [PATCH] !another player must be online error tackled --- .../Indyuce/mmocore/api/player/CombatRunnable.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java b/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java index 8b950693..a777cb0f 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java @@ -14,10 +14,11 @@ public class CombatRunnable extends BukkitRunnable { public CombatRunnable(PlayerData player) { this.player = player; - if(player.isOnline()) + if (player.isOnline()) { MMOCore.plugin.configManager.getSimpleMessage("now-in-combat").send(player.getPlayer()); - Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true)); - runTaskTimer(MMOCore.plugin, 20, 20); + Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true)); + runTaskTimer(MMOCore.plugin, 20, 20); + } } public void update() { @@ -26,7 +27,10 @@ public class CombatRunnable extends BukkitRunnable { @Override public void run() { - if(!player.isOnline()) { close(); return; } + if (!player.isOnline()) { + close(); + return; + } if (lastHit + MMOCore.plugin.configManager.combatLogTimer < System.currentTimeMillis()) { Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, false)); MMOCore.plugin.configManager.getSimpleMessage("leave-combat").send(player.getPlayer());