NPE fix for McMMOPlayerExperienceEvent

This commit is contained in:
nossr50 2021-03-18 15:15:43 -07:00
parent 4f08c69557
commit 49f1154e65
3 changed files with 13 additions and 5 deletions

View File

@ -6,6 +6,7 @@ Version 2.1.182
Added some safety so that mcMMO automatic save interval is never more frequent than 1 minute
Removed a few silent exceptions for scoreboards & mcMMO
Added warning about UltraPermissions to mcMMO
Fixed a potential NPE in McMMOPlayerExperienceEvent
Version 2.1.181
mcMMO no longer pointlessly tries to check for missing UUIDs for FlatFile database

View File

@ -29,7 +29,13 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) {
super(player);
this.skill = skill;
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
if(UserManager.getPlayer(player) != null) {
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
} else {
this.skillLevel = 0;
}
this.xpGainReason = xpGainReason;
}

View File

@ -74,10 +74,6 @@ import java.util.ArrayList;
import java.util.List;
public class mcMMO extends JavaPlugin {
public static final String ULTRA_PERMISSONS = "UltraPermissons";
public static final String UP_WARNING_2 = "Stop using " + ULTRA_PERMISSONS + " with mcMMO immediately!";
public static final String UP_WARNING_1 = "mcMMO has detected " + ULTRA_PERMISSONS + " on your server, users have reported a severe plugin conflict between these two plugins which severely degrades server performance";
public static final String UP_WARNING_3 = "The author of UltraPermissions has passed away and its unlikely this issue will ever be solved";
/* Managers */
private static PlatformManager platformManager;
private static ChunkManager placeStore;
@ -152,6 +148,11 @@ public class mcMMO extends JavaPlugin {
public static FixedMetadataValue metadataValue;
public static final String ULTRA_PERMISSONS = "UltraPermissons";
public static final String UP_WARNING_2 = "Stop using " + ULTRA_PERMISSONS + " with mcMMO immediately!";
public static final String UP_WARNING_1 = "mcMMO has detected " + ULTRA_PERMISSONS + " on your server, users have reported a severe plugin conflict between these two plugins which severely degrades server performance";
public static final String UP_WARNING_3 = "The author of UltraPermissions has passed away and its unlikely this issue will ever be solved";
public mcMMO() {
p = this;
}