Update minimessage references
This commit is contained in:
parent
0997c2bab6
commit
c836452d19
|
|
@ -45,8 +45,8 @@ public class ChatUser {
|
||||||
//
|
//
|
||||||
// prefixAll = Utility.getPrefix(uuid, false);
|
// prefixAll = Utility.getPrefix(uuid, false);
|
||||||
|
|
||||||
replyTarget = null;
|
replyTarget = "";
|
||||||
replyContinueTarget = null;
|
replyContinueTarget = "";
|
||||||
gcCooldown = System.currentTimeMillis(); // players can't use gc for 30 seconds after logging in if we use this?
|
gcCooldown = System.currentTimeMillis(); // players can't use gc for 30 seconds after logging in if we use this?
|
||||||
mails = Queries.getMails(uuid);
|
mails = Queries.getMails(uuid);
|
||||||
ignoredPlayers = Queries.getIgnoredUsers(uuid);
|
ignoredPlayers = Queries.getIgnoredUsers(uuid);
|
||||||
|
|
@ -104,7 +104,7 @@ public class ChatUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReplyContinueTarget() {
|
public String getReplyContinueTarget() {
|
||||||
return replyTarget;
|
return replyContinueTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReplyTarget(String replyTarget) {
|
public void setReplyTarget(String replyTarget) {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ tasks {
|
||||||
exclude { it.moduleName == "velocity" }
|
exclude { it.moduleName == "velocity" }
|
||||||
}
|
}
|
||||||
listOf(
|
listOf(
|
||||||
"net.kyori.adventure.text.minimessage",
|
// "net.kyori.adventure.text.minimessage",
|
||||||
"org.spongepowered.configurate"
|
"org.spongepowered.configurate"
|
||||||
// ).forEach { relocate(it, "${rootProject.group}.lib.$it") }
|
// ).forEach { relocate(it, "${rootProject.group}.lib.$it") }
|
||||||
).forEach { relocate(it, "${rootProject.group}.lib.${it.substringAfterLast(".")}") }
|
).forEach { relocate(it, "${rootProject.group}.lib.${it.substringAfterLast(".")}") }
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.alttd.chat.util.Utility;
|
||||||
import com.google.common.io.ByteArrayDataOutput;
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.TextReplacementConfig;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
|
|
@ -55,19 +56,16 @@ public class ChatHandler {
|
||||||
updatedMessage = Utility.parseColors(updatedMessage);
|
updatedMessage = Utility.parseColors(updatedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updatedMessage.contains("[i]"))
|
|
||||||
updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
|
||||||
|
|
||||||
updatedMessage = Utility.formatText(updatedMessage);
|
updatedMessage = Utility.formatText(updatedMessage);
|
||||||
|
|
||||||
TagResolver placeholders = TagResolver.resolver(
|
TagResolver placeholders = TagResolver.resolver(
|
||||||
Placeholder.parsed("message", updatedMessage),
|
Placeholder.parsed("message", updatedMessage),
|
||||||
Placeholder.component("sendername", player.name()),
|
Placeholder.component("sendername", player.name()),
|
||||||
Placeholder.parsed("receivername", target),
|
Placeholder.parsed("receivername", target)
|
||||||
Placeholder.component("[i]", itemComponent(player.getInventory().getItemInMainHand()))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Component component = Utility.parseMiniMessage("<message>", placeholders);
|
Component component = Utility.parseMiniMessage("<message>", placeholders)
|
||||||
|
.replaceText(TextReplacementConfig.builder().once().matchLiteral("[i]").replacement(ChatHandler.itemComponent(player.getInventory().getItemInMainHand())).build());
|
||||||
|
|
||||||
sendPrivateMessage(player, target, "privatemessage", component);
|
sendPrivateMessage(player, target, "privatemessage", component);
|
||||||
Component spymessage = Utility.parseMiniMessage(Config.MESSAGESPY, placeholders);
|
Component spymessage = Utility.parseMiniMessage(Config.MESSAGESPY, placeholders);
|
||||||
|
|
@ -98,19 +96,16 @@ public class ChatHandler {
|
||||||
updatedMessage = Utility.parseColors(updatedMessage);
|
updatedMessage = Utility.parseColors(updatedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updatedMessage.contains("[i]"))
|
|
||||||
updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
|
||||||
|
|
||||||
updatedMessage = Utility.formatText(updatedMessage);
|
updatedMessage = Utility.formatText(updatedMessage);
|
||||||
|
|
||||||
TagResolver placeholders = TagResolver.resolver(
|
TagResolver placeholders = TagResolver.resolver(
|
||||||
Placeholder.parsed("message", updatedMessage),
|
Placeholder.parsed("message", updatedMessage),
|
||||||
Placeholder.component("sendername", player.name()),
|
Placeholder.component("sendername", player.name()),
|
||||||
Placeholder.parsed("receivername", target),
|
Placeholder.parsed("receivername", target)
|
||||||
Placeholder.component("[i]", itemComponent(player.getInventory().getItemInMainHand()))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Component component = Utility.parseMiniMessage("<message>", placeholders);
|
Component component = Utility.parseMiniMessage("<message>", placeholders)
|
||||||
|
.replaceText(TextReplacementConfig.builder().once().matchLiteral("[i]").replacement(ChatHandler.itemComponent(player.getInventory().getItemInMainHand())).build());
|
||||||
|
|
||||||
sendPrivateMessage(player, target, "privatemessage", component);
|
sendPrivateMessage(player, target, "privatemessage", component);
|
||||||
Component spymessage = Utility.parseMiniMessage(Config.MESSAGESPY, placeholders);
|
Component spymessage = Utility.parseMiniMessage(Config.MESSAGESPY, placeholders);
|
||||||
|
|
@ -158,19 +153,16 @@ public class ChatHandler {
|
||||||
updatedMessage = Utility.parseColors(updatedMessage);
|
updatedMessage = Utility.parseColors(updatedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updatedMessage.contains("[i]"))
|
|
||||||
updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
|
||||||
|
|
||||||
updatedMessage = Utility.formatText(updatedMessage);
|
updatedMessage = Utility.formatText(updatedMessage);
|
||||||
TagResolver placeholders = TagResolver.resolver(
|
TagResolver placeholders = TagResolver.resolver(
|
||||||
Placeholder.component("sender", senderName),
|
Placeholder.component("sender", senderName),
|
||||||
Placeholder.component("prefix", prefix),
|
Placeholder.component("prefix", prefix),
|
||||||
Placeholder.parsed("message", updatedMessage),
|
Placeholder.parsed("message", updatedMessage),
|
||||||
Placeholder.parsed("server", Bukkit.getServerName()),
|
Placeholder.parsed("server", Bukkit.getServerName())
|
||||||
Placeholder.component("[i]]", itemComponent(player.getInventory().getItemInMainHand()))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Component component = Utility.parseMiniMessage(Config.GCFORMAT, placeholders);
|
Component component = Utility.parseMiniMessage(Config.GCFORMAT, placeholders)
|
||||||
|
.replaceText(TextReplacementConfig.builder().once().matchLiteral("[i]").replacement(ChatHandler.itemComponent(player.getInventory().getItemInMainHand())).build());
|
||||||
user.setGcCooldown(System.currentTimeMillis());
|
user.setGcCooldown(System.currentTimeMillis());
|
||||||
sendPluginMessage(player, "globalchat", component);
|
sendPluginMessage(player, "globalchat", component);
|
||||||
}
|
}
|
||||||
|
|
@ -200,18 +192,16 @@ public class ChatHandler {
|
||||||
updatedMessage = Utility.stripTokens(updatedMessage);
|
updatedMessage = Utility.stripTokens(updatedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updatedMessage.contains("[i]")) updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
|
||||||
|
|
||||||
updatedMessage = Utility.formatText(updatedMessage);
|
updatedMessage = Utility.formatText(updatedMessage);
|
||||||
|
|
||||||
TagResolver placeholders = TagResolver.resolver(
|
TagResolver placeholders = TagResolver.resolver(
|
||||||
Placeholder.component("sender", senderName),
|
Placeholder.component("sender", senderName),
|
||||||
Placeholder.parsed("message", updatedMessage),
|
Placeholder.parsed("message", updatedMessage),
|
||||||
Placeholder.parsed("server", Bukkit.getServerName()),
|
Placeholder.parsed("server", Bukkit.getServerName()),
|
||||||
Placeholder.parsed("channel", channel.getChannelName()),
|
Placeholder.parsed("channel", channel.getChannelName())
|
||||||
Placeholder.component("[i]]", itemComponent(player.getInventory().getItemInMainHand()))
|
|
||||||
);
|
);
|
||||||
Component component = Utility.parseMiniMessage(channel.getFormat(), placeholders);
|
Component component = Utility.parseMiniMessage(channel.getFormat(), placeholders)
|
||||||
|
.replaceText(TextReplacementConfig.builder().once().matchLiteral("[i]").replacement(ChatHandler.itemComponent(player.getInventory().getItemInMainHand())).build());
|
||||||
|
|
||||||
if (channel.isProxy()) {
|
if (channel.isProxy()) {
|
||||||
sendChatChannelMessage(player, channel.getChannelName(), "chatchannel", component);
|
sendChatChannelMessage(player, channel.getChannelName(), "chatchannel", component);
|
||||||
|
|
@ -246,7 +236,7 @@ public class ChatHandler {
|
||||||
// updatedMessage = Utility.stripTokens(updatedMessage);
|
// updatedMessage = Utility.stripTokens(updatedMessage);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if(updatedMessage.contains("[i]")) updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
// if(updatedMessage.contains("[i]")) updatedMessage = updatedMessage.replaceFirst("[i]", "<item>");
|
||||||
//
|
//
|
||||||
// updatedMessage = Utility.formatText(updatedMessage);
|
// updatedMessage = Utility.formatText(updatedMessage);
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import io.papermc.paper.chat.ChatRenderer;
|
||||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.TextReplacementConfig;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
|
|
@ -64,16 +65,13 @@ public class ChatListener implements Listener, ChatRenderer {
|
||||||
message = Utility.parseColors(message);
|
message = Utility.parseColors(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(message.contains("[i]"))
|
|
||||||
message = message.replace("[i]", "<[i]>"); // end of todo
|
|
||||||
|
|
||||||
message = Utility.formatText(message);
|
message = Utility.formatText(message);
|
||||||
TagResolver placeholders = TagResolver.resolver(
|
TagResolver placeholders = TagResolver.resolver(
|
||||||
Placeholder.unparsed("message", message), // needs to be unparsed because of the placeholders repeating bug
|
Placeholder.unparsed("message", message)
|
||||||
Placeholder.component("[i]]", ChatHandler.itemComponent(player.getInventory().getItemInMainHand()))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Component component = Utility.parseMiniMessage("<message>", placeholders);
|
Component component = Utility.parseMiniMessage("<message>", placeholders)
|
||||||
|
.replaceText(TextReplacementConfig.builder().once().matchLiteral("[i]").replacement(ChatHandler.itemComponent(player.getInventory().getItemInMainHand())).build());
|
||||||
|
|
||||||
event.message(component);
|
event.message(component);
|
||||||
event.renderer(this);
|
event.renderer(this);
|
||||||
|
|
@ -88,7 +86,7 @@ public class ChatListener implements Listener, ChatRenderer {
|
||||||
Placeholder.component("prefix", user.getPrefix()),
|
Placeholder.component("prefix", user.getPrefix()),
|
||||||
Placeholder.component("prefixall", user.getPrefixAll()),
|
Placeholder.component("prefixall", user.getPrefixAll()),
|
||||||
Placeholder.component("staffprefix", user.getStaffPrefix()),
|
Placeholder.component("staffprefix", user.getStaffPrefix()),
|
||||||
Placeholder.component("message ", message)
|
Placeholder.component("message", message)
|
||||||
);
|
);
|
||||||
|
|
||||||
return Utility.parseMiniMessage(Config.CHATFORMAT, placeholders);
|
return Utility.parseMiniMessage(Config.CHATFORMAT, placeholders);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ dependencies {
|
||||||
annotationProcessor("com.velocitypowered:velocity-api:3.1.0")
|
annotationProcessor("com.velocitypowered:velocity-api:3.1.0")
|
||||||
implementation("mysql:mysql-connector-java:8.0.27") // mysql
|
implementation("mysql:mysql-connector-java:8.0.27") // mysql
|
||||||
implementation("org.spongepowered", "configurate-yaml", "4.1.2")
|
implementation("org.spongepowered", "configurate-yaml", "4.1.2")
|
||||||
implementation("net.kyori:adventure-text-minimessage:4.10.1")
|
compileOnly("net.kyori:adventure-text-minimessage:4.10.1")
|
||||||
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5")
|
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5")
|
||||||
compileOnly("com.alttd.proxydiscordlink:ProxyDiscordLink:1.0.0-BETA-SNAPSHOT")
|
compileOnly("com.alttd.proxydiscordlink:ProxyDiscordLink:1.0.0-BETA-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.velocitypowered.api.command.CommandSource;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.ServerConnection;
|
import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.TextReplacementConfig;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
|
|
@ -128,8 +129,6 @@ public class ChatHandler {
|
||||||
updatedMessage = Utility.stripTokens(updatedMessage);
|
updatedMessage = Utility.stripTokens(updatedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updatedMessage.contains("[i]")) updatedMessage = updatedMessage.replace("[i]", "<[i]>");
|
|
||||||
|
|
||||||
updatedMessage = Utility.formatText(updatedMessage);
|
updatedMessage = Utility.formatText(updatedMessage);
|
||||||
|
|
||||||
TagResolver Placeholders = TagResolver.resolver(
|
TagResolver Placeholders = TagResolver.resolver(
|
||||||
|
|
@ -137,11 +136,11 @@ public class ChatHandler {
|
||||||
Placeholder.component("sendername", senderName),
|
Placeholder.component("sendername", senderName),
|
||||||
Placeholder.unparsed("partyname", party.getPartyName()),
|
Placeholder.unparsed("partyname", party.getPartyName()),
|
||||||
Placeholder.unparsed("message", updatedMessage),
|
Placeholder.unparsed("message", updatedMessage),
|
||||||
Placeholder.unparsed("server", serverConnection.getServer().getServerInfo().getName()),
|
Placeholder.unparsed("server", serverConnection.getServer().getServerInfo().getName())
|
||||||
Placeholder.component("[i]", item)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Component partyMessage = Utility.parseMiniMessage(Config.PARTY_FORMAT, Placeholders);
|
Component partyMessage = Utility.parseMiniMessage(Config.PARTY_FORMAT, Placeholders)
|
||||||
|
.replaceText(TextReplacementConfig.builder().once().matchLiteral("[i]").replacement(item).build());;
|
||||||
sendPartyMessage(party, partyMessage, user.getIgnoredBy());
|
sendPartyMessage(party, partyMessage, user.getIgnoredBy());
|
||||||
|
|
||||||
Component spyMessage = Utility.parseMiniMessage(Config.PARTY_SPY, Placeholders);
|
Component spyMessage = Utility.parseMiniMessage(Config.PARTY_SPY, Placeholders);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user