Skip to content

Commit 3add02d

Browse files
[BUG] Resolved Auto reload case sensitive issue. (#8293)
* [BUG] Resolved Auto reload case sensitive issue. Signed-off-by: Harsh Mehta <harshmehta010102@gmail.com> * [BUG] Review comments resolved. Signed-off-by: Harsh Mehta <harshmehta010102@gmail.com>
1 parent ef6ffe5 commit 3add02d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/ch/njol/skript/structures/StructAutoReload.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,12 @@ public static final class AutoReload implements ScriptData {
191191

192192
// private constructor to prevent instantiation.
193193
private AutoReload(long lastReload, @Nullable String permission, @Nullable String... recipients) {
194-
if (recipients != null)
195-
this.recipients.addAll(Lists.newArrayList(recipients));
194+
if (recipients != null) {
195+
for (String recipient : recipients) {
196+
if (recipient != null)
197+
this.recipients.add(recipient.toLowerCase(Locale.ENGLISH));
198+
}
199+
}
196200

197201
this.permission = permission;
198202
this.lastReload = lastReload;
@@ -208,7 +212,7 @@ private AutoReload(long lastReload, @Nullable String permission, @Nullable Strin
208212
List<CommandSender> senders = Lists.newArrayList(Bukkit.getConsoleSender());
209213
if (!recipients.isEmpty()) {
210214
Bukkit.getOnlinePlayers().stream()
211-
.filter(p -> recipients.contains(p.getName()) || recipients.contains(p.getUniqueId().toString()))
215+
.filter(p -> recipients.contains(p.getName().toLowerCase(Locale.ENGLISH)) || recipients.contains(p.getUniqueId().toString()))
212216
.forEach(senders::add);
213217
return Collections.unmodifiableList(senders);
214218
}

0 commit comments

Comments
 (0)