Skip to content

Commit f5c7493

Browse files
authored
fix username checking (#18)
1 parent 4ad683b commit f5c7493

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/main/java/com/cssbham/minecraftcore/commands/CommandMakeGreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
2727
return true;
2828
}
2929
String arg = String.join(" ", args);
30-
if (!arg.matches(".{2,32}#[0-9]{4}")) {
30+
if (!arg.matches("[a-z0-9._]{2,32}|.{2,32}#[0-9]{4}")) {
3131
return false;
3232
}
3333

src/main/java/com/cssbham/minecraftcore/discord/DiscordBridge.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ public boolean isMember(String identifier) {
101101
if (g == null) return false;
102102
Member m = g.getMembers().stream()
103103
.filter(mm ->
104-
(mm.getUser().getName() + "#" + mm.getUser().getDiscriminator()).equalsIgnoreCase(identifier)
104+
(mm.getUser().getName() + "#" + mm.getUser().getDiscriminator()).equalsIgnoreCase(identifier) ||
105+
mm.getUser().getName().equalsIgnoreCase(identifier)
105106
).findFirst().orElse(null);
106107
if (m == null) return false;
107108
return m.getRoles().stream().anyMatch(r -> r.getIdLong() == MEMBER_ROLE_ID);

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ depend: [ LuckPerms ]
1010
commands:
1111
makegreen:
1212
description: Make yourself green by verifying your CSS membership.
13-
usage: /<command> [Discord Username#1234]
13+
usage: /<command> [Discord Username]
1414
aliases: [ mg, green ]

0 commit comments

Comments
 (0)