Skip to content

Commit

Permalink
Remove unused chat-event
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlueF committed Jun 3, 2024
1 parent fbac48c commit 6392b67
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -34,6 +32,4 @@ public interface ServerEventListener {

default void onPlayerLeave(UUID playerUuid) {};

default void onChatMessage(Text message) {};

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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())));
}

}

0 comments on commit 6392b67

Please sign in to comment.