@@ -151,7 +151,7 @@ void playerJoin(final PlayerJoinEvent event) {
151151 // Just in case AsyncPlayerPreLoginEvent was still the old name
152152 verifyCorrectPlayerName (player .getUniqueId (), player .getName ());
153153
154- final GlobalProfile globalProfile = profileDataSource .getGlobalProfile (player . getName (), player . getUniqueId () );
154+ final GlobalProfile globalProfile = profileDataSource .getGlobalProfile (player );
155155 final String world = globalProfile .getLastWorld ();
156156 if (config .usingLoggingSaveLoad () && globalProfile .shouldLoadOnLogin ()) {
157157 ShareHandlingUpdater .updatePlayer (inventories , player , new PersistingProfile (
@@ -167,7 +167,7 @@ void playerJoin(final PlayerJoinEvent event) {
167167 }
168168
169169 private void verifyCorrectPlayerName (UUID uuid , String name ) {
170- profileDataSource .getExistingGlobalProfile (name , uuid ).peek (globalProfile -> {
170+ profileDataSource .getExistingGlobalProfile (uuid , name ).peek (globalProfile -> {
171171 if (globalProfile .getLastKnownName ().equals (name )) {
172172 return ;
173173 }
@@ -196,16 +196,18 @@ private void verifyCorrectPlayerName(UUID uuid, String name) {
196196 void playerQuit (final PlayerQuitEvent event ) {
197197 final Player player = event .getPlayer ();
198198 final String world = event .getPlayer ().getWorld ().getName ();
199- profileDataSource .updateLastWorld (player .getUniqueId (), world );
199+ GlobalProfile globalProfile = profileDataSource .getGlobalProfile (player );
200+ globalProfile .setLastWorld (world );
200201 if (config .usingLoggingSaveLoad ()) {
201202 ShareHandlingUpdater .updateProfile (inventories , player , new PersistingProfile (
202203 Sharables .allOf (),
203204 profileContainerStoreProvider .getStore (ContainerType .WORLD )
204205 .getContainer (world )
205206 .getPlayerData (player )
206207 ));
207- profileDataSource .setLoadOnLogin (player . getUniqueId (), true );
208+ globalProfile .setLoadOnLogin (true );
208209 }
210+ profileDataSource .updateGlobalProfile (globalProfile );
209211 SingleShareWriter .of (this .inventories , player , Sharables .LAST_LOCATION ).write (player .getLocation ().clone ());
210212 }
211213
@@ -261,7 +263,7 @@ void playerChangedWorld(PlayerChangedWorldEvent event) {
261263
262264 long startTime = System .nanoTime ();
263265 new WorldChangeShareHandler (this .inventories , player , fromWorld .getName (), toWorld .getName ()).handleSharing ();
264- profileDataSource .updateLastWorld (player . getUniqueId (), toWorld .getName ());
266+ profileDataSource .modifyGlobalProfile (player , profile -> profile . setLastWorld ( toWorld .getName () ));
265267 Logging .finest ("WorldChangeShareHandler took " + (System .nanoTime () - startTime ) / 1000000 + " ms." );
266268 }
267269
@@ -323,7 +325,7 @@ void playerRespawn(PlayerRespawnEvent event) {
323325 () -> verifyCorrectWorld (
324326 player ,
325327 player .getWorld ().getName (),
326- profileDataSource .getGlobalProfile (player . getName (), player . getUniqueId () )),
328+ profileDataSource .getGlobalProfile (player )),
327329 2L );
328330 }
329331
0 commit comments