package listeners;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import discord4j.core.object.entity.channel.TextChannel;



public class MinecraftEventListener implements Listener {
   
    private final discord4j.core.object.entity.channel.TextChannel updateChannel; // Discord channel to send updates

    public MinecraftEventListener(TextChannel updateChannel) {
        this.updateChannel = updateChannel;
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        String playerName = event.getPlayer().getName();
        updateChannel.createMessage("Player " + playerName + " has joined the server.");
    }

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {
        String playerName = event.getPlayer().getName();
        updateChannel.createMessage("Player " + playerName + " has left the server.");
    }
}
