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

View File

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