mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Tweaks to the party info commands
This commit is contained in:
parent
371a3ceec7
commit
025183d434
@ -9,6 +9,7 @@ Key:
|
||||
Version 2.1.7
|
||||
Fixed an almost 6 year old bug where Salvage materials did not have a defined material count so they defaulted to 2 (which could lead to shovels giving back more diamonds than normal)
|
||||
Added spam detection for Unarmed's bonus damage and disarm
|
||||
Corrected an error where master angler for retro only required level 150 instead of 500 (update your skillranks.yml)
|
||||
(API) Added addXpFromBlocks to ExperienceAPI to help make adding XP for a player easier
|
||||
(API) Added addXpFromBlocksBySkill to ExperienceAPI to help make adding XP for a player easier
|
||||
(API) Added addXpFromBlock to ExperienceAPI to help make adding XP for a player easier
|
||||
|
@ -120,10 +120,10 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
*/
|
||||
|
||||
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer);
|
||||
int membersOnline = party.getVisibleMembers(player).size() - 1;
|
||||
int membersOnline = party.getVisibleMembers(player).size();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size(), membersOnline));
|
||||
player.sendMessage(party.createMembersList(player.getName(), nearMembers));
|
||||
player.sendMessage(party.createMembersList(player));
|
||||
}
|
||||
}
|
||||
|
@ -126,8 +126,8 @@ public class PartyAllianceCommand implements TabExecutor {
|
||||
private void displayMemberInfo(McMMOPlayer mcMMOPlayer) {
|
||||
List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer);
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Members.Header"));
|
||||
player.sendMessage(playerParty.createMembersList(player.getName(), nearMembers));
|
||||
player.sendMessage(playerParty.createMembersList(player));
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "----------------------------");
|
||||
player.sendMessage(targetParty.createMembersList(player.getName(), nearMembers));
|
||||
player.sendMessage(targetParty.createMembersList(player));
|
||||
}
|
||||
}
|
||||
|
@ -76,13 +76,13 @@ public class Party {
|
||||
return onlineMembers;
|
||||
}
|
||||
|
||||
public List<Player> getVisibleMembers(Player commandSender)
|
||||
public List<Player> getVisibleMembers(Player player)
|
||||
{
|
||||
ArrayList<Player> visibleMembers = new ArrayList<>();
|
||||
|
||||
for(Player p : onlineMembers)
|
||||
{
|
||||
if(commandSender.canSee(p))
|
||||
if(player.canSee(p) && p.canSee(p))
|
||||
visibleMembers.add(p);
|
||||
}
|
||||
|
||||
@ -325,30 +325,27 @@ public class Party {
|
||||
return this.getMembers().keySet().contains(uuid);
|
||||
}
|
||||
|
||||
public String createMembersList(String playerName, List<Player> nearMembers) {
|
||||
public String createMembersList(Player player) {
|
||||
StringBuilder memberList = new StringBuilder();
|
||||
|
||||
for (Entry<UUID, String> memberEntry : this.getMembers().entrySet()) {
|
||||
UUID uuid = memberEntry.getKey();
|
||||
String memberName = memberEntry.getValue();
|
||||
for (Player otherPlayer : this.getVisibleMembers(player)) {
|
||||
String memberName = otherPlayer.getName();
|
||||
|
||||
Player member = mcMMO.p.getServer().getPlayer(uuid);
|
||||
|
||||
if (this.getLeader().getUniqueId().equals(uuid)) {
|
||||
if (this.getLeader().getUniqueId().equals(player.getUniqueId())) {
|
||||
memberList.append(ChatColor.GOLD);
|
||||
|
||||
if (member == null) {
|
||||
if (otherPlayer == null) {
|
||||
memberName = memberName.substring(0, 1) + ChatColor.GRAY + ChatColor.ITALIC + "" + memberName.substring(1);
|
||||
}
|
||||
}
|
||||
else if (member != null) {
|
||||
else if (otherPlayer != null) {
|
||||
memberList.append(ChatColor.WHITE);
|
||||
}
|
||||
else {
|
||||
memberList.append(ChatColor.GRAY);
|
||||
}
|
||||
|
||||
if (!nearMembers.contains(member) && !playerName.equalsIgnoreCase(memberName)) {
|
||||
if (player.getName().equalsIgnoreCase(otherPlayer.getName())) {
|
||||
memberList.append(ChatColor.ITALIC);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,9 @@ public final class PartyManager {
|
||||
double range = Config.getInstance().getPartyShareRange();
|
||||
|
||||
for (Player member : party.getVisibleMembers(player)) {
|
||||
if (!player.equals(member) && member.isValid() && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
|
||||
if (!player.equals(member)
|
||||
&& member.isValid()
|
||||
&& Misc.isNear(player.getLocation(), member.getLocation(), range)) {
|
||||
nearMembers.add(member);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user