mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Party member list will only contain players visible to the player
This commit is contained in:
parent
d5a4103858
commit
400e15b559
@ -35,6 +35,7 @@ Version 2.1.0
|
|||||||
= (Skills) Added missing mushroom blocks to experience.yml defaults
|
= (Skills) Added missing mushroom blocks to experience.yml defaults
|
||||||
= (Skills) Tridents will no longer be considered unarmed
|
= (Skills) Tridents will no longer be considered unarmed
|
||||||
= (MySQL) You can now inspect offline players
|
= (MySQL) You can now inspect offline players
|
||||||
|
! (Party) Party member list will only include members of the party that you can see (aren't vanished)
|
||||||
! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default)
|
! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default)
|
||||||
! (Skills) Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use
|
! (Skills) Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use
|
||||||
! (Skills) Acrobatics' Roll exploit detection was tweaked to still allow for Roll to trigger even if it rewards no XP
|
! (Skills) Acrobatics' Roll exploit detection was tweaked to still allow for Roll to trigger even if it rewards no XP
|
||||||
|
@ -116,8 +116,12 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void displayMemberInfo(Player player, McMMOPlayer mcMMOPlayer, Party party) {
|
private void displayMemberInfo(Player player, McMMOPlayer mcMMOPlayer, Party party) {
|
||||||
List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer);
|
/*
|
||||||
int membersOnline = party.getOnlineMembers().size() - 1;
|
* Only show members of the party that this member can see
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer);
|
||||||
|
int membersOnline = party.getVisibleMembers(player).size() - 1;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size(), membersOnline));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size(), membersOnline));
|
||||||
|
@ -76,6 +76,19 @@ public class Party {
|
|||||||
return onlineMembers;
|
return onlineMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Player> getVisibleMembers(Player commandSender)
|
||||||
|
{
|
||||||
|
ArrayList<Player> visibleMembers = new ArrayList<>();
|
||||||
|
|
||||||
|
for(Player p : onlineMembers)
|
||||||
|
{
|
||||||
|
if(commandSender.canSee(p))
|
||||||
|
visibleMembers.add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return visibleMembers;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getOnlinePlayerNames(CommandSender sender) {
|
public List<String> getOnlinePlayerNames(CommandSender sender) {
|
||||||
Player player = sender instanceof Player ? (Player) sender : null;
|
Player player = sender instanceof Player ? (Player) sender : null;
|
||||||
List<String> onlinePlayerNames = new ArrayList<String>();
|
List<String> onlinePlayerNames = new ArrayList<String>();
|
||||||
|
@ -128,6 +128,25 @@ public final class PartyManager {
|
|||||||
return nearMembers;
|
return nearMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Player> getNearVisibleMembers(McMMOPlayer mcMMOPlayer) {
|
||||||
|
List<Player> nearMembers = new ArrayList<Player>();
|
||||||
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
|
if (party != null) {
|
||||||
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
double range = Config.getInstance().getPartyShareRange();
|
||||||
|
|
||||||
|
for (Player member : party.getVisibleMembers(player)) {
|
||||||
|
if (!player.equals(member) && member.isValid() && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
|
||||||
|
nearMembers.add(member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nearMembers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all players in this player's party.
|
* Get a list of all players in this player's party.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user