From 6392b67744a296246a0df3443b22e854af2e9e83 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Mon, 3 Jun 2024 22:48:03 +0200 Subject: [PATCH] Remove unused chat-event --- .../common/serverinterface/ServerEventListener.java | 4 ---- .../de/bluecolored/bluemap/bukkit/EventForwarder.java | 9 --------- .../de/bluecolored/bluemap/bukkit/EventForwarder.java | 8 -------- .../de/bluecolored/bluemap/sponge/EventForwarder.java | 8 -------- 4 files changed, 29 deletions(-) diff --git a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/serverinterface/ServerEventListener.java b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/serverinterface/ServerEventListener.java index 96ddbe63e..236ea8243 100644 --- a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/serverinterface/ServerEventListener.java +++ b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/serverinterface/ServerEventListener.java @@ -24,8 +24,6 @@ */ package de.bluecolored.bluemap.common.serverinterface; -import de.bluecolored.bluemap.common.plugin.text.Text; - import java.util.UUID; public interface ServerEventListener { @@ -34,6 +32,4 @@ public interface ServerEventListener { default void onPlayerLeave(UUID playerUuid) {}; - default void onChatMessage(Text message) {}; - } diff --git a/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java b/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java index c73665723..e98906f77 100644 --- a/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java +++ b/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java @@ -24,10 +24,7 @@ */ package de.bluecolored.bluemap.bukkit; -import de.bluecolored.bluemap.common.plugin.text.Text; import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import io.papermc.paper.event.player.AsyncChatEvent; -import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -63,10 +60,4 @@ public synchronized void onPlayerLeave(PlayerQuitEvent evt) { for (ServerEventListener listener : listeners) listener.onPlayerJoin(evt.getPlayer().getUniqueId()); } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public synchronized void onPlayerChat(AsyncChatEvent evt) { - String message = PlainTextComponentSerializer.plainText().serialize(evt.message()); - for (ServerEventListener listener : listeners) listener.onChatMessage(Text.of(message)); - } - } diff --git a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java index cce365003..e98906f77 100644 --- a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java +++ b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/EventForwarder.java @@ -25,11 +25,9 @@ package de.bluecolored.bluemap.bukkit; import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import de.bluecolored.bluemap.common.plugin.text.Text; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -62,10 +60,4 @@ public synchronized void onPlayerLeave(PlayerQuitEvent evt) { for (ServerEventListener listener : listeners) listener.onPlayerJoin(evt.getPlayer().getUniqueId()); } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public synchronized void onPlayerChat(AsyncPlayerChatEvent evt) { - String message = String.format(evt.getFormat(), evt.getPlayer().getDisplayName(), evt.getMessage()); - for (ServerEventListener listener : listeners) listener.onChatMessage(Text.of(message)); - } - } diff --git a/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/EventForwarder.java b/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/EventForwarder.java index e2ce04d79..ef6b179fb 100644 --- a/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/EventForwarder.java +++ b/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/EventForwarder.java @@ -24,12 +24,9 @@ */ package de.bluecolored.bluemap.sponge; -import de.bluecolored.bluemap.common.plugin.text.Text; import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Order; -import org.spongepowered.api.event.message.PlayerChatEvent; import org.spongepowered.api.event.network.ServerSideConnectionEvent; public class EventForwarder { @@ -50,9 +47,4 @@ public void onPlayerLeave(ServerSideConnectionEvent.Disconnect evt) { listener.onPlayerJoin(evt.player().uniqueId()); } - @Listener(order = Order.POST) - public void onPlayerChat(PlayerChatEvent evt) { - listener.onChatMessage(Text.of(PlainTextComponentSerializer.plainText().serialize(evt.message()))); - } - }