mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Offline player checks now support partial name matches.
This commit is contained in:
parent
aaf08150e6
commit
0e0b441168
2 changed files with 11 additions and 3 deletions
|
@ -81,4 +81,5 @@ v 1.6:
|
||||||
- Optimizations include changing the return of comparePermissionString.
|
- Optimizations include changing the return of comparePermissionString.
|
||||||
- Added file details in error messages for loading groups/users.
|
- Added file details in error messages for loading groups/users.
|
||||||
v 1.7:
|
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.
|
|
@ -1800,9 +1800,16 @@ public class GroupManager extends JavaPlugin {
|
||||||
|
|
||||||
players = this.getServer().matchPlayer(playerName);
|
players = this.getServer().matchPlayer(playerName);
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
// Check for an offline player.
|
// Check for an offline player (exact match).
|
||||||
if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName)))
|
if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) {
|
||||||
match.add(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 {
|
} else {
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
|
|
Loading…
Reference in a new issue