From ea5d7f3d3a47a9a85a70410fed066ae10b33869a Mon Sep 17 00:00:00 2001 From: MistPhizzle Date: Sun, 24 Aug 2014 11:12:02 -0400 Subject: [PATCH] Remove FireworkEffectPlayer We didn't need that. --- .../projectkorra/ProjectKorra/Methods.java | 9 +-- .../Utilities/FireworkEffectPlayer.java | 67 ------------------- 2 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 src/com/projectkorra/ProjectKorra/Utilities/FireworkEffectPlayer.java diff --git a/src/com/projectkorra/ProjectKorra/Methods.java b/src/com/projectkorra/ProjectKorra/Methods.java index deb75cc5..488abc87 100644 --- a/src/com/projectkorra/ProjectKorra/Methods.java +++ b/src/com/projectkorra/ProjectKorra/Methods.java @@ -72,7 +72,6 @@ import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig; import com.projectkorra.ProjectKorra.Ability.AbilityModule; import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager; import com.projectkorra.ProjectKorra.Ability.AvatarState; -import com.projectkorra.ProjectKorra.Utilities.FireworkEffectPlayer; import com.projectkorra.ProjectKorra.Utilities.ParticleEffect; import com.projectkorra.ProjectKorra.airbending.AirBlast; import com.projectkorra.ProjectKorra.airbending.AirBubble; @@ -1908,12 +1907,6 @@ public class Methods { BreathSphere.remove(player); } } - } - - public static FireworkEffectPlayer fireworkeffectplayer = new FireworkEffectPlayer(); - - public static FireworkEffect customFireworkEffect(Type type, Color color) { - return FireworkEffect.builder().with(type).withColor(color).build(); - } + } } diff --git a/src/com/projectkorra/ProjectKorra/Utilities/FireworkEffectPlayer.java b/src/com/projectkorra/ProjectKorra/Utilities/FireworkEffectPlayer.java deleted file mode 100644 index eaffe1d8..00000000 --- a/src/com/projectkorra/ProjectKorra/Utilities/FireworkEffectPlayer.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.projectkorra.ProjectKorra.Utilities; - -import java.lang.reflect.Method; - -import org.bukkit.FireworkEffect; -import org.bukkit.entity.Firework; -import org.bukkit.inventory.meta.FireworkMeta; -import org.bukkit.Location; -import org.bukkit.World; - -/** - * FireworkEffectPlayer v1.0 - * - * FireworkEffectPlayer provides a thread-safe and (reasonably) version independant way to instantly explode a FireworkEffect at a given location. - * You are welcome to use, redistribute, modify and destroy your own copies of this source with the following conditions: - * - * 1. No warranty is given or implied. - * 2. All damage is your own responsibility. - * 3. You provide credit publicly to the original source should you release the plugin. - * - * @author codename_B - */ -public class FireworkEffectPlayer { - - private Method world_getHandle = null; - private Method nms_world_broadcastEntityEffect = null; - private Method firework_getHandle = null; - - public void playFirework(World world, Location loc, FireworkEffect fe) throws Exception { - Firework fw = (Firework) world.spawn(loc, Firework.class); - Object nms_world = null; - Object nms_firework = null; - if(world_getHandle == null) { - world_getHandle = getMethod(world.getClass(), "getHandle"); - firework_getHandle = getMethod(fw.getClass(), "getHandle"); - } - nms_world = world_getHandle.invoke(world, (Object[]) null); - nms_firework = firework_getHandle.invoke(fw, (Object[]) null); - if(nms_world_broadcastEntityEffect == null) { - nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect"); - } - - FireworkMeta data = (FireworkMeta) fw.getFireworkMeta(); - - data.clearEffects(); - - data.setPower(1); - - data.addEffect(fe); - - fw.setFireworkMeta(data); - - nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17}); - - fw.remove(); - } - - private static Method getMethod(Class cl, String method) { - for(Method m : cl.getMethods()) { - if(m.getName().equals(method)) { - return m; - } - } - return null; - } - -} \ No newline at end of file