mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-04-05 11:45:44 +02:00
Implemented Extension player method calls
This commit is contained in:
parent
58e7534501
commit
adb0a93713
@ -179,7 +179,14 @@ public class PlayerOnlineListener implements Listener {
|
|||||||
|
|
||||||
processing.submitNonCritical(processors.info().playerPageUpdateProcessor(playerUUID));
|
processing.submitNonCritical(processors.info().playerPageUpdateProcessor(playerUUID));
|
||||||
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void beforePlayerQuit(PlayerQuitEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
UUID playerUUID = player.getUniqueId();
|
||||||
|
String playerName = player.getName();
|
||||||
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_LEAVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
@ -20,6 +20,7 @@ import com.djrapitops.plan.data.container.Session;
|
|||||||
import com.djrapitops.plan.db.Database;
|
import com.djrapitops.plan.db.Database;
|
||||||
import com.djrapitops.plan.db.access.transactions.events.GeoInfoStoreTransaction;
|
import com.djrapitops.plan.db.access.transactions.events.GeoInfoStoreTransaction;
|
||||||
import com.djrapitops.plan.db.access.transactions.events.PlayerRegisterTransaction;
|
import com.djrapitops.plan.db.access.transactions.events.PlayerRegisterTransaction;
|
||||||
|
import com.djrapitops.plan.extension.CallEvents;
|
||||||
import com.djrapitops.plan.extension.ExtensionServiceImplementation;
|
import com.djrapitops.plan.extension.ExtensionServiceImplementation;
|
||||||
import com.djrapitops.plan.system.cache.GeolocationCache;
|
import com.djrapitops.plan.system.cache.GeolocationCache;
|
||||||
import com.djrapitops.plan.system.cache.SessionCache;
|
import com.djrapitops.plan.system.cache.SessionCache;
|
||||||
@ -39,6 +40,7 @@ import net.md_5.bungee.api.event.PostLoginEvent;
|
|||||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
import net.md_5.bungee.event.EventPriority;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
@ -84,7 +86,7 @@ public class PlayerOnlineListener implements Listener {
|
|||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPostLogin(PostLoginEvent event) {
|
public void onPostLogin(PostLoginEvent event) {
|
||||||
try {
|
try {
|
||||||
ProxiedPlayer player = event.getPlayer();
|
ProxiedPlayer player = event.getPlayer();
|
||||||
@ -105,14 +107,22 @@ public class PlayerOnlineListener implements Listener {
|
|||||||
|
|
||||||
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName));
|
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName));
|
||||||
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID));
|
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID));
|
||||||
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, com.djrapitops.plan.extension.CallEvents.PLAYER_JOIN));
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
|
||||||
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errorHandler.log(L.WARN, this.getClass(), e);
|
errorHandler.log(L.WARN, this.getClass(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void beforeLogout(PlayerDisconnectEvent event) {
|
||||||
|
ProxiedPlayer player = event.getPlayer();
|
||||||
|
UUID playerUUID = player.getUniqueId();
|
||||||
|
String playerName = player.getName();
|
||||||
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_LEAVE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onLogout(PlayerDisconnectEvent event) {
|
public void onLogout(PlayerDisconnectEvent event) {
|
||||||
try {
|
try {
|
||||||
ProxiedPlayer player = event.getPlayer();
|
ProxiedPlayer player = event.getPlayer();
|
||||||
@ -126,7 +136,7 @@ public class PlayerOnlineListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onServerSwitch(ServerSwitchEvent event) {
|
public void onServerSwitch(ServerSwitchEvent event) {
|
||||||
try {
|
try {
|
||||||
ProxiedPlayer player = event.getPlayer();
|
ProxiedPlayer player = event.getPlayer();
|
||||||
|
@ -20,6 +20,7 @@ import com.djrapitops.plan.data.container.Session;
|
|||||||
import com.djrapitops.plan.data.store.objects.Nickname;
|
import com.djrapitops.plan.data.store.objects.Nickname;
|
||||||
import com.djrapitops.plan.db.Database;
|
import com.djrapitops.plan.db.Database;
|
||||||
import com.djrapitops.plan.db.access.transactions.events.*;
|
import com.djrapitops.plan.db.access.transactions.events.*;
|
||||||
|
import com.djrapitops.plan.extension.CallEvents;
|
||||||
import com.djrapitops.plan.extension.ExtensionServiceImplementation;
|
import com.djrapitops.plan.extension.ExtensionServiceImplementation;
|
||||||
import com.djrapitops.plan.system.cache.GeolocationCache;
|
import com.djrapitops.plan.system.cache.GeolocationCache;
|
||||||
import com.djrapitops.plan.system.cache.NicknameCache;
|
import com.djrapitops.plan.system.cache.NicknameCache;
|
||||||
@ -181,7 +182,15 @@ public class PlayerOnlineListener {
|
|||||||
));
|
));
|
||||||
|
|
||||||
processing.submitNonCritical(processors.info().playerPageUpdateProcessor(playerUUID));
|
processing.submitNonCritical(processors.info().playerPageUpdateProcessor(playerUUID));
|
||||||
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, com.djrapitops.plan.extension.CallEvents.PLAYER_JOIN));
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Listener(order = Order.DEFAULT)
|
||||||
|
public void beforeQuit(ClientConnectionEvent.Disconnect event) {
|
||||||
|
Player player = event.getTargetEntity();
|
||||||
|
UUID playerUUID = player.getUniqueId();
|
||||||
|
String playerName = player.getName();
|
||||||
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_LEAVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Listener(order = Order.POST)
|
@Listener(order = Order.POST)
|
||||||
|
@ -20,6 +20,7 @@ import com.djrapitops.plan.data.container.Session;
|
|||||||
import com.djrapitops.plan.db.Database;
|
import com.djrapitops.plan.db.Database;
|
||||||
import com.djrapitops.plan.db.access.transactions.events.GeoInfoStoreTransaction;
|
import com.djrapitops.plan.db.access.transactions.events.GeoInfoStoreTransaction;
|
||||||
import com.djrapitops.plan.db.access.transactions.events.PlayerRegisterTransaction;
|
import com.djrapitops.plan.db.access.transactions.events.PlayerRegisterTransaction;
|
||||||
|
import com.djrapitops.plan.extension.CallEvents;
|
||||||
import com.djrapitops.plan.extension.ExtensionServiceImplementation;
|
import com.djrapitops.plan.extension.ExtensionServiceImplementation;
|
||||||
import com.djrapitops.plan.system.cache.GeolocationCache;
|
import com.djrapitops.plan.system.cache.GeolocationCache;
|
||||||
import com.djrapitops.plan.system.cache.SessionCache;
|
import com.djrapitops.plan.system.cache.SessionCache;
|
||||||
@ -33,6 +34,7 @@ import com.djrapitops.plan.system.webserver.cache.PageId;
|
|||||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||||
import com.djrapitops.plugin.logging.L;
|
import com.djrapitops.plugin.logging.L;
|
||||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||||
|
import com.velocitypowered.api.event.PostOrder;
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||||
@ -87,7 +89,7 @@ public class PlayerOnlineListener {
|
|||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe(order = PostOrder.LAST)
|
||||||
public void onPostLogin(PostLoginEvent event) {
|
public void onPostLogin(PostLoginEvent event) {
|
||||||
try {
|
try {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -109,14 +111,22 @@ public class PlayerOnlineListener {
|
|||||||
|
|
||||||
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName));
|
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName));
|
||||||
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID));
|
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID));
|
||||||
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, com.djrapitops.plan.extension.CallEvents.PLAYER_JOIN));
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
|
||||||
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errorHandler.log(L.WARN, this.getClass(), e);
|
errorHandler.log(L.WARN, this.getClass(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe(order = PostOrder.NORMAL)
|
||||||
|
public void beforeLogout(DisconnectEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
UUID playerUUID = player.getUniqueId();
|
||||||
|
String playerName = player.getUsername();
|
||||||
|
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_LEAVE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(order = PostOrder.LAST)
|
||||||
public void onLogout(DisconnectEvent event) {
|
public void onLogout(DisconnectEvent event) {
|
||||||
try {
|
try {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -130,7 +140,7 @@ public class PlayerOnlineListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe(order = PostOrder.LAST)
|
||||||
public void onServerSwitch(ServerConnectedEvent event) {
|
public void onServerSwitch(ServerConnectedEvent event) {
|
||||||
try {
|
try {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
Loading…
Reference in New Issue
Block a user