Check if gamemode is null because of fake player npcs

This commit is contained in:
Zeshan Aslam 2018-06-20 19:54:08 -04:00
parent c484591d2a
commit 84f510bb78
3 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
name: ActionHealth
main: com.zeshanaslam.actionhealth.Main
version: 3.2.0
version: 3.2.1
commands:
Actionhealth:
description: Actionhealth main command.

View File

@ -38,8 +38,8 @@ public class HealthUtil {
if (entity instanceof Player) {
Player player = (Player) entity;
// Using string version for older versions
if (player.getGameMode().name().equals("SPECTATOR")) {
// Using string version for older versions. Checking for gamemode is null because of fake player npcs.
if (player.getGameMode() != null && player.getGameMode().name().equals("SPECTATOR")) {
return;
}
}