Package net.aufdemrand.denizen.objects

Examples of net.aufdemrand.denizen.objects.dWorld


            throw new InvalidArgumentsException("Must specify a value!");

        // If the world has not been specified, try to use the NPC's or player's
        // world, or default to "world" if necessary
        scriptEntry.defaultObject("world",
                ((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() ? new dWorld(((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getWorld()) : null,
                ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? new dWorld(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getWorld()) : null,
                dWorld.valueOf("world"));
    }
View Full Code Here


    @Override
    public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
        // Fetch objects
        Value value = Value.valueOf(((Element) scriptEntry.getObject("value"))
                     .asString().toUpperCase());
        dWorld world = (dWorld) scriptEntry.getObject("world");
        Type type = scriptEntry.hasObject("type") ?
                (Type) scriptEntry.getObject("type") : Type.GLOBAL;

        // Report to dB
        dB.report(scriptEntry, getName(), aH.debugObj("type", type.name()) +
                             (type.name().equalsIgnoreCase("player") ?
                             aH.debugObj("player", ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer()) : "") +
                             (type.name().equalsIgnoreCase("global") ?
                             aH.debugObj("world", world) : "") +
                             aH.debugObj("value", value));

        switch(value) {
            case SUNNY:
                if (type.equals(Type.GLOBAL)) {
                    world.getWorld().setStorm(false);
                    world.getWorld().setThundering(false);
                }
                else {
                    ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getPlayerEntity().setPlayerWeather(WeatherType.CLEAR);
                }

                break;

            case STORM:
                if (type.equals(Type.GLOBAL)) {
                    world.getWorld().setStorm(true);
                }
                else {
                    ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getPlayerEntity().setPlayerWeather(WeatherType.DOWNFALL);
                }

                break;

            case THUNDER:
                // Note: setThundering always creates a storm
                if (type.equals(Type.GLOBAL)) {
                    world.getWorld().setThundering(true);
                }
                else {
                    ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getPlayerEntity().setPlayerWeather(WeatherType.DOWNFALL);
                }
View Full Code Here

        // If the world has not been specified, try to use the NPC's or player's
        // world, or default to "world" if necessary
        if (!scriptEntry.hasObject("world")) {
            scriptEntry.addObject("world",
                    ((BukkitScriptEntryData) scriptEntry.entryData).hasNPC() ?
                    new dWorld(((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getWorld()) :
                    (((BukkitScriptEntryData) scriptEntry.entryData).hasPlayer() ?
                    new dWorld(((BukkitScriptEntryData) scriptEntry.entryData).getPlayer().getWorld()) : null));
        }

        scriptEntry.defaultObject("type", new Element("GLOBAL"));

        if (!scriptEntry.hasObject("world"))
View Full Code Here

    @Override
    public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
        // Fetch objects
        Duration value = (Duration) scriptEntry.getObject("value");
        dWorld world = (dWorld) scriptEntry.getObject("world");
        Element type_element = scriptEntry.getElement("type");
        Type type = Type.valueOf(type_element.asString().toUpperCase());

        // Report to dB
        dB.report(scriptEntry, getName(), type_element.debug()
                                          + value.debug()
                                          + world.debug());

        if (type.equals(Type.GLOBAL)) {
            world.getWorld().setTime(value.getTicks());
        }
        else {
            if (!((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer())
                dB.echoError("Must have a valid player link!");
            else
View Full Code Here

        // If the world has not been specified, try to use the NPC's or player's
        // world, or default to the specified world in the server properties if necessary

        scriptEntry.defaultObject("world",
                (((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() && ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().isSpawned()) ? new dWorld(((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getWorld()) : null,
                (((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() && ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().isOnline()) ? new dWorld(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getWorld()) : null,
                new dWorld(Bukkit.getWorlds().get(0)));
    }
View Full Code Here

    @Override
    public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException {

        // Get objects
        List<dEntity> entities = (List<dEntity>) scriptEntry.getObject("entities");
        dWorld world = (dWorld) scriptEntry.getObject("world");
        Element region = (Element) scriptEntry.getObject("region");

        // Report to dB
        dB.report(scriptEntry, getName(), aH.debugList("entities", entities) +
                             (region != null ? aH.debugObj("region", region) : ""));

        boolean conditionsMet;

        // Go through all of our entities and remove them

        for (dEntity entity : entities) {

            conditionsMet = true;

            // If this is a specific spawned entity, and all
            // other applicable conditions are met, remove it

            if (!entity.isGeneric()) {

                if (region != null) {
                    dB.echoError(scriptEntry.getResidingQueue(), "Region support is deprecated!");
                    /*conditionsMet = WorldGuardUtilities.inRegion
                                    (entity.getBukkitEntity().getLocation(),
                                    region.asString());*/
                }

                if (conditionsMet) {

                    if (entity.isNPC()) {
                        entity.getDenizenNPC().getCitizen().destroy();
                    }
                    else {
                        entity.remove();
                    }
                }
            }

            // If this is a generic unspawned entity, remove
            // all entities of this type from the world (as
            // long as they meet all other conditions)

            else {

                // Note: getting the entities from each loaded chunk
                // in the world (like in Essentials' /killall) has the
                // exact same effect as the below

                for (Entity worldEntity : world.getEntities()) {

                    // If this entity from the world is of the same type
                    // as our current dEntity, and all other applicable
                    // conditions are met, remove it

View Full Code Here

    //
    // -->
    @EventHandler
    public void onChunkLoad(ChunkUnloadEvent event) {
        Map<String, dObject> context = new HashMap<String, dObject>();
        dWorld world = new dWorld(event.getWorld());
        context.put("chunk", new dChunk(event.getChunk()));
        String determination = EventManager.doEvents(Arrays.asList("chunk unloads",
                "chunk unloads " + world.identify()), null, null, context, true);
        if (determination.equalsIgnoreCase("cancelled"))
            event.setCancelled(true);
    }
View Full Code Here

    @Override
    public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

        Element id = scriptEntry.getElement("map-id");
        dWorld create = scriptEntry.getdObject("new");
        dLocation reset = scriptEntry.getdObject("reset");
        Element image = scriptEntry.getElement("image");
        Element resize = scriptEntry.getElement("resize");
        Element text = scriptEntry.getElement("text");
        Element x = scriptEntry.getElement("x-value");
        Element y = scriptEntry.getElement("y-value");

        dB.report(scriptEntry, getName(), (id != null ? id.debug() : "") + (create != null ? create.debug() : "")
                + (reset != null ? reset.debug() : "") + (image != null ? image.debug() : "") + resize.debug()
                + (text != null ? text.debug() : "") + x.debug() + y.debug());

        MapView map = null;
        if (create != null) {
            map = Bukkit.getServer().createMap(create.getWorld());
            scriptEntry.addObject("created_map", new Element(map.getId()));
        }
        else if (id != null) {
            map = Bukkit.getServer().getMap((short) id.asInt());
            if (map == null)
View Full Code Here

    @Override
    public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

        Element action = scriptEntry.getElement("action");
        dWorld world = (dWorld) scriptEntry.getObject("world");
        Element group = scriptEntry.getElement("group");

        // Report to dB
        dB.report(scriptEntry, getName(), action.debug() + (world != null ? world.debug(): "") + group.debug());

        World bukkitWorld = null;
        if (world != null)
            bukkitWorld = world.getWorld();

        OfflinePlayer player = ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getOfflinePlayer();
        boolean inGroup = Depends.permissions.playerInGroup((bukkitWorld == null ? null: bukkitWorld.getName()), player, group.asString());

        switch (Action.valueOf(action.asString().toUpperCase())) {
View Full Code Here

    public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

        Element action = scriptEntry.getElement("action");
        Element permission = scriptEntry.getElement("permission");
        Element group = scriptEntry.getElement("group");
        dWorld world = (dWorld) scriptEntry.getObject("world");

        // Report to dB
        dB.report(scriptEntry, getName(), action.debug() + permission.debug()
                + (group != null ? group.debug() : "") + (world != null ? world.debug(): ""));

        World bukkitWorld = null;
        if (world != null)
            bukkitWorld = world.getWorld();

        OfflinePlayer player = ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getOfflinePlayer() : null;

        switch (Action.valueOf(action.asString().toUpperCase())) {
            case ADD:
View Full Code Here

TOP

Related Classes of net.aufdemrand.denizen.objects.dWorld

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.