Skip to content

Commit

Permalink
Add message when a selector was empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindgamesnl committed Jan 31, 2024
1 parent 230b927 commit ed6ecd4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin/src/main/bash/data.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUM="1064"
BUILD_NUM="1067"
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public void onExecute(User sender, String[] args) {
}

if (args.length == 2) {

if (Validation.isStringInvalid(args[1])) {
throw new CommandError("Invalid source url.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public void onCommand(ServerCommandEvent event) {
spigotPlayerSelector.setSender(new SpigotUserAdapter(event.getSender()));
spigotPlayerSelector.setString(selector);

if (spigotPlayerSelector.getResults().isEmpty()) {
event.getSender().sendMessage(MagicValue.COMMAND_PREFIX.get(String.class) + "No players found for selector " + selector);
event.setCancelled(true);
return;
}

// process the selector, build a new command and re-run
for (User<?> target : spigotPlayerSelector.getResults()) {
String playerCommand = commandPreset.replaceAll("%%player%%", target.getName());
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/data.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUM="1064"
BUILD_NUM="1067"
4 changes: 2 additions & 2 deletions plugin/src/main/resources/openaudiomc-build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILD_VERSION="1064"
BUILD_COMMIT="4934d010dd47db21f0df6a0c64f26b3377b66b66"
BUILD_VERSION="1067"
BUILD_COMMIT="230b9271da8d2e6945e2c7604cffb036a6be048c"
BUILD_AUTHOR="Mats"

0 comments on commit ed6ecd4

Please sign in to comment.