2022-08-15 22:40:54 +02:00
|
|
|
package com.github.artemis.the.gr8.playerstats.listeners;
|
2022-05-09 13:48:46 +02:00
|
|
|
|
2022-08-15 22:40:54 +02:00
|
|
|
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
2022-05-11 17:23:37 +02:00
|
|
|
import org.bukkit.event.EventHandler;
|
2022-05-09 13:48:46 +02:00
|
|
|
import org.bukkit.event.Listener;
|
|
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
2022-08-16 17:14:22 +02:00
|
|
|
import org.jetbrains.annotations.ApiStatus;
|
2022-05-09 13:48:46 +02:00
|
|
|
|
2022-08-16 17:14:22 +02:00
|
|
|
/**
|
|
|
|
* Listens for new Players that join, and reloads PlayerStats
|
2022-08-16 15:16:57 +02:00
|
|
|
* if someone joins that hasn't joined before.
|
|
|
|
*/
|
2022-08-16 17:14:22 +02:00
|
|
|
@ApiStatus.Internal
|
2022-05-09 13:48:46 +02:00
|
|
|
public class JoinListener implements Listener {
|
|
|
|
|
2022-07-12 00:29:41 +02:00
|
|
|
private static ThreadManager threadManager;
|
2022-05-31 18:35:00 +02:00
|
|
|
|
2022-06-15 01:08:00 +02:00
|
|
|
public JoinListener(ThreadManager t) {
|
2022-05-31 18:35:00 +02:00
|
|
|
threadManager = t;
|
2022-05-09 13:48:46 +02:00
|
|
|
}
|
2022-05-09 21:00:39 +02:00
|
|
|
|
2022-05-11 17:23:37 +02:00
|
|
|
@EventHandler
|
2022-05-09 13:48:46 +02:00
|
|
|
public void onPlayerJoin(PlayerJoinEvent joinEvent) {
|
|
|
|
if (!joinEvent.getPlayer().hasPlayedBefore()) {
|
2022-06-23 12:14:57 +02:00
|
|
|
threadManager.startReloadThread(null);
|
2022-05-09 13:48:46 +02:00
|
|
|
}
|
|
|
|
}
|
2022-06-27 14:21:35 +02:00
|
|
|
}
|