@Override public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) { if (effect.getType() == Type.PARTICLE) { MaterialData material = new MaterialData(id, (byte) data); showParticle(location, effect, material, offsetX, offsetY, offsetZ, speed, particleCount); } else { GlowPlayer.this.playEffect(location, effect, data); } }
/** * Sends a {@link PlayParticleMessage} to display the given particle. * * @param loc the location * @param particle the particle type * @param material the item or block data * @param offsetX TODO: document this parameter * @param offsetY TODO: document this parameter * @param offsetZ TODO: document this parameter * @param speed TODO: document this parameter * @param amount the number of particles */ //@Override public void showParticle(Location loc, Effect particle, MaterialData material, float offsetX, float offsetY, float offsetZ, float speed, int amount) { if (location == null || particle == null || particle.getType() != Type.PARTICLE) { return; } int id = GlowParticle.getId(particle); boolean longDistance = GlowParticle.isLongDistance(particle); float x = (float) loc.getX(); float y = (float) loc.getY(); float z = (float) loc.getZ(); int[] extData = GlowParticle.getExtData(particle, material); session.send(new PlayParticleMessage(id, longDistance, x, y, z, offsetX, offsetY, offsetZ, speed, amount, extData)); }
return Stream.concat( Arrays.stream(Effect.values()).filter(effect -> effect.getType() == Effect.Type.VISUAL), Arrays.stream(PowerParticle.DeprecatedEffect.values())
@Override public Optional<Effect> set(String value) { PowerParticle.this.data = null; try { Effect eff = Effect.valueOf(value.toUpperCase()); if (eff.getType() == Effect.Type.VISUAL) { PowerParticle.this.effect = eff; PowerParticle.this.particle = null; return Optional.empty(); } throw new Handler.CommandException("message.error.visualeffect", value); } catch (IllegalArgumentException e) { DeprecatedEffect particleEffect = DeprecatedEffect.valueOf(value); PowerParticle.this.effect = null; PowerParticle.this.particle = particleEffect.getParticle(); return Optional.empty(); } } }