mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-15 23:25:32 +01:00
Remove unused chat-event
This commit is contained in:
parent
fbac48cd86
commit
6392b67744
@ -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) {};
|
||||
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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())));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user