Ejemplo n.º 1
0
  @Override
  public void load() {

    String[] eff =
        RegexUtil.COLON_PATTERN.split(RegexUtil.EQUALS_PATTERN.split(getSign().getLine(2))[0], 2);
    try {
      effectID = Integer.parseInt(eff[0]);
    } catch (Exception e) {
      effectID = Effect.valueOf(eff[0]).getId();
    }
    if (Effect.getById(effectID) == null) return;
    try {
      effectData = Integer.parseInt(eff[1]);
    } catch (Exception e) {
      effectData = 0;
    }

    try {
      times = Integer.parseInt(getSign().getLine(3));
    } catch (Exception ignored) {
      times = 1;
    }

    try {
      String[] off =
          RegexUtil.COLON_PATTERN.split(RegexUtil.EQUALS_PATTERN.split(getSign().getLine(2))[1], 2);
      offset =
          new Vector(
              Double.parseDouble(off[0]), Double.parseDouble(off[1]), Double.parseDouble(off[2]));
    } catch (Exception e) {
      offset = new Vector(0, 1, 0);
    }
  }
Ejemplo n.º 2
0
  @Override
  public void load() {

    radius = ICUtil.parseRadius(getSign());
    String radiusString = radius.getBlockX() + "," + radius.getBlockY() + "," + radius.getBlockZ();
    if (radius.getBlockX() == radius.getBlockY() && radius.getBlockY() == radius.getBlockZ())
      radiusString = String.valueOf(radius.getBlockX());
    if (getLine(2).contains("=")) {
      getSign().setLine(2, radiusString + "=" + RegexUtil.EQUALS_PATTERN.split(getLine(2))[1]);
      centre = ICUtil.parseBlockLocation(getSign(), 2).getLocation();
    } else {
      getSign().setLine(2, radiusString);
      centre = getBackBlock().getLocation();
    }

    include = !getLine(3).startsWith("-");

    for (String bit : getLine(3).replace("-", "").split(",")) {

      filters.add(ItemUtil.getItem(bit));
    }

    chest = getBackBlock().getRelative(0, 1, 0);
  }