Skip to content

Commit

Permalink
Print an error when the editor fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Redned235 committed Aug 28, 2024
1 parent 22670fe commit 73c4d07
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void openWizard(Player player, Arena arena, @Nullable Consumer<E> context
if (!iterator.hasNext()) {
if (!context.isComplete()) {
Messages.ERROR_OCCURRED_APPLYING_CHANGES.send(player);
this.plugin.warn("The wizard editor failed with no completion! Context: {}", context);
return;
}

Expand Down Expand Up @@ -132,6 +133,7 @@ public void openSingleWizardStage(Player player, Arena arena, WizardStage<E> sta
context.setAdvanceListener(() -> {
if (!context.isComplete()) {
Messages.ERROR_OCCURRED_APPLYING_CHANGES.send(player);
this.plugin.warn("The wizard editor failed with no completion! Context: {}", context);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,17 @@ public void inform(Message message) {
}

public abstract boolean isComplete();

@Override
public String toString() {
return "EditorContext{" +
"wizard=" + this.wizard +
", arena=" + this.arena +
", player=" + this.player +
", advanceListener=" + this.advanceListener +
", position=" + this.position +
", boundListeners=" + this.boundListeners +
", reconstructed=" + this.reconstructed +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,21 @@ public boolean isComplete() {
&& this.spectatorSpawn != null
&& this.hasValidTeamSpawns();
}

@Override
public String toString() {
return "MapCreateContext{" +
"mapName='" + this.mapName + '\'' +
", mapType=" + this.mapType +
", min=" + this.min +
", max=" + this.max +
", waitroomSpawn=" + this.waitroomSpawn +
", spectatorSpawn=" + this.spectatorSpawn +
", spawns=" + this.spawns +
", wizard=" + this.wizard +
", arena=" + this.arena +
", player=" + this.player +
", reconstructed=" + this.reconstructed +
'}';
}
}

0 comments on commit 73c4d07

Please sign in to comment.