!another player must be online error tackled

This commit is contained in:
ASangarin 2020-10-11 16:57:50 +02:00
parent 610045c319
commit 0c20cd0b62

View File

@ -14,11 +14,12 @@ 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);
}
}
public void update() {
lastHit = System.currentTimeMillis();
@ -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());