From e8b54cd5370389f1601d36aab66432c0ac742b47 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Thu, 7 Aug 2014 15:31:46 -0700 Subject: [PATCH] Add hasMember methods --- .../nossr50/commands/party/PartyChangeOwnerCommand.java | 2 +- .../gmail/nossr50/commands/party/PartyKickCommand.java | 2 +- .../java/com/gmail/nossr50/datatypes/party/Party.java | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyChangeOwnerCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyChangeOwnerCommand.java index d81cc4c39..2b822bcfb 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyChangeOwnerCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyChangeOwnerCommand.java @@ -22,7 +22,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor { String targetName = CommandUtils.getMatchedPlayerName(args[1]); 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)); return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyKickCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyKickCommand.java index ea782a9b5..c9afa3369 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyKickCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyKickCommand.java @@ -22,7 +22,7 @@ public class PartyKickCommand implements CommandExecutor { Party playerParty = UserManager.getPlayer((Player) sender).getParty(); String targetName = CommandUtils.getMatchedPlayerName(args[1]); - if (!playerParty.getMembers().keySet().contains(targetName)) { + if (!playerParty.hasMember(targetName)) { sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); return true; } diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java index 038c0b65e..4dd9f0532 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java @@ -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 nearMembers) { StringBuilder memberList = new StringBuilder();