mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 02:27:42 +01:00
Added Domain.contains(String playerName).
This commit is contained in:
parent
f2fead1444
commit
690da2332b
@ -70,8 +70,9 @@ public Set<String> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(LocalPlayer player) {
|
||||
if (players.contains(player.getName().toLowerCase())) {
|
||||
if (contains(player.getName())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -84,6 +85,11 @@ public boolean contains(LocalPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String playerName) {
|
||||
return players.contains(playerName.toLowerCase());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return groups.size() + players.size();
|
||||
}
|
||||
|
@ -9,5 +9,14 @@ public interface Domain {
|
||||
* @param player The player to check
|
||||
* @return whether this domain contains {@code player}
|
||||
*/
|
||||
public boolean contains(LocalPlayer player);
|
||||
boolean contains(LocalPlayer player);
|
||||
|
||||
/**
|
||||
* Returns true if a domain contains a player.<br />
|
||||
* This method doesn't check for groups!
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @return whether this domain contains a player by that name
|
||||
*/
|
||||
boolean contains(String playerName);
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public int size() {
|
||||
return domains.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(LocalPlayer player) {
|
||||
for (Domain domain : domains) {
|
||||
if (domain.contains(player)) {
|
||||
@ -53,4 +54,14 @@ public boolean contains(LocalPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String playerName) {
|
||||
for (Domain domain : domains) {
|
||||
if (domain.contains(playerName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -50,8 +50,12 @@ public boolean contains(LocalPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String playerName) {
|
||||
return false; // GroupDomains can't contain player names.
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return groups.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,11 +44,15 @@ public void addPlayer(String name) {
|
||||
}
|
||||
|
||||
public boolean contains(LocalPlayer player) {
|
||||
return players.contains(player.getName().toLowerCase());
|
||||
return contains(player.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String playerName) {
|
||||
return players.contains(playerName.toLowerCase());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return players.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user