Save existing vehicles if we had to load player (#22)

This commit is contained in:
Jikoo
2020-04-19 17:52:44 -04:00
parent 7210f9153e
commit a1b2df74cc
6 changed files with 269 additions and 6 deletions

View File

@@ -465,6 +465,9 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
return;
}
// Replace stored player with our own version
this.playerCache.put(key, this.accessor.getPlayerDataManager().inject(player));
if (this.inventories.containsKey(key)) {
this.inventories.get(key).setPlayerOffline();
}

View File

@@ -35,6 +35,14 @@ public interface IPlayerDataManager {
@Nullable
Player loadPlayer(@NotNull OfflinePlayer offline);
/**
* Creates a new Player from an existing one that will function slightly better offline.
*
* @return the Player
*/
@NotNull
Player inject(@NotNull Player player);
/**
* Opens an ISpecialInventory for a Player.
*