Skip to content

Commit

Permalink
Strip legacy codes from chat inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Sep 27, 2022
1 parent c504ba0 commit 76ca3bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>codes.wasabi</groupId>
<artifactId>xclaim</artifactId>
<version>1.9.4</version>
<version>1.9.5</version>
<packaging>jar</packaging>

<name>XClaim</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package codes.wasabi.xclaim.platform.spigot;

import codes.wasabi.xclaim.platform.PlatformChatListener;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.AsyncPlayerChatEvent;
Expand Down Expand Up @@ -28,7 +30,7 @@ public void unregister() {
public void onMessage(AsyncPlayerChatEvent event) {
PlatformChatListenerData data = new PlatformChatListenerData(
event.getPlayer(),
event.getMessage(),
PlainTextComponentSerializer.plainText().serialize(LegacyComponentSerializer.legacySection().deserialize(event.getMessage())),
() -> event.setCancelled(true)
);
for (Consumer<PlatformChatListenerData> consumer : callbacks) consumer.accept(data);
Expand Down

0 comments on commit 76ca3bb

Please sign in to comment.