Offline player's enderchest?

Discussion in 'Plugin Development' started by KoalaOnCaffeine, Sep 23, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    KoalaOnCaffeine

    Hi I was wondering how to get the content of an offline player's enderchest. Ive tried casting OfflinePlayer to a player, getting it that way. Doesnt work. Ive tried
    OfflinePlayer offline = bukkit.getofflineplayer(Args[0])
    offline.getPlayer.getEnderChest();
    That doesnt work.
    Ive had a thought that storing it in a file and then updating it on change would work, but i dont know how to go about doing this.
    Thanks for your help <3
     
  2. Offline

    Zombie_Striker

    @KoalaOnCaffeineSince
    Keeping all player's inventories stored in memory even when they are offline would slow down servers, and since inventories are not accessed or modified when a player is offline (only the player can change their own inventories when they are online), inventories are only stored when the player is online.

    So, in order to access the ender chest, you will need to store it in memory. If you want to modify the ender chest, then you will need to save the changes somewhere, wait for the player to reconnect to the server, and then modify the inventory once he is online.
     
  3. Offline

    KoalaOnCaffeine

    I was told, that you can just edit the playerdata file in the world file, and modify the endercjest there. Think this would work??
    (PS you can modify inventories, just player.openInventory(target.getInvrntory); and then it auto updates)
     
Thread Status:
Not open for further replies.

Share This Page