mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
party leader has unique chat style
This commit is contained in:
parent
1f02d9a5a0
commit
5a8e607a39
@ -4,6 +4,7 @@ Version 2.1.151
|
|||||||
All chat settings that used to be in 'config.yml' are now in 'chat.yml'
|
All chat settings that used to be in 'config.yml' are now in 'chat.yml'
|
||||||
The list of party members shown when using the party command has been simplified, this will change again in the T&C update
|
The list of party members shown when using the party command has been simplified, this will change again in the T&C update
|
||||||
Fixed a bug where players could use the party chat command without the party chat permission
|
Fixed a bug where players could use the party chat command without the party chat permission
|
||||||
|
Added 'Chat.Style.Party.Leader' which is the chat style the party leader uses when communicating to the party
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
I greatly disliked the old party member list but was avoiding rewriting it until later, someone pointed out how ugly it was and my OCD triggered and now it is rewritten. I will rewrite it again in T&C.
|
I greatly disliked the old party member list but was avoiding rewriting it until later, someone pointed out how ugly it was and my OCD triggered and now it is rewritten. I will rewrite it again in T&C.
|
||||||
|
@ -73,7 +73,7 @@ public class ChatManager {
|
|||||||
adminChatMailer.processChatMessage(mmoPlayer.getAdminAuthor(), rawMessage, isAsync, Permissions.colorChat(mmoPlayer.getPlayer()));
|
adminChatMailer.processChatMessage(mmoPlayer.getAdminAuthor(), rawMessage, isAsync, Permissions.colorChat(mmoPlayer.getPlayer()));
|
||||||
break;
|
break;
|
||||||
case PARTY:
|
case PARTY:
|
||||||
partyChatMailer.processChatMessage(mmoPlayer.getPartyAuthor(), rawMessage, mmoPlayer.getParty(), isAsync, Permissions.colorChat(mmoPlayer.getPlayer()));
|
partyChatMailer.processChatMessage(mmoPlayer.getPartyAuthor(), rawMessage, mmoPlayer.getParty(), isAsync, Permissions.colorChat(mmoPlayer.getPlayer()), isPartyLeader(mmoPlayer));
|
||||||
break;
|
break;
|
||||||
case PARTY_OFFICER:
|
case PARTY_OFFICER:
|
||||||
case NONE:
|
case NONE:
|
||||||
@ -81,6 +81,10 @@ public class ChatManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isPartyLeader(@NotNull McMMOPlayer mmoPlayer) {
|
||||||
|
return mmoPlayer.getParty().getLeader().getUniqueId().equals(mmoPlayer.getPlayer().getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles console messaging to admins
|
* Handles console messaging to admins
|
||||||
* @param rawMessage raw message from the console
|
* @param rawMessage raw message from the console
|
||||||
@ -103,7 +107,7 @@ public class ChatManager {
|
|||||||
* @param party target party
|
* @param party target party
|
||||||
*/
|
*/
|
||||||
public void processConsoleMessage(@NotNull String rawMessage, @NotNull Party party) {
|
public void processConsoleMessage(@NotNull String rawMessage, @NotNull Party party) {
|
||||||
partyChatMailer.processChatMessage(getConsoleAuthor(), rawMessage, party, false, true);
|
partyChatMailer.processChatMessage(getConsoleAuthor(), rawMessage, party, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,8 +21,8 @@ public class PartyChatMailer extends AbstractChatMailer {
|
|||||||
super(pluginRef);
|
super(pluginRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor) {
|
public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor, boolean isLeader) {
|
||||||
PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor), party);
|
PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor, isLeader), party);
|
||||||
|
|
||||||
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||||
@ -43,9 +43,13 @@ public class PartyChatMailer extends AbstractChatMailer {
|
|||||||
* @param canColor whether to replace colors codes with colors in the raw message
|
* @param canColor whether to replace colors codes with colors in the raw message
|
||||||
* @return the styled string, based on a locale entry
|
* @return the styled string, based on a locale entry
|
||||||
*/
|
*/
|
||||||
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
|
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
|
||||||
if(canColor) {
|
if(canColor) {
|
||||||
return Component.text(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(), LocaleLoader.addColors(message)));
|
message = LocaleLoader.addColors(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isLeader) {
|
||||||
|
return Component.text(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(), message));
|
||||||
} else {
|
} else {
|
||||||
return Component.text(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(), message));
|
return Component.text(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(), message));
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,10 @@ import org.bukkit.entity.Player;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public class Party {
|
public class Party {
|
||||||
@ -347,7 +350,7 @@ public class Party {
|
|||||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
|
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
|
||||||
|
|
||||||
if(offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
|
if(offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
|
||||||
ChatColor onlineColor = leader.getUniqueId() == playerUUID ? ChatColor.GOLD : ChatColor.GREEN;
|
ChatColor onlineColor = leader.getUniqueId().equals(playerUUID) ? ChatColor.GOLD : ChatColor.GREEN;
|
||||||
coloredNames.add(onlineColor + offlinePlayer.getName());
|
coloredNames.add(onlineColor + offlinePlayer.getName());
|
||||||
} else {
|
} else {
|
||||||
coloredNames.add(ChatColor.DARK_GRAY + members.get(playerUUID));
|
coloredNames.add(ChatColor.DARK_GRAY + members.get(playerUUID));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ChatConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
@ -1120,6 +1120,7 @@ Commands.XPBar.DisableAll=&6 All mcMMO XP bars are now disabled, use /mmoxpbar r
|
|||||||
#Modern Chat Settings
|
#Modern Chat Settings
|
||||||
Chat.Style.Admin=&b(A) &r{0} &b\u2192 &r{1}
|
Chat.Style.Admin=&b(A) &r{0} &b\u2192 &r{1}
|
||||||
Chat.Style.Party=&a(P) &r{0} &a\u2192 &r{1}
|
Chat.Style.Party=&a(P) &r{0} &a\u2192 &r{1}
|
||||||
|
Chat.Style.Party.Leader=&a(P) &r{0} &6\u2192 &r{1}
|
||||||
Chat.Identity.Console=&6* Console *
|
Chat.Identity.Console=&6* Console *
|
||||||
Chat.Channel.On=&6(&amcMMO-Chat&6) &eYour chat messages will now be automatically delivered to the &a{0}&e chat channel.
|
Chat.Channel.On=&6(&amcMMO-Chat&6) &eYour chat messages will now be automatically delivered to the &a{0}&e chat channel.
|
||||||
Chat.Channel.Off=&6(&amcMMO-Chat&6) &7Your chat messages will no longer be automatically delivered to specific chat channels.
|
Chat.Channel.Off=&6(&amcMMO-Chat&6) &7Your chat messages will no longer be automatically delivered to specific chat channels.
|
||||||
|
Loading…
Reference in New Issue
Block a user