Search in sources :

Example 91 with Element

use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.

the class RedstoneScriptEvent method onBlockRedstone.

@EventHandler
public void onBlockRedstone(BlockRedstoneEvent event) {
    location = new dLocation(event.getBlock().getLocation());
    old_current = new Element(event.getOldCurrent());
    new_current = new Element(event.getNewCurrent());
    this.event = event;
    fire();
    event.setNewCurrent(new_current.asInt());
}
Also used : Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizen.objects.dLocation(net.aufdemrand.denizen.objects.dLocation) EventHandler(org.bukkit.event.EventHandler)

Example 92 with Element

use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.

the class StructureGrowsScriptEvent method onStructureGrow.

@EventHandler
public void onStructureGrow(StructureGrowEvent event) {
    world = new dWorld(event.getWorld());
    location = new dLocation(event.getLocation());
    structure = new Element(event.getSpecies().name());
    blocks = new dList();
    new_materials = new dList();
    for (BlockState block : event.getBlocks()) {
        blocks.add(new dLocation(block.getLocation()).identify());
        new_materials.add(dMaterial.getMaterialFrom(block.getType(), block.getRawData()).identify());
    }
    this.event = event;
    cancelled = event.isCancelled();
    fire();
    event.setCancelled(cancelled);
}
Also used : BlockState(org.bukkit.block.BlockState) Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList) net.aufdemrand.denizen.objects.dWorld(net.aufdemrand.denizen.objects.dWorld) net.aufdemrand.denizen.objects.dLocation(net.aufdemrand.denizen.objects.dLocation) EventHandler(org.bukkit.event.EventHandler)

Example 93 with Element

use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.

the class WeatherChangesScriptEvent method onWeatherChanges.

@EventHandler
public void onWeatherChanges(WeatherChangeEvent event) {
    world = new dWorld(event.getWorld());
    weather = new Element(event.toWeatherState() ? "rains" : "clears");
    this.event = event;
    cancelled = event.isCancelled();
    fire();
    event.setCancelled(cancelled);
}
Also used : Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizen.objects.dWorld(net.aufdemrand.denizen.objects.dWorld) EventHandler(org.bukkit.event.EventHandler)

Example 94 with Element

use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.

the class ChatScriptEvent method applyDetermination.

@Override
public boolean applyDetermination(ScriptContainer container, String determination) {
    String lower = CoreUtilities.toLowerCase(determination);
    if (lower.startsWith("format:")) {
        String name = determination.substring(7);
        FormatScriptContainer formatscr = ScriptRegistry.getScriptContainer(name);
        if (formatscr == null) {
            dB.echoError("Could not find format script matching '" + name + '\'');
        } else {
            String formatstr = formatscr.getFormatText(null, player);
            if (net.aufdemrand.denizencore.utilities.debugging.dB.verbose) {
                dB.log("Setting format to " + formatstr);
            }
            format = new Element(formatstr);
        }
    } else if (lower.startsWith("recipients:")) {
        String rec_new = determination.substring(11);
        dList recs = dList.valueOf(rec_new);
        List<dPlayer> players = recs.filter(dPlayer.class);
        recipients.clear();
        for (dPlayer player : players) {
            recipients.add(player.getPlayerEntity());
        }
    } else if (!lower.startsWith("cancelled")) {
        message = new Element(determination);
    } else {
        return super.applyDetermination(container, determination);
    }
    return true;
}
Also used : FormatScriptContainer(net.aufdemrand.denizen.scripts.containers.core.FormatScriptContainer) Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList) net.aufdemrand.denizen.objects.dPlayer(net.aufdemrand.denizen.objects.dPlayer) List(java.util.List) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList)

Example 95 with Element

use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.

the class ListPingScriptEvent method onListPing.

@EventHandler
public void onListPing(ServerListPingEvent event) {
    motd = new Element(event.getMotd());
    max_players = new Element(event.getMaxPlayers());
    num_players = new Element(event.getNumPlayers());
    address = new Element(event.getAddress().toString());
    this.event = event;
    fire();
    event.setMaxPlayers(max_players.asInt());
    event.setMotd(motd.asString());
}
Also used : Element(net.aufdemrand.denizencore.objects.Element) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Element (net.aufdemrand.denizencore.objects.Element)166 net.aufdemrand.denizencore.objects.dList (net.aufdemrand.denizencore.objects.dList)74 net.aufdemrand.denizen.objects.dEntity (net.aufdemrand.denizen.objects.dEntity)49 net.aufdemrand.denizen.objects.dLocation (net.aufdemrand.denizen.objects.dLocation)46 BukkitScriptEntryData (net.aufdemrand.denizen.BukkitScriptEntryData)38 InvalidArgumentsException (net.aufdemrand.denizencore.exceptions.InvalidArgumentsException)38 EventHandler (org.bukkit.event.EventHandler)38 List (java.util.List)29 net.aufdemrand.denizencore.objects.aH (net.aufdemrand.denizencore.objects.aH)28 net.aufdemrand.denizen.objects.dPlayer (net.aufdemrand.denizen.objects.dPlayer)27 net.aufdemrand.denizencore.objects.dObject (net.aufdemrand.denizencore.objects.dObject)21 Duration (net.aufdemrand.denizencore.objects.Duration)20 CommandExecutionException (net.aufdemrand.denizencore.exceptions.CommandExecutionException)16 ArrayList (java.util.ArrayList)14 net.aufdemrand.denizen.objects.dItem (net.aufdemrand.denizen.objects.dItem)14 net.aufdemrand.denizen.objects.dNPC (net.aufdemrand.denizen.objects.dNPC)14 Player (org.bukkit.entity.Player)11 net.aufdemrand.denizen.objects.dWorld (net.aufdemrand.denizen.objects.dWorld)10 net.aufdemrand.denizencore.objects.dScript (net.aufdemrand.denizencore.objects.dScript)10 ScriptEntry (net.aufdemrand.denizencore.scripts.ScriptEntry)9