NMS OfflinePlayer Enderchests

Discussion in 'Spigot Plugin Help' started by AgentLV, May 13, 2015.

  1. Hello,
    I need help with getting the enderchests of OfflinePlayers, I'm not very familiar with NMS or Packets and the BukkitAPI(as far as I know) does not provide access to enderchests of OfflinePlayers.
    I hope someone can help me out!
     
  2. Make it so when they exit the chest it saves it in a database. So their enderchest is in a database which you can modify and when they open it, it grabs from the database and puts it in the chest.
     
  3. The problem is I want to put enderchets from a database into the player.data(I think), where they are usually stored. I just don't know how to access the enderchests of OfflinePlayers...
     
  4. When you modify the enderchest a of offline players it gets saved in the database.
     
  5. Please stop thinking about workarounds, I just want to know how to access the enderchests of OfflinePlayers!
     
  6. Why don't you just take the workaround?
     
  7. Arrgh, I have a plugin which stores the enderchests in a database and we would like to remove the plugin to save performance!
     
  8. No idea, didn't know you already had it. I don't think it will save a lot of performance.
     
  9. Code (Text):
    OfflinePlayer player;
    MinecraftServer minecraftserver = MinecraftServer.getServer();
    GameProfile gameprofile = new GameProfile(player.getUniqueId(), player.getName());
    EntityPlayer entity = new EntityPlayer(minecraftserver, minecraftserver.getWorldServer(0), gameprofile, new PlayerInteractManager(minecraftserver.getWorldServer(0)));
           
    final Player target = entity == null ? null : entity.getBukkitEntity();
    if (target != null)
        target.loadData();
    This worked for me :)
     
    #9 AgentLV, May 13, 2015
    Last edited: May 14, 2015
    • Like Like x 1