mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +00:00
Revert component changes - fixes colours
This commit is contained in:
1 parent
bbb07752fb
commit
986475b2b9
3 files changed
+9
-30
No files matched your search
@@ -128,7 +128,8 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
"displayname", displayName,
|
"displayname", displayName,
|
||||||
"color", "<" + targetColor.asHexString() + ">",
|
"color", "<" + targetColor.asHexString() + ">",
|
||||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
"phase", Long.toString(System.currentTimeMillis() % 25),
|
||||||
"server", carbonChat.getConfig().getString("server-name", "Server"));
|
"server", carbonChat.getConfig().getString("server-name", "Server"),
|
||||||
|
"message", formatEvent.getMessage());
|
||||||
|
|
||||||
if (isUserSpying(user, target)) {
|
if (isUserSpying(user, target)) {
|
||||||
String prefix = processPlaceholders(user, carbonChat.getConfig().getString("spy-prefix"));
|
String prefix = processPlaceholders(user, carbonChat.getConfig().getString("spy-prefix"));
|
||||||
@@ -137,24 +138,7 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
targetColor.asHexString()).append(formatComponent);
|
targetColor.asHexString()).append(formatComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextComponent messageComponent;
|
ChatComponentEvent newEvent = new ChatComponentEvent(user, target, this, formatComponent,
|
||||||
|
|
||||||
if (user.isOnline() && user.asPlayer().hasPermission("carbonchat.formatting")) {
|
|
||||||
messageComponent = (TextComponent) carbonChat.getAdventureManager().processMessage("<color>" + formatEvent.getMessage(),
|
|
||||||
"br", "\n",
|
|
||||||
"displayname", displayName,
|
|
||||||
"color", "<" + targetColor.asHexString() + ">",
|
|
||||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
|
||||||
"server", carbonChat.getConfig().getString("server-name", "Server"));
|
|
||||||
} else {
|
|
||||||
messageComponent = TextComponent.of(formatEvent.getMessage()).color(targetColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextComponent processedComponent = (TextComponent)formatComponent.replaceFirstText(MESSAGE_PATTERN, (input) -> {
|
|
||||||
return messageComponent.toBuilder();
|
|
||||||
});
|
|
||||||
|
|
||||||
ChatComponentEvent newEvent = new ChatComponentEvent(user, target, this, processedComponent,
|
|
||||||
formatEvent.getMessage());
|
formatEvent.getMessage());
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(newEvent);
|
Bukkit.getPluginManager().callEvent(newEvent);
|
||||||
@@ -174,15 +158,10 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
"displayname", displayName,
|
"displayname", displayName,
|
||||||
"color", "<" + targetColor.asHexString() + ">",
|
"color", "<" + targetColor.asHexString() + ">",
|
||||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
"phase", Long.toString(System.currentTimeMillis() % 25),
|
||||||
"server", carbonChat.getConfig().getString("server-name", "Server"));
|
"server", carbonChat.getConfig().getString("server-name", "Server"),
|
||||||
|
"message", consoleFormatEvent.getMessage());
|
||||||
|
|
||||||
TextComponent consoleMessage = TextComponent.of(consoleFormatEvent.getMessage());
|
ChatComponentEvent consoleEvent = new ChatComponentEvent(user, null, this, consoleFormat,
|
||||||
|
|
||||||
TextComponent consoleComponent = (TextComponent)consoleFormat.replaceFirstText(MESSAGE_PATTERN, (input) -> {
|
|
||||||
return consoleMessage.toBuilder();
|
|
||||||
});
|
|
||||||
|
|
||||||
ChatComponentEvent consoleEvent = new ChatComponentEvent(user, null, this, consoleComponent,
|
|
||||||
consoleFormatEvent.getMessage());
|
consoleFormatEvent.getMessage());
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(consoleEvent);
|
Bukkit.getPluginManager().callEvent(consoleEvent);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ public class UserFormattingListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getUser().asPlayer();
|
Player player = event.getUser().asPlayer();
|
||||||
|
|
||||||
if (!(player.hasPermission("carbonchat.formatting") ||
|
if (!player.hasPermission("carbonchat.formatting") &&
|
||||||
player.hasPermission("carbonchat.channels." + event.getChannel().getKey() + ".formatting"))) {
|
!player.hasPermission("carbonchat.channels." + event.getChannel().getKey() + ".formatting")) {
|
||||||
suppressFormatting(event);
|
suppressFormatting(event);
|
||||||
} else {
|
} else {
|
||||||
// Swap the &-style codes for minimessage-compatible strings
|
// Swap the &-style codes for minimessage-compatible strings
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# 'MineDown': https://github.com/Phoenix616/MineDown#syntax
|
# 'MineDown': https://github.com/Phoenix616/MineDown#syntax
|
||||||
# 'JSON': https://minecraft.gamepedia.com/Raw_JSON_text_format
|
# 'JSON': https://minecraft.gamepedia.com/Raw_JSON_text_format
|
||||||
# Note that the messages provided in the default config utilise MiniMessage, and need to be changed if you're using MineDown
|
# Note that the messages provided in the default config utilise MiniMessage, and need to be changed if you're using MineDown
|
||||||
# Please DO NOT use JSON formatting unless you really know what you're doing.
|
# Please DO NOT use JSON formatting unless you really know what you're doing
|
||||||
formatting:
|
formatting:
|
||||||
type: 'MiniMessage'
|
type: 'MiniMessage'
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user