Skip to content

Commit

Permalink
NullPointer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rotgruengelb committed Mar 28, 2024
1 parent 61418a6 commit 3a34e16
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ZoneBlockBlockEntity extends BlockEntity implements BlockEntityProv
private ZoneBlockMode mode;
private boolean showZones = false;
private boolean powered;
@NotNull private RuleSet ruleSet = RuleSet.of(AvailableRuleSets.EMPTY_RULESET);
private RuleSet ruleSet = RuleSet.of(AvailableRuleSets.EMPTY_RULESET);
private int priority = 0;
private List<BlockZone> zones = new ArrayList<>();

Expand Down Expand Up @@ -216,6 +216,9 @@ public List<BlockZone> getZones(boolean wantRaw) {
}

public @NotNull RuleSet getRuleSet() {
if (ruleSet == null) {
return RuleSet.of(AvailableRuleSets.EMPTY_RULESET);
}
return this.ruleSet;
}

Expand All @@ -228,7 +231,7 @@ public void setRuleSet(RuleSet ruleSet) {
}

public RuleSet getRuleSet(boolean useMode) {
RuleSet returnRuleSet = this.ruleSet;
RuleSet returnRuleSet = this.ruleSet != null ? this.ruleSet : RuleSet.of(AvailableRuleSets.EMPTY_RULESET);
RuleSet gotRuleSet = MODE_RULESETS.get(this.mode);
if (useMode && gotRuleSet != null) {
returnRuleSet = gotRuleSet;
Expand Down

0 comments on commit 3a34e16

Please sign in to comment.