Skip to content

Commit

Permalink
fix username checking (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thatsmusic99 authored Dec 11, 2023
1 parent 4ad683b commit f5c7493
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
String arg = String.join(" ", args);
if (!arg.matches(".{2,32}#[0-9]{4}")) {
if (!arg.matches("[a-z0-9._]{2,32}|.{2,32}#[0-9]{4}")) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public boolean isMember(String identifier) {
if (g == null) return false;
Member m = g.getMembers().stream()
.filter(mm ->
(mm.getUser().getName() + "#" + mm.getUser().getDiscriminator()).equalsIgnoreCase(identifier)
(mm.getUser().getName() + "#" + mm.getUser().getDiscriminator()).equalsIgnoreCase(identifier) ||
mm.getUser().getName().equalsIgnoreCase(identifier)
).findFirst().orElse(null);
if (m == null) return false;
return m.getRoles().stream().anyMatch(r -> r.getIdLong() == MEMBER_ROLE_ID);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ depend: [ LuckPerms ]
commands:
makegreen:
description: Make yourself green by verifying your CSS membership.
usage: /<command> [Discord Username#1234]
usage: /<command> [Discord Username]
aliases: [ mg, green ]

0 comments on commit f5c7493

Please sign in to comment.