Merge pull request #379 from jedk1/master

Fix NPE in EarthSmash
This commit is contained in:
OmniCypher 2016-01-12 15:15:51 -08:00
commit 2e69f4142f
2 changed files with 4 additions and 0 deletions

View file

@ -43,6 +43,7 @@ public class RemoveCommand extends PKCommand {
return;
}
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have removed your " + e.toString().toLowerCase() + "bending.");
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
return;
} else {
sender.sendMessage(ChatColor.RED + "You do not have that element!");

View file

@ -503,6 +503,9 @@ public class EarthSmash {
for (EarthSmash smash : instances) {
if (reqState == null || smash.state == reqState)
for (Block block : blocks) {
if (block == null || smash.loc == null) {
continue;
}
if (block.getLocation().getWorld() == smash.loc.getWorld() && block.getLocation().distanceSquared(smash.loc) <= Math.pow(2.5, 2))
return smash;
}