Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void onDisable() {
profileContainerStoreProvider.get().getStore(ContainerType.WORLD)
.getContainer(world)
.getPlayerData(player)));
profileDataSource.get().setLoadOnLogin(player.getUniqueId(), true);
profileDataSource.get().modifyGlobalProfile(player, profile -> profile.setLoadOnLogin(true));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ final class CacheCommand extends InventoriesCommand {
void onCacheStatsCommand(MVCommandIssuer issuer) {
Map<String, CacheStats> stats = this.profileDataSource.getCacheStats();
for (Map.Entry<String, CacheStats> entry : stats.entrySet()) {
issuer.sendInfo("Cache: " + entry.getKey());
issuer.sendInfo(" hits count: " + entry.getValue().hitCount());
issuer.sendInfo(" misses count: " + entry.getValue().missCount());
issuer.sendInfo(" loads count: " + entry.getValue().loadCount());
issuer.sendInfo(" avg load time: " + entry.getValue().averageLoadPenalty());
issuer.sendInfo(" exceptions: " + entry.getValue().loadExceptionCount());
issuer.sendInfo(" evictions: " + entry.getValue().evictionCount());
issuer.sendMessage("Cache: " + entry.getKey());
issuer.sendMessage(" hits count: " + entry.getValue().hitCount());
issuer.sendMessage(" misses count: " + entry.getValue().missCount());
issuer.sendMessage(" loads count: " + entry.getValue().loadCount());
issuer.sendMessage(" exceptions: " + entry.getValue().loadExceptionCount());
issuer.sendMessage(" evictions: " + entry.getValue().evictionCount());
issuer.sendMessage(" hit rate: " + entry.getValue().hitRate() * 100 + "%");
issuer.sendMessage(" miss rate: " + entry.getValue().missRate() * 100 + "%");
issuer.sendMessage(" avg load penalty: " + entry.getValue().averageLoadPenalty() / 1000000 + "ms");
issuer.sendMessage("--------");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ private void saveMVDataForPlayer(Group group, OfflinePlayer offlinePlayer) throw
private List<PlayerProfile> getMVPlayerData(
@NotNull OfflinePlayer offlinePlayer, @NotNull Group group, @NotNull GameMode gameMode) {
List<PlayerProfile> profiles = new ArrayList<>();
profiles.add(profileDataSource.getPlayerData(
ContainerType.GROUP, group.getName(), ProfileTypes.forGameMode(gameMode), offlinePlayer.getUniqueId()));
profiles.add(profileDataSource.getPlayerData(org.mvplugins.multiverse.inventories.profile.ProfileKey
.create(ContainerType.GROUP, group.getName(), ProfileTypes.forGameMode(gameMode), offlinePlayer.getUniqueId())));
for (var worldName : group.getWorlds()) {
profiles.add(profileDataSource.getPlayerData(
ContainerType.WORLD, worldName, ProfileTypes.forGameMode(gameMode), offlinePlayer.getUniqueId()));
profiles.add(profileDataSource.getPlayerData(org.mvplugins.multiverse.inventories.profile.ProfileKey
.create(ContainerType.WORLD, worldName, ProfileTypes.forGameMode(gameMode), offlinePlayer.getUniqueId())));
}
return profiles;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void playerJoin(final PlayerJoinEvent event) {
// Just in case AsyncPlayerPreLoginEvent was still the old name
verifyCorrectPlayerName(player.getUniqueId(), player.getName());

final GlobalProfile globalProfile = profileDataSource.getGlobalProfile(player.getName(), player.getUniqueId());
final GlobalProfile globalProfile = profileDataSource.getGlobalProfile(player);
final String world = globalProfile.getLastWorld();
if (config.usingLoggingSaveLoad() && globalProfile.shouldLoadOnLogin()) {
ShareHandlingUpdater.updatePlayer(inventories, player, new PersistingProfile(
Expand All @@ -167,7 +167,7 @@ void playerJoin(final PlayerJoinEvent event) {
}

private void verifyCorrectPlayerName(UUID uuid, String name) {
profileDataSource.getExistingGlobalProfile(name, uuid).peek(globalProfile -> {
profileDataSource.getExistingGlobalProfile(uuid, name).peek(globalProfile -> {
if (globalProfile.getLastKnownName().equals(name)) {
return;
}
Expand Down Expand Up @@ -196,16 +196,18 @@ private void verifyCorrectPlayerName(UUID uuid, String name) {
void playerQuit(final PlayerQuitEvent event) {
final Player player = event.getPlayer();
final String world = event.getPlayer().getWorld().getName();
profileDataSource.updateLastWorld(player.getUniqueId(), world);
GlobalProfile globalProfile = profileDataSource.getGlobalProfile(player);
globalProfile.setLastWorld(world);
if (config.usingLoggingSaveLoad()) {
ShareHandlingUpdater.updateProfile(inventories, player, new PersistingProfile(
Sharables.allOf(),
profileContainerStoreProvider.getStore(ContainerType.WORLD)
.getContainer(world)
.getPlayerData(player)
));
profileDataSource.setLoadOnLogin(player.getUniqueId(), true);
globalProfile.setLoadOnLogin(true);
}
profileDataSource.updateGlobalProfile(globalProfile);
SingleShareWriter.of(this.inventories, player, Sharables.LAST_LOCATION).write(player.getLocation().clone());
}

Expand Down Expand Up @@ -261,7 +263,7 @@ void playerChangedWorld(PlayerChangedWorldEvent event) {

long startTime = System.nanoTime();
new WorldChangeShareHandler(this.inventories, player, fromWorld.getName(), toWorld.getName()).handleSharing();
profileDataSource.updateLastWorld(player.getUniqueId(), toWorld.getName());
profileDataSource.modifyGlobalProfile(player, profile -> profile.setLastWorld(toWorld.getName()));
Logging.finest("WorldChangeShareHandler took " + (System.nanoTime() - startTime) / 1000000 + " ms.");
}

Expand Down Expand Up @@ -323,7 +325,7 @@ void playerRespawn(PlayerRespawnEvent event) {
() -> verifyCorrectWorld(
player,
player.getWorld().getName(),
profileDataSource.getGlobalProfile(player.getName(), player.getUniqueId())),
profileDataSource.getGlobalProfile(player)),
2L);
}

Expand Down
Loading
Loading