Cleanup Javadocs and fix StackOverflowError

This commit is contained in:
TfT_02 2013-08-26 22:08:45 +02:00
parent 435522415d
commit df29306a1f
2 changed files with 20 additions and 16 deletions

View File

@ -97,7 +97,7 @@ public class McMMOPlayer {
this.player = player; this.player = player;
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, true); profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, true);
party = PartyManager.getParty(player); party = PartyManager.getPlayerParty(playerName);
/* /*
* I'm using this method because it makes code shorter and safer (we don't have to add all SkillTypes manually), * I'm using this method because it makes code shorter and safer (we don't have to add all SkillTypes manually),

View File

@ -5,16 +5,15 @@ import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.ItemShareType;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.ItemShareType;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
@ -93,7 +92,6 @@ public final class PartyManager {
* Get the near party members. * Get the near party members.
* *
* @param mcMMOPlayer The player to check * @param mcMMOPlayer The player to check
* @param range The distance
* @return the near party members * @return the near party members
*/ */
public static List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) { public static List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) {
@ -166,6 +164,22 @@ public final class PartyManager {
return null; return null;
} }
/**
* Retrieve a party by a members name
*
* @param playerName The members name
* @return the existing party, null otherwise
*/
public static Party getPlayerParty(String playerName) {
for (Party party : parties) {
if (party.getMembers().contains(playerName)) {
return party;
}
}
return null;
}
/** /**
* Retrieve a party by member * Retrieve a party by member
* *
@ -179,13 +193,7 @@ public final class PartyManager {
return mcMMOPlayer.getParty(); return mcMMOPlayer.getParty();
} }
for (Party party : parties) { return getPlayerParty(player.getName());
if (party.getMembers().contains(player.getName())) {
return party;
}
}
return null;
} }
/** /**
@ -248,7 +256,6 @@ public final class PartyManager {
/** /**
* Create a new party * Create a new party
* *
* @param player The player to add to the party
* @param mcMMOPlayer The player to add to the party * @param mcMMOPlayer The player to add to the party
* @param partyName The party to add the player to * @param partyName The party to add the player to
* @param password The password for this party, null if there was no password * @param password The password for this party, null if there was no password
@ -303,7 +310,6 @@ public final class PartyManager {
/** /**
* Accept a party invitation * Accept a party invitation
* *
* @param player The player to add to the party
* @param mcMMOPlayer The player to add to the party * @param mcMMOPlayer The player to add to the party
*/ */
public static void joinInvitedParty(McMMOPlayer mcMMOPlayer) { public static void joinInvitedParty(McMMOPlayer mcMMOPlayer) {
@ -374,8 +380,6 @@ public final class PartyManager {
/** /**
* Check if a player can invite others to his party. * Check if a player can invite others to his party.
* *
* @param playerName The name of the player to check
* @param party The party to check
* @return true if the player can invite * @return true if the player can invite
*/ */
public static boolean canInvite(McMMOPlayer mcMMOPlayer) { public static boolean canInvite(McMMOPlayer mcMMOPlayer) {