public static ParticleEffect findEffect(String name) { ParticleEffect effect = null; effect = ParticleEffect.fromName(name); if (effect == null) { throw new NullPointerException("No particle could be found from: \"" + name + "\""); } return effect; }
@Override public void onRun() { Location location = getLocation(); for (int i = 0; i < particles; i++) { Vector vector = RandomUtils.getRandomVector().multiply(radius); if (!sphere) vector.setY(Math.abs(vector.getY())); location.add(vector); particle.display(location, visibleRange); location.subtract(vector); } }
public static EffectPackage findEffectPackage(String name) { ParticleData data = null; ParticleEffect effect = null; String[] splits = name.split("_"); effect = ParticleEffect.fromName(splits[0]); if (splits.length > 1) { Material mat = Material.getMaterial(Integer.parseInt(splits[1])); int materialData = 0; if (splits.length > 2) { materialData = Integer.parseInt(splits[2]); } if (mat.isBlock()) { data = new BlockData(mat, (byte) materialData); } else { data = new ItemData(mat, (byte) materialData); } } if (effect == null) { throw new NullPointerException("No particle could be found from: \"" + name + "\""); } return new EffectPackage(effect, data); }