use of com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction in project Plan by plan-player-analytics.
the class SpongeGMChangeListener method actOnGMChangeEvent.
private void actOnGMChangeEvent(ChangeGameModeEvent.TargetPlayer event) {
Player player = event.getTargetEntity();
UUID uuid = player.getUniqueId();
long time = System.currentTimeMillis();
String gameMode = event.getGameMode().getName().toUpperCase();
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 GameModeChangeListener method actOnEvent.
private void actOnEvent(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
long time = System.currentTimeMillis();
String gameMode = GMTimes.magicNumberToGMName(event.getNewGamemode());
String worldName = player.getLevel().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 ShutdownSaveTest method storeNecessaryInformation.
private void storeNecessaryInformation() throws Exception {
database.executeTransaction(new RemoveEverythingTransaction());
ServerUUID serverUUID = TestConstants.SERVER_UUID;
UUID playerUUID = TestConstants.PLAYER_ONE_UUID;
String worldName = TestConstants.WORLD_ONE_NAME;
database.executeTransaction(new StoreServerInformationTransaction(new Server(serverUUID, "-", "", TestConstants.VERSION)));
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> 0L, TestConstants.PLAYER_ONE_NAME));
database.executeTransaction(new WorldNameStoreTransaction(serverUUID, worldName)).get();
}
use of com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction in project Plan by plan-player-analytics.
the class ExportJSErrorRegressionTest 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 PlanPlaceholdersTest method storeSomeData.
private static void storeSomeData() {
Database database = component.system().getDatabaseSystem().getDatabase();
database.executeTransaction(new PlayerServerRegisterTransaction(playerUUID, System::currentTimeMillis, RandomData.randomString(5), serverUUID, () -> RandomData.randomString(5)));
database.executeTransaction(new PlayerServerRegisterTransaction(TestConstants.PLAYER_TWO_UUID, System::currentTimeMillis, TestConstants.PLAYER_TWO_NAME, serverUUID, () -> RandomData.randomString(5)));
String worldName = RandomData.randomString(10);
database.executeTransaction(new WorldNameStoreTransaction(serverUUID, worldName));
database.executeTransaction(new StoreSessionTransaction(RandomData.randomSession(serverUUID, new String[] { worldName }, playerUUID, TestConstants.PLAYER_TWO_UUID)));
}
Aggregations