From e3e9dd35cd7dbbf28573d96159fb379ff61d6db8 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Fri, 2 Aug 2024 19:23:23 -0500 Subject: [PATCH] Fix a few editor bugs and other misc issues --- .../src/main/java/org/battleplugins/arena/ArenaLoader.java | 2 +- .../src/main/java/org/battleplugins/arena/BattleArena.java | 2 +- .../org/battleplugins/arena/editor/ArenaEditorWizard.java | 2 ++ .../arena/editor/stage/TeamSpawnInputStage.java | 7 ++++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugin/src/main/java/org/battleplugins/arena/ArenaLoader.java b/plugin/src/main/java/org/battleplugins/arena/ArenaLoader.java index f21814f4..7b3b0757 100644 --- a/plugin/src/main/java/org/battleplugins/arena/ArenaLoader.java +++ b/plugin/src/main/java/org/battleplugins/arena/ArenaLoader.java @@ -38,7 +38,7 @@ public void load() { this.battleArena.arenas.put(arena.getName(), arena); // Register command - PluginCommand command = this.battleArena.getCommand(arena.getName().toUpperCase(Locale.ROOT)); + PluginCommand command = this.battleArena.getCommand(arena.getName().toLowerCase(Locale.ROOT)); ArenaCommandExecutor executor = arena.createCommandExecutor(); ArenaCreateExecutorEvent event = new ArenaCreateExecutorEvent(arena, executor); diff --git a/plugin/src/main/java/org/battleplugins/arena/BattleArena.java b/plugin/src/main/java/org/battleplugins/arena/BattleArena.java index 9f4e5146..0e5b3ca9 100644 --- a/plugin/src/main/java/org/battleplugins/arena/BattleArena.java +++ b/plugin/src/main/java/org/battleplugins/arena/BattleArena.java @@ -644,7 +644,7 @@ private void loadArenaLoaders(Path path) { Configuration configuration = YamlConfiguration.loadConfiguration(Files.newBufferedReader(arenaPath)); String name = configuration.getString("name"); if (name == null) { - this.info("Arena {} does not have a name!", arenaPath.getFileName()); + this.warn("Arena {} does not have a name!", arenaPath.getFileName()); return; } 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 4de84784..94319668 100644 --- a/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizard.java +++ b/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizard.java @@ -143,6 +143,8 @@ public void openSingleWizardStage(Player player, Arena arena, WizardStage sta }); stage.enter(context); + + player.setMetadata(EDITOR_META_KEY, new FixedMetadataValue(this.plugin, context)); } @Nullable diff --git a/plugin/src/main/java/org/battleplugins/arena/editor/stage/TeamSpawnInputStage.java b/plugin/src/main/java/org/battleplugins/arena/editor/stage/TeamSpawnInputStage.java index e78d5b05..c808eb0e 100644 --- a/plugin/src/main/java/org/battleplugins/arena/editor/stage/TeamSpawnInputStage.java +++ b/plugin/src/main/java/org/battleplugins/arena/editor/stage/TeamSpawnInputStage.java @@ -12,6 +12,7 @@ import org.bukkit.entity.Player; import java.util.List; +import java.util.Locale; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; @@ -79,7 +80,7 @@ public void onChatInput(String input) { List teamNames = context.getArena().getTeams().getAvailableTeams() .stream() - .map(ArenaTeam::getName) + .map(team -> team.getName().toLowerCase(Locale.ROOT)) .toList(); Component teamsList = Component.join(JoinConfiguration.commas(true), validTeamNames); @@ -105,7 +106,7 @@ public void onChatInput(String input) { @Override public boolean isValidChatInput(String input) { - return super.isValidChatInput(input) && (!input.startsWith("/") && teamNames.contains(input)); + return super.isValidChatInput(input) && (!input.startsWith("/") && teamNames.contains(input.toLowerCase(Locale.ROOT))); } }.bind(context); } @@ -116,4 +117,4 @@ public boolean isValidChatInput(String input) { } }.bind(context); } -} \ No newline at end of file +}