Add EntityToggleSwimEvent and isSwimming / setSwimming API
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -469,6 +469,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
getHandle().setFlag(7, gliding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSwimming() {
|
||||
return getHandle().bb();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSwimming(boolean swimming) {
|
||||
getHandle().g(swimming);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttributeInstance getAttribute(Attribute attribute) {
|
||||
return getHandle().craftAttributes.getAttribute(attribute);
|
||||
|
||||
@@ -1015,6 +1015,12 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
public static EntityToggleSwimEvent callToggleSwimEvent(EntityLiving entity, boolean swimming) {
|
||||
EntityToggleSwimEvent event = new EntityToggleSwimEvent((LivingEntity) entity.getBukkitEntity(), swimming);
|
||||
entity.world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public static AreaEffectCloudApplyEvent callAreaEffectCloudApplyEvent(EntityAreaEffectCloud cloud, List<LivingEntity> entities) {
|
||||
AreaEffectCloudApplyEvent event = new AreaEffectCloudApplyEvent((AreaEffectCloud) cloud.getBukkitEntity(), entities);
|
||||
cloud.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user