Offline player checks now support partial name matches.

This commit is contained in:
ElgarL 2011-12-12 16:39:15 +00:00
parent aaf08150e6
commit 0e0b441168
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) {