Skip to content

Commit

Permalink
fix wrapper of null error after initializing custom EMCMap instances
Browse files Browse the repository at this point in the history
allows EMCWrapper to be initialized with map instances in addition to booleans, so the wrapper instance is no longer null when some functions try to call it.
  • Loading branch information
Owen3H committed Oct 27, 2023
1 parent 98dca2f commit ebb083b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/github/emcw/core/EMCWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public EMCWrapper() {
initMaps(true, true);
}

public EMCWrapper(EMCMap aurora, EMCMap nova) {
initMaps(aurora, nova);
}

/**
* Returns a new {@link EMCWrapper} instance.
* Maps may be initialized independently by passing their respective boolean values.
Expand All @@ -35,6 +39,13 @@ private void initMaps(@NotNull Boolean aurora, @NotNull Boolean nova) {
instance = this;
}

private void initMaps(EMCMap aurora, EMCMap nova) {
if (aurora != null) Aurora = aurora;
if (nova != null) Nova = nova;

instance = this;
}

public static EMCWrapper instance() {
return instance;
}
Expand Down

0 comments on commit ebb083b

Please sign in to comment.