Package simpleserver.nbt

Examples of simpleserver.nbt.NBTCompound


      playerData.put(tag);
    }
  }

  public void setRenameName(Player player, String renameName) {
    NBTCompound playerData = get(player.getName(true).toLowerCase());
    String field = PlayerField.RENAME_NAME.toString();
    if (playerData.containsKey(field)) {
      playerData.getString(field).set(renameName);
    } else {
      NBTString tag = new NBTString(field, player.getName());
      playerData.put(tag);
    }
  }
View Full Code Here


      playerData.put(tag);
    }
  }

  public void setPw(String playerName, byte[] pwHash) {
    NBTCompound playerData = get(playerName.toLowerCase());
    String field = PlayerField.PW_HASH.toString();
    if (playerData.containsKey(field)) {
      playerData.getArray(field).set(pwHash);
    } else {
      NBTArray tag = new NBTArray(field, pwHash);
      playerData.put(tag);
    }
  }
View Full Code Here

  Homes(PlayerData playerData) {
    this.playerData = playerData;
  }

  public HomePoint get(String playerName) {
    NBTCompound player = playerData.get(playerName);
    if (player.containsKey(HOME)) {
      return new HomePoint(player.getCompound(HOME));
    }
    return null;
  }
View Full Code Here

  }

  public Set<String> getHomesPlayerInvitedTo(String playerName) {
    Set<String> invitedHomes = new HashSet<String>();
    for (String name : playerData.names()) {
      NBTCompound player = playerData.get(name);
      if (player.containsKey(HOME)) {
        HomePoint home = new HomePoint(player.getCompound(HOME));
        if (home.invites.contains(new NBTString(playerName))) {
          invitedHomes.add(name);
        }
      }
    }
View Full Code Here

    return invitedHomes;
  }

  public void getVisitableHomes(String playerName, List<String> invitedHomes, List<String> publicHomes) {
    for (String name : playerData.names()) {
      NBTCompound player = playerData.get(name);
      if (player.containsKey(HOME)) {
        HomePoint home = new HomePoint(player.getCompound(HOME));
        if (home.isPublic) {
          publicHomes.add(name);
        } else if (home.invites.contains(new NBTString(playerName)) || name.equals(playerName.toLowerCase())) {
          invitedHomes.add(name);
        }
View Full Code Here

      }
    }
  }

  public void remove(String playerName) {
    NBTCompound player = playerData.get(playerName);
    if (player.containsKey(HOME)) {
      player.remove(HOME);
    }
  }
View Full Code Here

      player.remove(HOME);
    }
  }

  public void set(String playerName, HomePoint homePoint) {
    NBTCompound player = playerData.get(playerName);
    player.put(homePoint.tag());
  }
View Full Code Here

    public boolean getPlayerInvited(Player player) {
      return invites.contains(new NBTString(player.getName()));
    }

    public NBTCompound tag() {
      NBTCompound tag = position.tag();
      tag.rename(HOME);
      NBTByte publicValue = new NBTByte(PUBLIC, isPublic ? (byte) 1 : (byte) 0);
      tag.put(publicValue);
      tag.put(invites);
      return tag;
    }
View Full Code Here

    tag.set(tag.get() + amount);
    return tag.get();
  }

  private NBTCompound getStats(String name) {
    NBTCompound player = playerData.get(name);
    if (player.containsKey(STATS)) {
      return player.getCompound(STATS);
    } else {
      NBTCompound tag = new NBTCompound(STATS);
      player.put(tag);
      return tag;
    }
  }
View Full Code Here

    return hours;
  }

  private NBTInt getInt(String name, String key) {
    NBTCompound player = getStats(name);
    if (player.containsKey(key)) {
      return player.getInt(key);
    } else {
      NBTInt tag = new NBTInt(key, 0);
      player.put(tag);
      return tag;
    }
  }
View Full Code Here

TOP

Related Classes of simpleserver.nbt.NBTCompound

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.