From 713cf2c6525c72caaac62fd24bea5c942830f0f2 Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Sat, 4 Dec 2021 15:06:09 +0100 Subject: [PATCH] Split out endIndex into its own variable for readability --- .../dev/array21/skinfixer/commands/subcommands/GetCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/array21/skinfixer/commands/subcommands/GetCommand.java b/src/main/java/dev/array21/skinfixer/commands/subcommands/GetCommand.java index 1e7ab52..256d50b 100644 --- a/src/main/java/dev/array21/skinfixer/commands/subcommands/GetCommand.java +++ b/src/main/java/dev/array21/skinfixer/commands/subcommands/GetCommand.java @@ -28,7 +28,8 @@ public void onSubcommand(SkinFixer plugin, CommandSender sender, String[] args) if(args[0].contains("https://") || args[0].contains("http://")) { int indexOfQuery = args[0].indexOf('?'); - String url = args[0].substring(0, indexOfQuery > 0 ? indexOfQuery : args[0].length()); + int endIndex = indexOfQuery > 0 ? indexOfQuery : args[0].length(); + String url = args[0].substring(0, endIndex); int code = new AddNewSkin(plugin).addByUrl(url); sender.sendMessage(ChatColor.GOLD + LangHandler.model.getCodeSkinAdded.replaceAll("%CODE%", ChatColor.RED + String.valueOf(code) + ChatColor.GOLD));