diff options
author | md_5 <git@md-5.net> | 2018-07-15 16:17:35 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-15 16:17:35 +1000 |
commit | fe7db9d53b7ccaf5be93a64ec1a89b2e3af6a0f7 (patch) | |
tree | e9e60eb7c63c43ed22cb180d0c9537a5f2cb6845 /src/main/java | |
parent | 72cf620d474ca21b5369b61136e286101f2f635a (diff) | |
download | craftbukkit-fe7db9d53b7ccaf5be93a64ec1a89b2e3af6a0f7.tar craftbukkit-fe7db9d53b7ccaf5be93a64ec1a89b2e3af6a0f7.tar.gz craftbukkit-fe7db9d53b7ccaf5be93a64ec1a89b2e3af6a0f7.tar.lz craftbukkit-fe7db9d53b7ccaf5be93a64ec1a89b2e3af6a0f7.tar.xz craftbukkit-fe7db9d53b7ccaf5be93a64ec1a89b2e3af6a0f7.zip |
Add EntityToggleSwimEvent and isSwimming / setSwimming API
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 10 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0b12ed81..382b8028 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -470,6 +470,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } @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); } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 527af08c..951a0683 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -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); |