Package simpleserver.nbt

Examples of simpleserver.nbt.NBTString


    NBTList<NBTCompound> node = new NBTList<NBTCompound>(CHESTS, NBT.COMPOUND);
    for (Chest chest : locations.values()) {
      NBTCompound tag = new NBTCompound();
      tag.put(chest.coordinate.tag());
      if (!chest.isOpen()) {
        tag.put(new NBTString("owner", chest.owner.toLowerCase()));
        if (chest.name != null) {
          tag.put(new NBTString("name", chest.name));
        }
      }
      node.add(tag);
    }
    root.put(node);
View Full Code Here


    NBTCompound playerData = get(playerName.toLowerCase());
    String field = PlayerField.FULL_NAME.toString();
    if (playerData.containsKey(field)) {
      return playerData.getString(field).get();
    } else {
      NBTString tag = new NBTString(field, playerName);
      playerData.put(tag);
      return tag.get();
    }
  }
View Full Code Here

    NBTCompound playerData = get(playerName.toLowerCase());
    String field = PlayerField.RENAME_NAME.toString();
    if (playerData.containsKey(field)) {
      return playerData.getString(field).get();
    } else {
      NBTString tag = new NBTString(field, playerName);
      playerData.put(tag);
      return tag.get();
    }
  }
View Full Code Here

    NBTCompound playerData = get(realName.toLowerCase());
    String field = PlayerField.FULL_NAME.toString();
    if (playerData.containsKey(field)) {
      playerData.getString(field).set(realName);
    } else {
      NBTString tag = new NBTString(field, realName);
      playerData.put(tag);
    }
  }
View Full Code Here

    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

    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);
        }
      }
    }
    return invitedHomes;
View Full Code Here

      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

      }
      return playersInvited;
    }

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

      String iPlayer = arguments[1];
      Player onlineTarget = player.getServer().findPlayer(iPlayer);
      if (onlineTarget != null) {
        iPlayer = onlineTarget.getName();
      }
      if (!home.invites.contains(new NBTString(iPlayer))) {
        home.invites.add(new NBTString(iPlayer));
        player.addTMessage(Color.GRAY, "You just invited %s.", iPlayer);
        if (onlineTarget != null) {
          onlineTarget.addTMessage(Color.GRAY, "You were just invited to visit %s's home.", player.getName());
        }
      } else {
        player.addTMessage(Color.GRAY, "Player has already been invited.");
      }
    } else if (command.equals("uninvite")) {
      HomePoint home = homes.get(playerName);
      if (home == null) {
        player.addTMessage(Color.RED, "You don't have a home to manage!");
        return;
      }
      if (arguments.length == 1) {
        player.addTMessage(Color.RED, "Invalid argument!");
        usage(player);
        return;
      }
      String uiPlayer = home.getInvitedPlayer(arguments[1]);
      if (home.invites.contains(new NBTString(uiPlayer))) {
        home.invites.remove(new NBTString(uiPlayer));
        player.addTMessage(Color.GRAY, "You just uninvited %s.", uiPlayer);
      } else {
        player.addTMessage(Color.GRAY, "Player wasn't invited.");
      }
    } else if (command.equals("inspect")) {
      if (arguments.length < 2) {
        player.addTMessage(Color.GRAY, "No player name given!");
        return;
      }
      String vPlayer = arguments[1];
      HomePoint home = homes.get(vPlayer);
      if (home == null) {
        player.addTMessage(Color.GRAY, "Player doesn't have a home set!");
        return;
      }
      player.teleportWithWarmup(home.position);
    } else {
      if (command.toLowerCase().equals(playerName.toLowerCase())) {
        teleportHome(player);
        return;
      }
      String target = command;
      String onlinePlayer = player.getServer().findName(target);
      if (onlinePlayer != null) {
        target = onlinePlayer;
      } else {
        Set<String> list = homes.getHomesPlayerInvitedTo(playerName);
        for (String p : list) {
          if (p.startsWith(target)) {
            target = p;
            break;
          }
        }
      }
      HomePoint home = homes.get(target);
      if (home == null) {
        usage(player);
        return;
      }
      if ((home.isPublic && player.getServer().findPlayer(target) != null) ||
          home.invites.contains(new NBTString(playerName)) ||
          target.toLowerCase().equals(playerName.toLowerCase())) {
        player.teleportWithWarmup(home.position);
      } else {
        player.addTMessage(Color.RED, "You are not allowed to visit %s's home.", command);
      }
View Full Code Here

TOP

Related Classes of simpleserver.nbt.NBTString

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.