コード例 #1
0
ファイル: ParticleEffect.java プロジェクト: wizjany/craftbook
  @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);
    }
  }
コード例 #2
0
  @Override
  public void run() {

    for (Player player : effects.playerList) {
      for (String particleEffect :
          (ArrayList<String>) player.getMetadata(effects.PARTICLE_KEY).get(0).value()) {
        player.getWorld().playEffect(player.getLocation(), Effect.valueOf(particleEffect), 7, 30);
      }
    }
  }