From 054b76cd6c02c2e6c64967da40b093f03dda796f Mon Sep 17 00:00:00 2001 From: Stefan Glorch <20231187+sglorch@users.noreply.github.com> Date: Sun, 28 Feb 2021 12:09:45 +0100 Subject: [PATCH] Fix error when no arguments supplied A ArrayIndexOutOfBoundsException would be thrown if no arguments were supplied. Putting the switch-statement into the else-branch should fix this. --- .../bungee/movemenow/ReloadCommand.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/craftminecraft/bungee/movemenow/ReloadCommand.java b/src/main/java/net/craftminecraft/bungee/movemenow/ReloadCommand.java index 69a4e80..4da419c 100644 --- a/src/main/java/net/craftminecraft/bungee/movemenow/ReloadCommand.java +++ b/src/main/java/net/craftminecraft/bungee/movemenow/ReloadCommand.java @@ -17,10 +17,11 @@ public ReloadCommand(MoveMeNow plugin) { public void execute(CommandSender sender, String[] args) { if (args.length != 1) { sender.sendMessage(new TextComponent("Please use /mmn reload.")); - } - switch (args[0]) { - case "reload": - plugin.loadConfig(); + } else { + switch (args[0]) { + case "reload": + plugin.loadConfig(); + } } } -} \ No newline at end of file +}