Package net.aufdemrand.denizen.objects

Examples of net.aufdemrand.denizen.objects.dLocation


    @SuppressWarnings("unchecked")
    @Override
    public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException {
        // Get objects

        dLocation origin = (dLocation) scriptEntry.getObject("origin");
        List<dEntity> entities = (List<dEntity>) scriptEntry.getObject("entities");
        final List<dLocation> destinations = scriptEntry.hasObject("destinations") ?
                                (List<dLocation>) scriptEntry.getObject("destinations") :
                                new ArrayList<dLocation>();
View Full Code Here


    @SuppressWarnings("unchecked")
    @Override
    public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException {
        // Get objects

        dLocation location = (dLocation) scriptEntry.getObject("location");
        List<dEntity> entities = (List<dEntity>) scriptEntry.getObject("entities");
        boolean cancel = scriptEntry.hasObject("cancel");

        // Report to dB
        dB.report(scriptEntry, getName(), (cancel ? aH.debugObj("cancel", cancel) : "") +
View Full Code Here

    }

    @Override
    public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
        dLocation location = (dLocation) scriptEntry.getObject("location");
        if (((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getEntityType() != EntityType.PLAYER
                && ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getEntityType() != EntityType.OCELOT
                && ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getEntityType() != EntityType.WOLF) {
            dB.echoError(scriptEntry.getResidingQueue(), "...only Player, ocelot, or wolf type NPCs can sit!");
            return;
        }

        dB.report(scriptEntry, getName(), aH.debugObj("npc", ((BukkitScriptEntryData)scriptEntry.entryData).getNPC())
                                        + (location != null ? location.debug(): ""));

        if (((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getEntityType() == EntityType.OCELOT) {
            ((Ocelot)((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getEntity()).setSitting(true);
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException {
        // Get objects

        final dLocation location = scriptEntry.hasObject("location") ?
                                   (dLocation) scriptEntry.getObject("location") :
                ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getLocation();

        Element type = (Element) scriptEntry.getObject("type");
        Element power = (Element) scriptEntry.getObject("power");
        boolean flicker = scriptEntry.hasObject("flicker");
        boolean trail = scriptEntry.hasObject("trail");
        List<dColor> primary = (List<dColor>) scriptEntry.getObject("primary");
        List<dColor> fade = (List<dColor>) scriptEntry.getObject("fade");

        // Report to dB
        dB.report(scriptEntry, getName(), location.debug() +
                             type.debug() +
                             power.debug() +
                             (flicker ? aH.debugObj("flicker", flicker) : "") +
                             (trail ? aH.debugObj("trail", trail) : "") +
                             aH.debugObj("primary colors", primary.toString()) +
                             (fade != null ? aH.debugObj("fade colors", fade.toString()) : ""));

        Firework firework = location.getWorld().spawn(location, Firework.class);
        FireworkMeta fireworkMeta = firework.getFireworkMeta();
        fireworkMeta.setPower(power.asInt());

        Builder fireworkBuilder = FireworkEffect.builder();
        fireworkBuilder.with(FireworkEffect.Type.valueOf(type.asString().toUpperCase()));
View Full Code Here

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

        // Get objects
        Action action = (Action) scriptEntry.getObject("action");
        dLocation location = (dLocation) scriptEntry.getObject("location");
        Element range = (Element) scriptEntry.getObject("range");
        Element id = (Element) scriptEntry.getObject("id");

        // Report to dB
        dB.report(scriptEntry, getName(),
                aH.debugObj("NPC", ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().toString())
                        + action.name() + id.debug()
                        + (location != null ? location.debug() : "")
                        + (range != null ? range.debug() : "" ));

        dNPC npc = ((BukkitScriptEntryData)scriptEntry.entryData).getNPC();

        if (!npc.getCitizen().hasTrait(Anchors.class))
View Full Code Here

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

        // Extract objects from ScriptEntry
        dLocation location = (dLocation) scriptEntry.getObject("location");
        Boolean damage = scriptEntry.getElement("damage").asBoolean();

        // Debugger
        dB.report(scriptEntry, getName(),
                location.debug()
                + aH.debugObj("Damageable", String.valueOf(damage)));

        // Play the sound
        if (damage)
            location.getWorld().strikeLightning(location);
        else
            location.getWorld().strikeLightningEffect(location);
    }
View Full Code Here

        scriptEntry.defaultObject("switchstate", new Element("TOGGLE"));
    }

    @Override
    public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
        final dLocation interactLocation = (dLocation)scriptEntry.getObject("location");
        int duration = ((Duration)scriptEntry.getObject("duration")).getSecondsAsInt();
        final SwitchState switchState = SwitchState.valueOf(scriptEntry.getElement("switchstate").asString());

        final Player player = ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getPlayerEntity(): null;
        // Switch the Block
        final ScriptEntry se = scriptEntry;
        switchBlock(se, interactLocation, switchState, player);

        // If duration set, schedule a delayed task.
        if (duration > 0) {
            // If this block already had a delayed task, cancel it.
            if (taskMap.containsKey(interactLocation))
                try { DenizenAPI.getCurrentInstance().getServer().getScheduler().cancelTask(taskMap.get(interactLocation)); } catch (Exception e) { }
            dB.log("Setting delayed task 'SWITCH' for " + interactLocation.identify());
            // Store new delayed task ID, for checking against, then schedule new delayed task.
            taskMap.put(interactLocation, DenizenAPI.getCurrentInstance().getServer().getScheduler().scheduleSyncDelayedTask(DenizenAPI.getCurrentInstance(),
                    new Runnable() {
                        public void run() {
                    // Check to see if the state of the block is what is expected. If switched during
                    // the duration, the switchback is cancelled.
                    if (switchState == SwitchState.OFF && !((interactLocation.getBlock().getData() & 0x8) > 0))
                        switchBlock(se, interactLocation, SwitchState.ON, player);
                    else if (switchState == SwitchState.ON && ((interactLocation.getBlock().getData() & 0x8) > 0))
                        switchBlock(se, interactLocation, SwitchState.OFF, player);
                    else if (switchState == SwitchState.TOGGLE) switchBlock(se, interactLocation, SwitchState.TOGGLE, player);
                }
            }, duration * 20));
        }
View Full Code Here

            // if they are delimited by quotes, their max number is checked
            // before that, so it needs to be high
            min = 2, max = 20, permission = "denizen.notable.basic")
    public void addnotable(CommandContext args, CommandSender sender) throws CommandException {

        NotableManager.saveAs(new dLocation(((Player) sender).getLocation()), args.getString(1));
        Messaging.send(sender, "Created new notable called " + (args.getString(1)));
    }
View Full Code Here

    //
    // -->
    @EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {
        Map<String, dObject> context = new HashMap<String, dObject>();
        context.put("old_location", new dLocation(event.getFrom()));
        context.put("new_location", new dLocation(event.getTo()));
        String determination = EventManager.doEvents(Arrays.asList("player walks"), null, new dPlayer(event.getPlayer()), context, true);
        if (determination.equalsIgnoreCase("CANCELLED"))
            event.setCancelled(true);
    }
View Full Code Here

        Biome to = event.getTo().getWorld().getBiome(event.getTo().getBlockX(), event.getTo().getBlockZ());
        if (!from.equals(to)) {

            // Create contexts
            Map<String, dObject> context = new HashMap<String, dObject>();
            context.put("from", new dLocation(event.getFrom()));
            context.put("to", new dLocation(event.getFrom()));
            context.put("old_biome", new Element(from.name()));
            context.put("new_biome", new Element(to.name()));

            String determination = EventManager.doEvents(Arrays.asList(
                    "player enters biome", "player exits biome",
View Full Code Here

TOP

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

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.