use of com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction in project Plan by plan-player-analytics.
the class JSErrorRegressionTest method savePlayerData.
private static void savePlayerData() {
DBSystem dbSystem = planSystem.getDatabaseSystem();
Database database = dbSystem.getDatabase();
UUID uuid = TestConstants.PLAYER_ONE_UUID;
database.executeTransaction(new PlayerRegisterTransaction(uuid, RandomData::randomTime, TestConstants.PLAYER_ONE_NAME));
FinishedSession session = new FinishedSession(uuid, serverUUID, 1000L, 11000L, 500L, new DataMap());
database.executeTransaction(new WorldNameStoreTransaction(serverUUID, "world"));
database.executeTransaction(new StoreSessionTransaction(session));
}
use of com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction in project Plan by plan-player-analytics.
the class GameModeChangeListener method actOnEvent.
private void actOnEvent(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
long time = System.currentTimeMillis();
String gameMode = event.getNewGameMode().name();
String worldName = player.getWorld().getName();
dbSystem.getDatabase().executeTransaction(new WorldNameStoreTransaction(serverInfo.getServerUUID(), worldName));
worldAliasSettings.addWorld(worldName);
Optional<ActiveSession> cachedSession = SessionCache.getCachedSession(uuid);
cachedSession.ifPresent(session -> session.changeState(worldName, gameMode, time));
}
use of com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction in project Plan by plan-player-analytics.
the class WorldChangeListener method actOnEvent.
private void actOnEvent(PlayerChangedWorldEvent event) {
long time = System.currentTimeMillis();
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
String worldName = player.getWorld().getName();
String gameMode = player.getGameMode().name();
dbSystem.getDatabase().executeTransaction(new WorldNameStoreTransaction(serverInfo.getServerUUID(), worldName));
worldAliasSettings.addWorld(worldName);
Optional<ActiveSession> cachedSession = SessionCache.getCachedSession(uuid);
cachedSession.ifPresent(session -> session.changeState(worldName, gameMode, time));
}
use of com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction in project Plan by plan-player-analytics.
the class WorldChangeListener method actOnEvent.
private void actOnEvent(EntityLevelChangeEvent event) {
long time = System.currentTimeMillis();
// Checked earlier
Player player = (Player) event.getEntity();
UUID uuid = player.getUniqueId();
String worldName = player.getLevel().getName();
String gameMode = GMTimes.magicNumberToGMName(player.getGamemode());
dbSystem.getDatabase().executeTransaction(new WorldNameStoreTransaction(serverInfo.getServerUUID(), worldName));
worldAliasSettings.addWorld(worldName);
Optional<ActiveSession> cachedSession = SessionCache.getCachedSession(uuid);
cachedSession.ifPresent(session -> session.changeState(worldName, gameMode, time));
}
use of com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction in project Plan by plan-player-analytics.
the class SpongeWorldChangeListener method actOnEvent.
private void actOnEvent(MoveEntityEvent.Teleport event, Player player) {
long time = System.currentTimeMillis();
UUID uuid = player.getUniqueId();
String worldName = event.getToTransform().getExtent().getName();
String gameMode = getGameMode(player);
dbSystem.getDatabase().executeTransaction(new WorldNameStoreTransaction(serverInfo.getServerUUID(), worldName));
worldAliasSettings.addWorld(worldName);
Optional<ActiveSession> cachedSession = SessionCache.getCachedSession(uuid);
cachedSession.ifPresent(session -> session.changeState(worldName, gameMode, time));
}
Aggregations