Better feedback when trying to join a password protected party.

This commit is contained in:
TfT_02 2013-01-26 15:38:57 +01:00
parent 56e16acce4
commit b91b88a74b
2 changed files with 6 additions and 7 deletions

View File

@ -176,7 +176,6 @@ public class PartyManager {
*/ */
public void removeFromParty(String playerName, Party party) { public void removeFromParty(String playerName, Party party) {
List<String> members = party.getMembers(); List<String> members = party.getMembers();
List<Player> onlineMembers = party.getOnlineMembers();
members.remove(playerName); members.remove(playerName);
@ -184,12 +183,10 @@ public class PartyManager {
parties.remove(party); parties.remove(party);
} }
else { else {
//If the leaving player was the party leader, appoint a new leader from the online party members //If the leaving player was the party leader, appoint a new leader from the party members
if (party.getLeader().equals(playerName)) { if (party.getLeader().equals(playerName)) {
if (!onlineMembers.isEmpty()) { String newLeader = members.get(0);
Player newLeader = onlineMembers.get(0); party.setLeader(newLeader);
party.setLeader(newLeader.getName());
}
} }
informPartyMembersQuit(playerName, party); informPartyMembersQuit(playerName, party);
@ -309,7 +306,8 @@ public class PartyManager {
if (partyPassword != null) { if (partyPassword != null) {
if (password == null) { if (password == null) {
player.sendMessage(LocaleLoader.getString("Party.Help.1")); player.sendMessage(LocaleLoader.getString("Party.Password.None"));
player.sendMessage(LocaleLoader.getString("Commands.Usage.3", new Object[] {"party", "join", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">", "<" + LocaleLoader.getString("Commands.Usage.Password") + ">"}));
return false; return false;
} }
else if (!password.equals(partyPassword)) { else if (!password.equals(partyPassword)) {

View File

@ -509,6 +509,7 @@ Party.NotOwner=[[DARK_RED]]You are not the party leader.
Party.Owner.New=[[GREEN]]{0} is the new party leader. Party.Owner.New=[[GREEN]]{0} is the new party leader.
Party.Owner.NotLeader=[[DARK_RED]]You are no longer the party leader. Party.Owner.NotLeader=[[DARK_RED]]You are no longer the party leader.
Party.Owner.Player =[[GREEN]]You are now the party leader. Party.Owner.Player =[[GREEN]]You are now the party leader.
Party.Password.None=[[RED]]This party is password protected.
Party.Password.Incorrect=[[RED]]Party password is incorrect. Party.Password.Incorrect=[[RED]]Party password is incorrect.
Party.NotOnline=[[DARK_RED]]{0} is not online! Party.NotOnline=[[DARK_RED]]{0} is not online!
Party.PasswordSet=[[GREEN]]Party password set to {0} Party.PasswordSet=[[GREEN]]Party password set to {0}