Package net.aufdemrand.denizen.flags.FlagManager

Examples of net.aufdemrand.denizen.flags.FlagManager.Flag


                name.debug() + (index > 0 ? aH.debugObj("Index", String.valueOf(index)) : "")
                        + aH.debugUniqueObj("Action/Value", action.toString(), (value != null ? value.asString() : "null"))
                        + (duration != null ? duration.debug() : "")
                        + flag_target.debug());

        Flag flag;

        // Returns existing flag (if existing), or a new flag if not
        if (flag_target instanceof Element)
            flag = DenizenAPI.getCurrentInstance().flagManager().getGlobalFlag(name.asString());

        else if (flag_target instanceof dPlayer)
            flag = DenizenAPI.getCurrentInstance().flagManager().getPlayerFlag((dPlayer) flag_target, name.asString());

        else if (flag_target instanceof dNPC)
            flag = DenizenAPI.getCurrentInstance().flagManager().getNPCFlag(((dNPC) flag_target).getId(), name.asString());

        else throw new CommandExecutionException("Could not fetch a flag for this entity: " + flag_target.debug());

        // Do the action!
        flag.doAction(action, value, index);

        // Set flag duration
        if (flag.StillValid() && duration != null && duration.getSeconds() > 0)
            flag.setExpiration(System.currentTimeMillis()
                    + Double.valueOf(duration.getSeconds() * 1000).longValue());

        else if (flag.StillValid() && flag.expiration().getMillis() != 0L) flag.setExpiration(0L);
    }
View Full Code Here

TOP

Related Classes of net.aufdemrand.denizen.flags.FlagManager.Flag

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.