use of org.bukkit.Particle in project InfernalMobs by NyaaCat.
the class ParticleEffect method parse.
public static ParticleEffect parse(String effect) {
try {
final String[] split = effect.split(":");
Particle p = Particle.valueOf(split[0]);
final int data1 = Integer.parseInt(split[1]);
final int data2 = Integer.parseInt(split[2]);
return new ParticleEffect(p, data1, data2);
} catch (Exception ex) {
InfernalMobs.instance.getLogger().warning("Invalid particle effect: " + effect);
return new ParticleEffect(Particle.LAVA, 1, 10);
}
}
use of org.bukkit.Particle in project CommandHelper by EngineHub.
the class BukkitMCWorld method spawnParticle.
@Override
public void spawnParticle(MCLocation l, MCParticle pa, int count, double offsetX, double offsetY, double offsetZ, double velocity, Object data) {
try {
Particle type = Particle.valueOf(pa.name());
Location loc = ((BukkitMCLocation) l).asLocation();
if (data != null && type.getDataType().equals(ItemStack.class) && data instanceof MCItemStack) {
w.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity, ((MCItemStack) data).getHandle());
} else {
w.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity);
}
} catch (NoClassDefFoundError ex) {
// probably prior to 1.9
}
}
use of org.bukkit.Particle in project CommandHelper by EngineHub.
the class BukkitMCPlayer method spawnParticle.
@Override
public void spawnParticle(MCLocation l, MCParticle pa, int count, double offsetX, double offsetY, double offsetZ, double velocity, Object data) {
try {
Particle type = Particle.valueOf(pa.name());
Location loc = ((BukkitMCLocation) l).asLocation();
if (data != null && type.getDataType().equals(ItemStack.class) && data instanceof MCItemStack) {
p.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity, ((MCItemStack) data).getHandle());
} else {
p.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity);
}
} catch (NoClassDefFoundError ex) {
// probably prior to 1.9
}
}
use of org.bukkit.Particle in project MyMaid2 by jaoafa.
the class Event_NOConcretePowderToConcrete method onBlockFormEvent.
@EventHandler
public void onBlockFormEvent(BlockFormEvent event) {
Block block = event.getBlock();
if (block.getType() != Material.CONCRETE_POWDER) {
return;
}
Location loc = block.getLocation();
List<Particle> particles = new ArrayList<>(Arrays.asList(Particle.values()));
particles.remove(Particle.MOB_APPEARANCE);
Random rnd = new Random();
int i = rnd.nextInt(particles.size());
Particle particle = particles.get(i);
loc.getWorld().spawnParticle(particle, loc, 30, 0.3, 0, 0.3);
event.setCancelled(true);
}
Aggregations