@@ -1,7 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.TravelAgent;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -15,63 +14,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class EntityPortalEvent extends EntityTeleportEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected boolean useTravelAgent = true;
|
||||
protected TravelAgent travelAgent;
|
||||
|
||||
public EntityPortalEvent(@NotNull final Entity entity, @NotNull final Location from, @Nullable final Location to, @NotNull final TravelAgent pta) {
|
||||
public EntityPortalEvent(@NotNull final Entity entity, @NotNull final Location from, @Nullable final Location to) {
|
||||
super(entity, from, to);
|
||||
this.travelAgent = pta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not the Travel Agent will be used.
|
||||
* <p>
|
||||
* If this is set to true, the TravelAgent will try to find a Portal at
|
||||
* the {@link #getTo()} Location, and will try to create one if there is
|
||||
* none.
|
||||
* <p>
|
||||
* If this is set to false, the {@link #getEntity()} will only be
|
||||
* teleported to the {@link #getTo()} Location.
|
||||
*
|
||||
* @param useTravelAgent whether to use the Travel Agent
|
||||
*/
|
||||
public void useTravelAgent(boolean useTravelAgent) {
|
||||
this.useTravelAgent = useTravelAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether or not the Travel Agent will be used.
|
||||
* <p>
|
||||
* If this is set to true, the TravelAgent will try to find a Portal at
|
||||
* the {@link #getTo()} Location, and will try to create one if there is
|
||||
* none.
|
||||
* <p>
|
||||
* If this is set to false, the {@link #getEntity()} will only be
|
||||
* teleported to the {@link #getTo()} Location.
|
||||
*
|
||||
* @return whether to use the Travel Agent
|
||||
*/
|
||||
public boolean useTravelAgent() {
|
||||
return useTravelAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Travel Agent used (or not) in this event.
|
||||
*
|
||||
* @return the Travel Agent used (or not) in this event
|
||||
*/
|
||||
@NotNull
|
||||
public TravelAgent getPortalTravelAgent() {
|
||||
return this.travelAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Travel Agent used (or not) in this event.
|
||||
*
|
||||
* @param travelAgent the Travel Agent used (or not) in this event
|
||||
*/
|
||||
public void setPortalTravelAgent(@NotNull TravelAgent travelAgent) {
|
||||
this.travelAgent = travelAgent;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -19,7 +18,7 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
|
||||
private final float force;
|
||||
private boolean cancelled;
|
||||
|
||||
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Projectile projectile, final float force) {
|
||||
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
|
||||
super(shooter);
|
||||
this.bow = bow;
|
||||
this.projectile = projectile;
|
||||
|
||||
@@ -151,6 +151,10 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
||||
* entity
|
||||
*/
|
||||
CLOSEST_ENTITY,
|
||||
/**
|
||||
* When a raiding entity selects the same target as one of its compatriots.
|
||||
*/
|
||||
FOLLOW_LEADER,
|
||||
/**
|
||||
* When another entity tempts this entity by having a desired item such
|
||||
* as wheat in it's hand.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.AbstractVillager;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.MerchantRecipe;
|
||||
@@ -16,7 +16,7 @@ public class VillagerAcquireTradeEvent extends EntityEvent implements Cancellabl
|
||||
//
|
||||
private MerchantRecipe recipe;
|
||||
|
||||
public VillagerAcquireTradeEvent(@NotNull Villager what, @NotNull MerchantRecipe recipe) {
|
||||
public VillagerAcquireTradeEvent(@NotNull AbstractVillager what, @NotNull MerchantRecipe recipe) {
|
||||
super(what);
|
||||
this.recipe = recipe;
|
||||
}
|
||||
@@ -52,8 +52,8 @@ public class VillagerAcquireTradeEvent extends EntityEvent implements Cancellabl
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Villager getEntity() {
|
||||
return (Villager) super.getEntity();
|
||||
public AbstractVillager getEntity() {
|
||||
return (AbstractVillager) super.getEntity();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.AbstractVillager;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.MerchantRecipe;
|
||||
@@ -20,7 +20,7 @@ public class VillagerReplenishTradeEvent extends EntityEvent implements Cancella
|
||||
private MerchantRecipe recipe;
|
||||
private int bonus;
|
||||
|
||||
public VillagerReplenishTradeEvent(@NotNull Villager what, @NotNull MerchantRecipe recipe, int bonus) {
|
||||
public VillagerReplenishTradeEvent(@NotNull AbstractVillager what, @NotNull MerchantRecipe recipe, int bonus) {
|
||||
super(what);
|
||||
this.recipe = recipe;
|
||||
this.bonus = bonus;
|
||||
@@ -77,8 +77,8 @@ public class VillagerReplenishTradeEvent extends EntityEvent implements Cancella
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Villager getEntity() {
|
||||
return (Villager) super.getEntity();
|
||||
public AbstractVillager getEntity() {
|
||||
return (AbstractVillager) super.getEntity();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user