<filename>src/main/java/club/huacun/shoutall/listeners/PlayerListener.java
package club.huacun.shoutall.listeners;

import club.huacun.shoutall.ShoutAll;
import club.huacun.shoutall.utils.Data;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

/**
 * @author Sprite233, Yurinan
 * @since 2021/12/20 17:29
 */

public class PlayerListener implements Listener {

    @EventHandler
    public void onJoin(PostLoginEvent event) {
        Data data = new Data("", System.currentTimeMillis() / 1000, "", "");
        ShoutAll.getInstance().getAllData().put(event.getPlayer(), data);
    }

    @EventHandler
    public void onLeave(PlayerDisconnectEvent event) {
        ShoutAll.getInstance().getAllData().remove(event.getPlayer());
    }

}

