Skip to content

Commit

Permalink
Add a warning when someone tries to add an existing top placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgeiss0702 committed Apr 16, 2023
1 parent 610de94 commit 588b28d
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -8,6 +8,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;

import static us.ajg0702.leaderboards.LeaderboardPlugin.message;
Expand Down Expand Up @@ -39,7 +40,11 @@ public void execute(CommandSender sender, String[] args, String label) {
return;
}
if(!plugin.validatePlaceholder(placeholder, sender)) {
String lowerPlaceholder = placeholder.toLowerCase(Locale.ROOT);
sender.sendMessage(message("&cThe placeholder '"+placeholder+"' does not give a numerical value. Make sure that the placeholder returns a number that is not formatted."));
if(lowerPlaceholder.contains("top") || lowerPlaceholder.contains("lb")) {
sender.sendMessage(message("&eThat placeholder looks like it might be an existing top placeholder! Please read step 1 of the setup guide!"));
}
return;
}
boolean r = plugin.getCache().createBoard(placeholder);
Expand Down

0 comments on commit 588b28d

Please sign in to comment.