mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-29 12:14:43 +02:00
party leader has unique chat style
This commit is contained in:
@ -73,7 +73,7 @@ public class ChatManager {
|
||||
adminChatMailer.processChatMessage(mmoPlayer.getAdminAuthor(), rawMessage, isAsync, Permissions.colorChat(mmoPlayer.getPlayer()));
|
||||
break;
|
||||
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;
|
||||
case PARTY_OFFICER:
|
||||
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
|
||||
* @param rawMessage raw message from the console
|
||||
@ -103,7 +107,7 @@ public class ChatManager {
|
||||
* @param party target 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);
|
||||
}
|
||||
|
||||
public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor) {
|
||||
PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor), party);
|
||||
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, isLeader), party);
|
||||
|
||||
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
||||
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
|
||||
* @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) {
|
||||
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 {
|
||||
return Component.text(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(), message));
|
||||
}
|
||||
|
Reference in New Issue
Block a user