org.bukkit.Particle.DustOptions Java Examples

The following examples show how to use org.bukkit.Particle.DustOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Network.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method runs the network visualizer which displays a {@link Particle} on
 * every {@link Location} that this {@link Network} can connect to.
 */
public void display() {
    Slimefun.runSync(() -> {
        DustOptions options = new DustOptions(Color.BLUE, 2F);

        for (Location l : connectedLocations) {
            l.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, options);
        }
    });
}
 
Example #2
Source File: QuadCrateSession.java    From Crazy-Crates with MIT License 4 votes vote down vote up
private void spawnParticles(QuadCrateParticles quadCrateParticle, Color particleColor, Location location1, Location location2) {
    if (Version.getCurrentVersion().isNewer(Version.v1_8_R3)) {
        Particle particle;
        switch (quadCrateParticle) {
            case FLAME:
                particle = Particle.FLAME;
                break;
            case VILLAGER_HAPPY:
                particle = Particle.VILLAGER_HAPPY;
                break;
            case SPELL_WITCH:
                particle = Particle.SPELL_WITCH;
                break;
            default:
                particle = Particle.REDSTONE;
        }
        if (Version.getCurrentVersion().isNewer(Version.v1_12_R1)) {
            if (particle == Particle.REDSTONE) {
                location1.getWorld().spawnParticle(particle, location1, 0, new DustOptions(particleColor, 1));
                location2.getWorld().spawnParticle(particle, location2, 0, new DustOptions(particleColor, 1));
            } else {
                location1.getWorld().spawnParticle(particle, location1, 0);
                location2.getWorld().spawnParticle(particle, location2, 0);
            }
        } else {
            location1.getWorld().spawnParticle(particle, location1, 0);
            location2.getWorld().spawnParticle(particle, location2, 0);
        }
    } else {
        ParticleEffect particleEffect;
        switch (quadCrateParticle) {
            case FLAME:
                particleEffect = ParticleEffect.FLAME;
                break;
            case VILLAGER_HAPPY:
                particleEffect = ParticleEffect.VILLAGER_HAPPY;
                break;
            case SPELL_WITCH:
                particleEffect = ParticleEffect.SPELL_WITCH;
                break;
            default:
                particleEffect = ParticleEffect.REDSTONE;
        }
        particleEffect.display(0, 0, 0, 0, 1, location1, 100);
        particleEffect.display(0, 0, 0, 0, 1, location2, 100);
    }
}