Package net.aufdemrand.denizen.utilities

Examples of net.aufdemrand.denizen.utilities.ParticleEffect


                    scriptEntry.addObject("particleeffect",
                            ParticleEffect.valueOf(arg.getValue().toUpperCase()));
                }
                else if (arg.matches("random")) {
                    // Get another effect if "RANDOM" is used
                    ParticleEffect effect = null;
                    // Make sure the new effect is not an invisible effect
                    while (effect == null || effect.toString().matches("^(BUBBLE|SUSPEND|DEPTH_SUSPEND)$")) {
                        effect = ParticleEffect.values()[CoreUtilities.getRandom().nextInt(ParticleEffect.values().length)];
                    }
                    scriptEntry.addObject("particleeffect", effect);
                }
                else if (arg.startsWith("iconcrack_")) {
View Full Code Here


        // Extract objects from ScriptEntry
        List<dLocation> locations = (List<dLocation>) scriptEntry.getObject("location");
        List<dPlayer> targets = (List<dPlayer>) scriptEntry.getObject("targets");
        Effect effect = (Effect) scriptEntry.getObject("effect");
        ParticleEffect particleEffect = (ParticleEffect) scriptEntry.getObject("particleeffect");
        Element iconcrack = scriptEntry.getElement("iconcrack");
        Element radius = scriptEntry.getElement("radius");
        Element data = scriptEntry.getElement("data");
        Element qty = scriptEntry.getElement("qty");
        Element offset = scriptEntry.getElement("offset");

        // Report to dB
        dB.report(scriptEntry, getName(), (effect != null ? aH.debugObj("effect", effect.name()) :
                particleEffect != null ? aH.debugObj("special effect", particleEffect.name()) :
                iconcrack.debug()) +
                aH.debugObj("locations", locations.toString()) +
                (targets != null ? aH.debugObj("targets", targets.toString()): "") +
                radius.debug() +
                data.debug() +
                qty.debug() +
                (effect != null ? "" : offset.debug()));

        for (dLocation location: locations) {
            // Slightly increase the location's Y so effects don't seem to come out of the ground
            location.add(0, 1, 0);

            // Play the Bukkit effect the number of times specified
            if (effect != null) {
                for (int n = 0; n < qty.asInt(); n++) {
                    if (targets != null) {
                        for (dPlayer player: targets)
                            if (player.isValid() && player.isOnline()) player.getPlayerEntity().playEffect(location, effect, data.asInt());
                    }
                    else {
                        location.getWorld().playEffect(location, effect, data.asInt(), radius.asInt());
                    }
                }
            }

            // Play a ParticleEffect
            else if (particleEffect != null) {
                float os = offset.asFloat();
                List<Player> players = new ArrayList<Player>();
                if (targets == null)
                    players = ParticleEffect.getPlayersInRange(location, radius.asDouble());
                else {
                    for (dPlayer player: targets)
                        if (player.isValid() && player.isOnline()) players.add(player.getPlayerEntity());
                }
                particleEffect.display(location, os, os, os, data.asFloat(), qty.asInt(), players);
            }

            // Play an iconcrack (item break) effect
            else {
                float os = offset.asFloat();
View Full Code Here

TOP

Related Classes of net.aufdemrand.denizen.utilities.ParticleEffect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.