public void readPlayerData(GlowPlayer player) {
    Map<String, Tag> playerData = new HashMap<String, Tag>();
    CompoundTag playerTag = null;
    // Map<PlayerData, Object> ret = new HashMap<PlayerData, Object>();

    File playerDir = new File(world.getName(), "players");
    if (!playerDir.exists()) playerDir.mkdirs();

    File playerFile = new File(playerDir, player.getName() + ".dat");
    if (!playerFile.exists()) {
      try {
        playerFile.createNewFile();
      } catch (IOException e) {
        e.printStackTrace();
      }
    } else {
      try {
        NBTInputStream in = new NBTInputStream(new FileInputStream(playerFile));
        playerTag = (CompoundTag) in.readTag();
        in.close();
        if (playerTag != null) playerData.putAll(playerTag.getValue());
      } catch (EOFException e) {
      } catch (IOException e) {
        player.kickPlayer("Failed to read " + player.getName() + ".dat!");
        server
            .getLogger()
            .severe(
                "Failed to read player.dat for player "
                    + player.getName()
                    + " in world "
                    + world.getName()
                    + "!");
        e.printStackTrace();
      }
    }

    if (playerTag == null) playerTag = new CompoundTag("", new HashMap<String, Tag>());
    EntityStoreLookupService.find(GlowPlayer.class).load(player, playerTag);
  }
  public void writePlayerData(GlowPlayer player) {

    File playerDir = new File(world.getName(), "players");
    if (!playerDir.exists()) playerDir.mkdirs();

    File playerFile = new File(playerDir, player.getName() + ".dat");
    if (!playerFile.exists())
      try {
        playerFile.createNewFile();
      } catch (IOException e) {
        player.getSession().disconnect("Failed to access player.dat");
        server
            .getLogger()
            .severe(
                "Failed to access player.dat for player "
                    + player.getName()
                    + " in world "
                    + world.getName()
                    + "!");
      }

    Map<String, Tag> out = EntityStoreLookupService.find(GlowPlayer.class).save(player);
    try {
      NBTOutputStream outStream = new NBTOutputStream(new FileOutputStream(playerFile));
      outStream.writeTag(new CompoundTag("", out));
      outStream.close();
    } catch (IOException e) {
      player.getSession().disconnect("Failed to write player.dat", true);
      server
          .getLogger()
          .severe(
              "Failed to write player.dat for player "
                  + player.getName()
                  + " in world "
                  + world.getName()
                  + "!");
    }
  }