Fix NPE on player log out.

This commit is contained in:
jedk1 2015-11-26 18:24:34 +00:00
parent 39d3df50e4
commit f12052dbbe
4 changed files with 22 additions and 4 deletions

View file

@ -110,6 +110,9 @@ public class FreezeMelt {
public static boolean canThaw(Block block) { public static boolean canThaw(Block block) {
if (frozenblocks.containsKey(block)) { if (frozenblocks.containsKey(block)) {
for (Player player : block.getWorld().getPlayers()) { for (Player player : block.getWorld().getPlayers()) {
if (!player.isOnline()) {
return true;
}
if (GeneralMethods.getBoundAbility(player) == null) { if (GeneralMethods.getBoundAbility(player) == null) {
return true; return true;
} }

View file

@ -155,9 +155,11 @@ public class IceBlast {
source.revertBlock(); source.revertBlock();
progressing = false; progressing = false;
} }
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName()); if (player.isOnline()) {
if (bPlayer != null) { BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
bPlayer.addCooldown("IceBlast", cooldown); if (bPlayer != null) {
bPlayer.addCooldown("IceBlast", cooldown);
}
} }
instances.remove(id); instances.remove(id);
} }
@ -228,8 +230,12 @@ public class IceBlast {
} }
private void progress() { private void progress() {
if (player.isDead() || !player.isOnline()) {
cancel();
return;
}
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName()); BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
if (player.isDead() || !player.isOnline() || !GeneralMethods.canBend(player.getName(), "IceBlast") || bPlayer.isOnCooldown("IceBlast")) { if (!GeneralMethods.canBend(player.getName(), "IceBlast") || bPlayer.isOnCooldown("IceBlast")) {
cancel(); cancel();
return; return;
} }

View file

@ -159,6 +159,11 @@ public class OctopusForm {
} }
private void progress() { private void progress() {
if (player.isDead() || !player.isOnline()) {
remove();
return;
}
if (!GeneralMethods.canBend(player.getName(), "OctopusForm")) { if (!GeneralMethods.canBend(player.getName(), "OctopusForm")) {
remove(); remove();
returnWater(); returnWater();

View file

@ -563,6 +563,10 @@ public class Torrent {
frozenblocks.remove(block); frozenblocks.remove(block);
continue; continue;
} }
if (!player.isOnline()) {
thaw(block);
continue;
}
if (block.getBlock().getWorld() != player.getWorld()) { if (block.getBlock().getWorld() != player.getWorld()) {
thaw(block); thaw(block);
continue; continue;