Skip to content

Commit

Permalink
fixed npe
Browse files Browse the repository at this point in the history
  • Loading branch information
Globox1997 committed Nov 28, 2024
1 parent 455c2e0 commit 86c98de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Added:
-
### Fixed:
- Fixed level saving
- Fixed npe
-
### Changed:
-
6 changes: 3 additions & 3 deletions src/main/java/net/levelz/util/BonusHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void crossbowBonus(LivingEntity shooter, ProjectileEntity projecti
}

public static boolean itemDamageChanceBonus(@Nullable PlayerEntity playerEntity) {
if (LevelManager.BONUSES.containsKey("itemDamageChance")) {
if (playerEntity != null && LevelManager.BONUSES.containsKey("itemDamageChance")) {
LevelManager levelManager = ((LevelManagerAccess) playerEntity).getLevelManager();
SkillBonus skillBonus = LevelManager.BONUSES.get("itemDamageChance");
int level = levelManager.getPlayerSkills().get(skillBonus.getId()).getLevel();
Expand All @@ -86,8 +86,8 @@ public static boolean itemDamageChanceBonus(@Nullable PlayerEntity playerEntity)
return false;
}

public static StatusEffectInstance potionEffectChanceBonus(PlayerEntity playerEntity, StatusEffectInstance statusEffectInstance) {
if (LevelManager.BONUSES.containsKey("potionEffectChance")) {
public static StatusEffectInstance potionEffectChanceBonus(@Nullable PlayerEntity playerEntity, StatusEffectInstance statusEffectInstance) {
if (playerEntity != null && LevelManager.BONUSES.containsKey("potionEffectChance")) {
LevelManager levelManager = ((LevelManagerAccess) playerEntity).getLevelManager();
SkillBonus skillBonus = LevelManager.BONUSES.get("potionEffectChance");
int level = levelManager.getPlayerSkills().get(skillBonus.getId()).getLevel();
Expand Down

0 comments on commit 86c98de

Please sign in to comment.