Cleaned up inSameParty method

This commit is contained in:
GJ 2012-06-28 08:14:30 -04:00
parent 565ef693ce
commit 9ba5360bfc

View File

@ -41,18 +41,10 @@ public class PartyManager {
* @return true if they are in the same party, false otherwise * @return true if they are in the same party, false otherwise
*/ */
public boolean inSameParty(Player firstPlayer, Player secondPlayer) { public boolean inSameParty(Player firstPlayer, Player secondPlayer) {
if (Users.getProfile(firstPlayer) == null) { Party firstParty = Users.getProfile(firstPlayer).getParty();
plugin.getLogger().info("The defending player's profile was null."); Party secondParty = Users.getProfile(secondPlayer).getParty();
plugin.getLogger().info("This player is online: " + firstPlayer.isOnline());
return false;
}
if (Users.getProfile(secondPlayer) == null) { if (firstParty == null || secondParty == null || firstParty != secondParty) {
plugin.getLogger().info("The attacking player's profile was null.");
plugin.getLogger().info("This player is online: " + secondPlayer.isOnline());
return false;
}
if (Users.getProfile(firstPlayer).getParty() == null || Users.getProfile(secondPlayer).getParty() == null || !Users.getProfile(firstPlayer).getParty().equals(Users.getProfile(secondPlayer).getParty())) {
return false; return false;
} }