forked from Upstream/mmocore
!another player must be online error tackled
This commit is contained in:
parent
610045c319
commit
0c20cd0b62
@ -14,11 +14,12 @@ 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() {
|
||||||
lastHit = System.currentTimeMillis();
|
lastHit = System.currentTimeMillis();
|
||||||
@ -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());
|
||||||
|
Loading…
Reference in New Issue
Block a user