Search in sources :

Example 51 with Element

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

the class EntitySpawnScriptEvent method onEntityInteract.

@EventHandler
public void onEntityInteract(CreatureSpawnEvent event) {
    Entity entity = event.getEntity();
    this.entity = new dEntity(entity);
    location = new dLocation(event.getLocation());
    cuboids = new dList();
    for (dCuboid cuboid : dCuboid.getNotableCuboidsContaining(location)) {
        cuboids.add(cuboid.identifySimple());
    }
    reason = new Element(event.getSpawnReason().name());
    cancelled = event.isCancelled();
    this.event = event;
    dEntity.rememberEntity(entity);
    fire();
    dEntity.forgetEntity(entity);
    event.setCancelled(cancelled);
}
Also used : Entity(org.bukkit.entity.Entity) net.aufdemrand.denizen.objects.dEntity(net.aufdemrand.denizen.objects.dEntity) net.aufdemrand.denizen.objects.dEntity(net.aufdemrand.denizen.objects.dEntity) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList) Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizen.objects.dLocation(net.aufdemrand.denizen.objects.dLocation) net.aufdemrand.denizen.objects.dCuboid(net.aufdemrand.denizen.objects.dCuboid) EventHandler(org.bukkit.event.EventHandler)

Example 52 with Element

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

the class EntityTargetsScriptEvent method onEntityTargets.

@EventHandler
public void onEntityTargets(EntityTargetEvent event) {
    entity = new dEntity(event.getEntity());
    reason = new Element(event.getReason().toString());
    target = event.getTarget() != null ? new dEntity(event.getTarget()) : null;
    location = new dLocation(event.getEntity().getLocation());
    cuboids = new dList();
    for (dCuboid cuboid : dCuboid.getNotableCuboidsContaining(location)) {
        cuboids.add(cuboid.identifySimple());
    }
    cancelled = event.isCancelled();
    this.event = event;
    fire();
    event.setCancelled(cancelled);
}
Also used : net.aufdemrand.denizen.objects.dEntity(net.aufdemrand.denizen.objects.dEntity) Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList) net.aufdemrand.denizen.objects.dLocation(net.aufdemrand.denizen.objects.dLocation) net.aufdemrand.denizen.objects.dCuboid(net.aufdemrand.denizen.objects.dCuboid) EventHandler(org.bukkit.event.EventHandler)

Example 53 with Element

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

the class BiomeEnterExitScriptEvent method onPlayerEntersExitsBiome.

@EventHandler
public void onPlayerEntersExitsBiome(PlayerMoveEvent event) {
    from = new dLocation(event.getFrom());
    to = new dLocation(event.getTo());
    old_biome = new Element(from.getBlock().getBiome().name());
    new_biome = new Element(to.getBlock().getBiome().name());
    if (old_biome.identify().equals(new_biome.identify())) {
        return;
    }
    cancelled = event.isCancelled();
    this.event = event;
    fire();
    event.setCancelled(cancelled);
}
Also used : Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizen.objects.dLocation(net.aufdemrand.denizen.objects.dLocation) EventHandler(org.bukkit.event.EventHandler)

Example 54 with Element

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

the class ItemScrollScriptEvent method onPlayerScrollsHotbar.

@EventHandler
public void onPlayerScrollsHotbar(PlayerItemHeldEvent event) {
    new_slot = new Element(event.getNewSlot() + 1);
    previous_slot = new Element(event.getPreviousSlot() + 1);
    cancelled = event.isCancelled();
    this.event = event;
    fire();
    event.setCancelled(cancelled);
}
Also used : Element(net.aufdemrand.denizencore.objects.Element) EventHandler(org.bukkit.event.EventHandler)

Example 55 with Element

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

the class PortalCreateScriptEvent method onPortalCreate.

@EventHandler
public void onPortalCreate(PortalCreateEvent event) {
    world = new dWorld(event.getWorld());
    reason = new Element(event.getReason().toString());
    blocks = new dList();
    for (Block block : event.getBlocks()) {
        blocks.add(new dLocation(block.getLocation()).identify());
    }
    this.event = event;
    cancelled = event.isCancelled();
    fire();
    event.setCancelled(cancelled);
}
Also used : Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList) Block(org.bukkit.block.Block) 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)

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