Skip to content

Commit

Permalink
Split out endIndex into its own variable for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasDeBruijn committed Dec 4, 2021
1 parent bfc3512 commit 713cf2c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 713cf2c

Please sign in to comment.