mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
Fix displayname placeholder and add nickname/username
This commit is contained in:
1 parent
22e555900f
commit
15f31ef55d
1 file changed
+12
-7
@@ -130,16 +130,17 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
|
|
||||||
final String displayName;
|
final String displayName;
|
||||||
|
|
||||||
if (user.nickname() != null) {
|
if (user.online()) {
|
||||||
displayName = user.nickname();
|
displayName = user.player().getDisplayName();
|
||||||
} else {
|
} else {
|
||||||
if (user.online()) {
|
displayName = user.offlinePlayer().getName();
|
||||||
displayName = user.player().getDisplayName();
|
|
||||||
} else {
|
|
||||||
displayName = user.offlinePlayer().getName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String offlinePlayerName = user.offlinePlayer().getName();
|
||||||
|
|
||||||
|
final String nickname = user.nickname() == null ? "" : user.nickname();
|
||||||
|
final String username = offlinePlayerName == null ? "" : offlinePlayerName;
|
||||||
|
|
||||||
// Iterate through players who should receive messages in this channel
|
// Iterate through players who should receive messages in this channel
|
||||||
for (final ChatUser target : recipients) {
|
for (final ChatUser target : recipients) {
|
||||||
// Call second format event. Used for relational stuff (placeholders etc)
|
// Call second format event. Used for relational stuff (placeholders etc)
|
||||||
@@ -157,6 +158,8 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
TextComponent formatComponent = (TextComponent) this.carbonChat.adventureManager().processMessage(formatEvent.format(),
|
TextComponent formatComponent = (TextComponent) this.carbonChat.adventureManager().processMessage(formatEvent.format(),
|
||||||
"br", "\n",
|
"br", "\n",
|
||||||
"displayname", displayName,
|
"displayname", displayName,
|
||||||
|
"nickname", nickname,
|
||||||
|
"username", username,
|
||||||
"color", "<" + targetColor.asHexString() + ">",
|
"color", "<" + targetColor.asHexString() + ">",
|
||||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
"phase", Long.toString(System.currentTimeMillis() % 25),
|
||||||
"server", this.carbonChat.getConfig().getString("server-name", "Server"),
|
"server", this.carbonChat.getConfig().getString("server-name", "Server"),
|
||||||
@@ -187,6 +190,8 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
final TextComponent consoleFormat = (TextComponent) this.carbonChat.adventureManager().processMessage(consoleFormatEvent.format(),
|
final TextComponent consoleFormat = (TextComponent) this.carbonChat.adventureManager().processMessage(consoleFormatEvent.format(),
|
||||||
"br", "\n",
|
"br", "\n",
|
||||||
"displayname", displayName,
|
"displayname", displayName,
|
||||||
|
"nickname", nickname,
|
||||||
|
"username", username,
|
||||||
"color", "<" + targetColor.asHexString() + ">",
|
"color", "<" + targetColor.asHexString() + ">",
|
||||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
"phase", Long.toString(System.currentTimeMillis() % 25),
|
||||||
"server", this.carbonChat.getConfig().getString("server-name", "Server"),
|
"server", this.carbonChat.getConfig().getString("server-name", "Server"),
|
||||||
|
|||||||
Reference in new issue
Block a user