|
16 | 16 | import org.mvplugins.multiverse.inventories.config.InventoriesConfig; |
17 | 17 | import org.mvplugins.multiverse.inventories.handleshare.SingleShareReader; |
18 | 18 | import org.mvplugins.multiverse.inventories.handleshare.SingleShareWriter; |
| 19 | +import org.mvplugins.multiverse.inventories.profile.ProfileDataSource; |
19 | 20 | import org.mvplugins.multiverse.inventories.profile.container.ProfileContainer; |
20 | 21 | import org.mvplugins.multiverse.inventories.profile.container.ProfileContainerStoreProvider; |
21 | 22 | import org.mvplugins.multiverse.inventories.profile.data.PlayerProfile; |
22 | 23 | import org.mvplugins.multiverse.inventories.profile.key.ContainerType; |
| 24 | +import org.mvplugins.multiverse.inventories.profile.key.GlobalProfileKey; |
23 | 25 | import org.mvplugins.multiverse.inventories.profile.key.ProfileType; |
24 | 26 | import org.mvplugins.multiverse.inventories.profile.key.ProfileTypes; |
25 | 27 | import org.mvplugins.multiverse.inventories.share.Sharable; |
|
39 | 41 | @Service |
40 | 42 | public final class InventoryDataProvider { |
41 | 43 |
|
| 44 | + private final ProfileDataSource profileDataSource; |
42 | 45 | private final ProfileContainerStoreProvider profileContainerStoreProvider; |
43 | 46 | private final MultiverseInventories inventories; |
44 | 47 | private final InventoriesConfig inventoriesConfig; |
45 | 48 |
|
46 | 49 | @Inject |
47 | 50 | InventoryDataProvider( |
| 51 | + @NotNull ProfileDataSource profileDataSource, |
48 | 52 | @NotNull ProfileContainerStoreProvider profileContainerStoreProvider, |
49 | 53 | @NotNull MultiverseInventories inventories, |
50 | 54 | @NotNull InventoriesConfig inventoriesConfig |
51 | 55 | ) { |
| 56 | + this.profileDataSource = profileDataSource; |
52 | 57 | this.profileContainerStoreProvider = profileContainerStoreProvider; |
53 | 58 | this.inventories = inventories; |
54 | 59 | this.inventoriesConfig = inventoriesConfig; |
@@ -274,11 +279,15 @@ private void updateOnlinePlayerInventoryData( |
274 | 279 | ) { |
275 | 280 | // If the target player is online, update their live inventory |
276 | 281 | if (!targetPlayer.isOnline()) { |
| 282 | + // force appy inv data on join |
| 283 | + profileDataSource.getGlobalProfile(GlobalProfileKey.of(targetPlayer)) |
| 284 | + .thenAccept(globalProfile -> globalProfile.setLoadOnLogin(true)); |
277 | 285 | return; |
278 | 286 | } |
279 | 287 |
|
280 | 288 | Player onlinePlayer = targetPlayer.getPlayer(); |
281 | 289 | if (onlinePlayer == null) { |
| 290 | + // this should never happen as we already check if player is online |
282 | 291 | return; |
283 | 292 | } |
284 | 293 |
|
|
0 commit comments