use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.
the class EntityPotionEffectScriptEvent method onEntityPotionEffect.
@EventHandler
public void onEntityPotionEffect(EntityPotionEffectEvent event) {
entity = new EntityTag(event.getEntity());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.
the class EntityShootsBowEvent method applyDetermination.
@Override
public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
String determination = determinationObj.toString();
if (determinationObj instanceof ElementTag) {
String lower = CoreUtilities.toLowerCase(determination);
if (lower.equals("keep_item")) {
event.setConsumeItem(false);
if (entity.isPlayer()) {
final Player p = entity.getPlayer();
Bukkit.getScheduler().scheduleSyncDelayedTask(Denizen.getInstance(), p::updateInventory, 1);
}
return true;
}
}
if (Argument.valueOf(determination).matchesArgumentList(EntityTag.class)) {
cancelled = true;
cancellationChanged();
// Get the list of entities
List<EntityTag> newProjectiles = ListTag.getListFor(determinationObj, getTagContext(path)).filter(EntityTag.class, path.container, true);
// Go through all the entities, spawning/teleporting them
for (EntityTag newProjectile : newProjectiles) {
newProjectile.spawnAt(entity.getEyeLocation().add(entity.getEyeLocation().getDirection()));
// where applicable
if (newProjectile.isProjectile()) {
newProjectile.setShooter(entity);
}
}
// Mount the projectiles on top of each other
Position.mount(Conversion.convertEntities(newProjectiles));
// Get the last entity on the list, i.e. the one at the bottom
// if there are many mounted on top of each other
Entity lastProjectile = newProjectiles.get(newProjectiles.size() - 1).getBukkitEntity();
// Give it the same velocity as the arrow that would
// have been shot by the bow
// Note: No, I can't explain why this has to be multiplied by three, it just does.
lastProjectile.setVelocity(event.getEntity().getLocation().getDirection().multiply(event.getForce() * 3));
return true;
}
return super.applyDetermination(path, determinationObj);
}
use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.
the class EntitySwimScriptEvent method onEntityToggleSwim.
@EventHandler
public void onEntityToggleSwim(EntityToggleSwimEvent event) {
entity = new EntityTag(event.getEntity());
state = event.isSwimming();
fire(event);
}
use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.
the class CreeperPoweredScriptEvent method onCreeperPowered.
@EventHandler
public void onCreeperPowered(CreeperPowerEvent event) {
lightning = new EntityTag(event.getLightning());
entity = new EntityTag(event.getEntity());
cause = new ElementTag(event.getCause().name());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.EntityTag in project Denizen-For-Bukkit by DenizenScript.
the class DragonPhaseChangeScriptEvent method onEnderDragonChangePhase.
@EventHandler
public void onEnderDragonChangePhase(EnderDragonChangePhaseEvent event) {
entity = new EntityTag(event.getEntity());
this.event = event;
fire(event);
}
Aggregations