Package simpleserver.config.xml

Examples of simpleserver.config.xml.Config


      }
      player.setChat(new DimensionChat(player, dim));
    } else if (mode.equals("group")) {
      Group group = player.getGroup();

      Config config = player.getServer().config;

      if (args.length > 1) {
        try {
          int groupId = Integer.parseInt(args[1]);
          if (config.groups.contains(groupId)) {
View Full Code Here


  protected Chat getMessageInstance(Player sender, String message) {
    // TODO: make it possible to use group name(prefix)

    Group group = sender.getGroup();
    chatMessage = message;
    Config config = sender.getServer().config;

    String[] arguments = extractArguments(message);
    if (arguments.length > 1) {
      try {
        int groupId = Integer.parseInt(arguments[0]);
View Full Code Here

    super("group");
  }

  @Override
  void convert(Attributes attributes, Stack<PermissionContainer> stack) throws SAXException {
    Config config = (Config) stack.peek();
    Group group = new Group(getInt(attributes.getValue("id")), attributes.getValue("name"));
    group.color = attributes.getValue("color").charAt(0);
    if (attributes.getIndex("cooldown") >= 0) {
      group.cooldown = getInt(attributes.getValue("cooldown"));
    }
View Full Code Here

    super("player");
  }

  @Override
  void convert(Attributes attributes, Stack<PermissionContainer> stack) throws SAXException {
    Config config = (Config) stack.peek();
    config.players.setGroup(attributes.getValue("name"), getInt(attributes.getValue("group")));
  }
View Full Code Here

    super("config");
  }

  @Override
  void convert(Attributes attributes, Stack<PermissionContainer> stack) throws SAXException {
    Config config = new Config();
    config.init();
    stack.add(config);
  }
View Full Code Here

  public void execute(Player player, String message) {
    // Set up an integer array to hold the maximum area size
    int[] maxSize = getAreaMax(player); // X, Z

    Config config = player.getServer().config;
    String arguments[] = extractArguments(message);

    if (arguments.length == 0) {
      player.addTCaptionedMessage("Usage", commandPrefix() + "myarea [start|end|save|unsave|rename]");
      return;
    }

    if (arguments[0].equals("start")) {
      player.areastart = player.position();
      player.areastart = player.areastart.setY(0); // no height limit
      player.addTMessage(Color.GRAY, "Start coordinate set.");
    } else if (arguments[0].equals("end")) {
      player.areaend = player.position();
      player.areaend = player.areaend.setY(255); // no height limit
      player.addTMessage(Color.GRAY, "End coordinate set.");
    } else if (arguments[0].equals("save")) {
      if (player.areastart == null || player.areaend == null) {
        player.addTMessage(Color.RED, "Define start and end coordinates for your area first!");
        return;
      }
      if (!areaSizeOk(player, maxSize)) {
        player.addTMessage(Color.RED, "Your area is allowed to have a maximum size of " +
            maxSize[0] + "x" + maxSize[1] + "!");
        return;
      }
      if (player.getServer().config.playerArea(player) != null) {
        player.addTMessage(Color.RED, "New area can not be saved before you remove your old one!");
        return;
      }
      Area area = createPlayerArea(player);
      Set<Area> overlaps = config.dimensions.overlaps(area);
      if (!overlaps.isEmpty()) {
        player.addTMessage(Color.RED, "Your area overlaps with other areas and could therefore not be saved!");
        StringBuilder str = new StringBuilder();
        for (Area overlap : overlaps) {
          str.append(overlap.name);
          str.append(", ");
        }
        str.delete(str.length() - 2, str.length() - 1);
        player.addTCaptionedMessage("Overlapping areas", "%s", str);
        return;
      }
      saveArea(area, player);
      player.addTMessage(Color.GRAY, "Your area has been saved!");
    } else if (arguments[0].equals("unsave") || arguments[0].equals("remove")) {
      AreaStoragePair area = config.playerArea(player);
      if (area == null) {
        player.addTMessage(Color.RED, "You currently have no personal area which can be removed!");
        return;
      }

      area.storage.remove(area.area);
      player.addTMessage(Color.GRAY, "Your area has been removed!");
      player.getServer().saveConfig();
    } else if (arguments[0].equals("rename")) {
      AreaStoragePair area = config.playerArea(player);
      if (area == null) {
        player.addTMessage(Color.RED, "You currently have no personal area which can be renamed!");
        return;
      }
View Full Code Here

TOP

Related Classes of simpleserver.config.xml.Config

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.