Add hasMember methods

This commit is contained in:
TfT_02 2014-08-07 15:31:46 -07:00 committed by TfT_02
parent cc2c2c3254
commit e8b54cd537
3 changed files with 10 additions and 2 deletions

View File

@ -22,7 +22,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName); OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
if (!playerParty.getMembers().values().contains(target.getUniqueId())) { if (!playerParty.hasMember(target.getUniqueId())) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true; return true;
} }

View File

@ -22,7 +22,7 @@ public class PartyKickCommand implements CommandExecutor {
Party playerParty = UserManager.getPlayer((Player) sender).getParty(); Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
if (!playerParty.getMembers().keySet().contains(targetName)) { if (!playerParty.hasMember(targetName)) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true; return true;
} }

View File

@ -306,6 +306,14 @@ public class Party {
} }
} }
public boolean hasMember(String memberName) {
return this.getMembers().keySet().contains(memberName);
}
public boolean hasMember(UUID uuid) {
return this.getMembers().values().contains(uuid);
}
public String createMembersList(String playerName, List<Player> nearMembers) { public String createMembersList(String playerName, List<Player> nearMembers) {
StringBuilder memberList = new StringBuilder(); StringBuilder memberList = new StringBuilder();