Ident better

This commit is contained in:
Michel Roux 2012-05-11 11:25:55 +02:00
parent b3436defef
commit e4a6463cf3
2 changed files with 35 additions and 35 deletions

View File

@ -11,45 +11,45 @@ import org.bukkit.entity.Player;
public class Group {
private PermissionsPlugin plugin;
private String name;
private String name;
protected Group(PermissionsPlugin plugin, String name) {
this.plugin = plugin;
this.name = name;
}
protected Group(PermissionsPlugin plugin, String name) {
this.plugin = plugin;
this.name = name;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public List<String> getPlayers() {
return plugin.api.getAllPlayers();
}
public List<String> getPlayers() {
return plugin.api.getAllPlayers();
}
public List<Player> getOnlinePlayers() {
ArrayList<Player> result = new ArrayList<Player>();
for (String user : getPlayers()) {
Player player = plugin.getServer().getPlayer(user);
if (player != null && player.isOnline()) {
result.add(player);
}
}
return result;
}
public List<Player> getOnlinePlayers() {
ArrayList<Player> result = new ArrayList<Player>();
for (String user : getPlayers()) {
Player player = plugin.getServer().getPlayer(user);
if (player != null && player.isOnline()) {
result.add(player);
}
}
return result;
}
@Override
public boolean equals(Object o) {
return !(o == null || !(o instanceof Group)) && name.equalsIgnoreCase(((Group) o).getName());
}
@Override
public boolean equals(Object o) {
return !(o == null || !(o instanceof Group)) && name.equalsIgnoreCase(((Group) o).getName());
}
@Override
public String toString() {
return "Group{name=" + name + "}";
}
@Override
public String toString() {
return "Group{name=" + name + "}";
}
@Override
public int hashCode() {
return name.hashCode();
}
@Override
public int hashCode() {
return name.hashCode();
}
}

View File

@ -26,7 +26,7 @@ public class PermissionsPlugin extends JavaPlugin {
* Get the group with the given name.
*
* @param groupName
* The name of the group.
* The name of the group.
* @return A Group if it exists or null otherwise.
*/
public Group getGroup(String groupName) {
@ -40,7 +40,7 @@ public class PermissionsPlugin extends JavaPlugin {
* Returns a list of groups a player is in.
*
* @param playerName
* The name of the player.
* The name of the player.
* @return The groups this player is in. May be empty.
*/
public List<Group> getGroups(String playerName) {