!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,10 +14,11 @@ public class CombatRunnable extends BukkitRunnable {
public CombatRunnable(PlayerData player) { public CombatRunnable(PlayerData player) {
this.player = player; this.player = player;
if(player.isOnline()) if (player.isOnline()) {
MMOCore.plugin.configManager.getSimpleMessage("now-in-combat").send(player.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("now-in-combat").send(player.getPlayer());
Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true)); Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true));
runTaskTimer(MMOCore.plugin, 20, 20); runTaskTimer(MMOCore.plugin, 20, 20);
}
} }
public void update() { public void update() {
@ -26,7 +27,10 @@ public class CombatRunnable extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
if(!player.isOnline()) { close(); return; } if (!player.isOnline()) {
close();
return;
}
if (lastHit + MMOCore.plugin.configManager.combatLogTimer < System.currentTimeMillis()) { if (lastHit + MMOCore.plugin.configManager.combatLogTimer < System.currentTimeMillis()) {
Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, false)); Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, false));
MMOCore.plugin.configManager.getSimpleMessage("leave-combat").send(player.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("leave-combat").send(player.getPlayer());