Skip to content

Commit

Permalink
Melhoria do /party info
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock committed Feb 21, 2024
1 parent 3e6e7d7 commit 8a90ee3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
Expand Down Expand Up @@ -79,13 +78,14 @@ private void displayPartyFeatures(Player player, Party party) {

if (isUnlockedFeature(party, partyFeature)) {
unlockedPartyFeatures.add(partyFeature.getLocaleString());
}
else {
} else {
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
}
}

player.sendMessage(LocaleLoader.getString("Commands.Party.UnlockedFeatures", unlockedPartyFeatures.isEmpty() ? "Nenhum" : unlockedPartyFeatures));
for (String message : unlockedPartyFeatures) {
player.sendMessage(message);
}

for (String message : lockedPartyFeatures) {
player.sendMessage(message);
Expand All @@ -110,11 +110,11 @@ private void displayShareModeInfo(Player player, Party party) {
String separator = "";

if (xpShareEnabled) {
expShareInfo = LocaleLoader.getString("Commands.Party.ExpShare", party.getXpShareMode().toString());
expShareInfo = LocaleLoader.getString("Commands.Party.ExpShare", party.getXpShareMode().customName());
}

if (itemShareEnabled) {
itemShareInfo = LocaleLoader.getString("Commands.Party.ItemShare", party.getItemShareMode().toString());
itemShareInfo = LocaleLoader.getString("Commands.Party.ItemShare", party.getItemShareMode().customName());
}

if (xpShareEnabled && itemShareEnabled) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/gmail/nossr50/datatypes/party/Party.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public List<Player> getVisibleMembers(Player player) {
}

public List<String> getOnlinePlayerNames(CommandSender sender) {
Player player = sender instanceof Player ? (Player) sender : null;
Player player = sender instanceof Player p ? p : null;
List<String> onlinePlayerNames = new ArrayList<>();

for (Player onlinePlayer : getOnlineMembers()) {
Expand Down Expand Up @@ -240,13 +240,13 @@ public void applyXpGain(float xp) {
}

if (!mcMMO.p.getGeneralConfig().getPartyInformAllMembers()) {
Player leader = mcMMO.p.getServer().getPlayer(this.leader.getUniqueId());
Player partyLeader = mcMMO.p.getServer().getPlayer(this.leader.getUniqueId());

if (leader != null) {
leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
if (partyLeader != null) {
partyLeader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));

if (mcMMO.p.getGeneralConfig().getLevelUpSoundsEnabled()) {
SoundManager.sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
SoundManager.sendSound(partyLeader, partyLeader.getLocation(), SoundType.LEVEL_UP);
}
}
} else {
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/gmail/nossr50/datatypes/party/ShareMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import org.jetbrains.annotations.Nullable;

public enum ShareMode {
NONE("nenhum"),
EQUAL("igual"),
RANDOM("aleatorio");
NONE("Nenhum"),
EQUAL("Igual"),
RANDOM("Aleatorio");
private final String customName;

ShareMode(String customName) {
Expand All @@ -23,4 +23,8 @@ public enum ShareMode {
}
return null;
}

public String customName() {
return customName;
}
}

0 comments on commit 8a90ee3

Please sign in to comment.