From 20fc5bea2c51de8d5239b68d83e878896b8ff505 Mon Sep 17 00:00:00 2001 From: nathat890 Date: Wed, 5 Dec 2018 09:51:20 +1100 Subject: Add list of entities to EntityTransformEvent & move die calls --- .../org/bukkit/craftbukkit/event/CraftEventFactory.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index aca32147..26e14f0d 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.event; import java.net.InetAddress; import java.util.ArrayList; +import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Map; @@ -303,8 +304,20 @@ public class CraftEventFactory { /** * EntityTransformEvent */ - public static EntityTransformEvent callEntityTransformEvent(EntityLiving original, EntityLiving converted, EntityTransformEvent.TransformReason convertType) { - EntityTransformEvent event = new EntityTransformEvent(original.getBukkitEntity(), converted.getBukkitEntity(), convertType); + public static EntityTransformEvent callEntityTransformEvent(EntityLiving original, EntityLiving coverted, EntityTransformEvent.TransformReason transformReason) { + return callEntityTransformEvent(original, Collections.singletonList(coverted), transformReason); + } + + /** + * EntityTransformEvent + */ + public static EntityTransformEvent callEntityTransformEvent(EntityLiving original, List convertedList, EntityTransformEvent.TransformReason convertType) { + List list = new ArrayList<>(); + for (EntityLiving entityLiving : convertedList) { + list.add(entityLiving.getBukkitEntity()); + } + + EntityTransformEvent event = new EntityTransformEvent(original.getBukkitEntity(), list, convertType); Bukkit.getPluginManager().callEvent(event); return event; -- cgit v1.2.3