1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-12 09:35:26 +02:00

Offline player checks now support partial name matches.

This commit is contained in:
ElgarL
2011-12-12 16:39:15 +00:00
parent 578aff625c
commit 016c181b70
2 changed files with 11 additions and 3 deletions

View File

@@ -81,4 +81,5 @@ v 1.6:
- Optimizations include changing the return of comparePermissionString.
- Added file details in error messages for loading groups/users.
v 1.7:
- GM now supports offline players without having to mantogglevalidate
- GM now supports offline players without having to mantogglevalidate
- Offline player checks now support partial name matches.

View File

@@ -1800,9 +1800,16 @@ public class GroupManager extends JavaPlugin {
players = this.getServer().matchPlayer(playerName);
if (players.isEmpty()) {
// Check for an offline player.
if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName)))
// Check for an offline player (exact match).
if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) {
match.add(playerName);
} else {
//look for partial matches
for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) {
if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase()))
match.add(offline.getName());
}
}
} else {
for (Player player : players) {