From 73c4d07a4b33c29544a35f06893c6594e288c33c Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Wed, 28 Aug 2024 13:07:04 -0500 Subject: [PATCH] Print an error when the editor fails --- .../arena/editor/ArenaEditorWizard.java | 2 ++ .../arena/editor/EditorContext.java | 13 +++++++++++++ .../arena/editor/context/MapCreateContext.java | 17 +++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizard.java b/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizard.java index 94319668..138a731a 100644 --- a/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizard.java +++ b/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizard.java @@ -94,6 +94,7 @@ public void openWizard(Player player, Arena arena, @Nullable Consumer 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; } @@ -132,6 +133,7 @@ public void openSingleWizardStage(Player player, Arena arena, WizardStage 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; } diff --git a/plugin/src/main/java/org/battleplugins/arena/editor/EditorContext.java b/plugin/src/main/java/org/battleplugins/arena/editor/EditorContext.java index 2afac118..e1bb14a6 100644 --- a/plugin/src/main/java/org/battleplugins/arena/editor/EditorContext.java +++ b/plugin/src/main/java/org/battleplugins/arena/editor/EditorContext.java @@ -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 + + '}'; + } } diff --git a/plugin/src/main/java/org/battleplugins/arena/editor/context/MapCreateContext.java b/plugin/src/main/java/org/battleplugins/arena/editor/context/MapCreateContext.java index 5b8e2c54..73a69dc8 100644 --- a/plugin/src/main/java/org/battleplugins/arena/editor/context/MapCreateContext.java +++ b/plugin/src/main/java/org/battleplugins/arena/editor/context/MapCreateContext.java @@ -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 + + '}'; + } }