Quests - V2.8.2-03 - Removed ReflectionUtil - By GregZ_

* Incremented dev version in pom.xml.
     * Removed ReflectionUtil, this was pointless and just created extra overhead as the classes using it were already using NMS code.
This commit is contained in:
GregZ_ 2017-06-18 14:54:21 +01:00
parent 0072f6af2a
commit 38842f8ca7
12 changed files with 135 additions and 165 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId> <groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId> <artifactId>quests</artifactId>
<version>2.8.2-02</version> <version>2.8.2-03</version>
<name>quests</name> <name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url> <url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_10_R1.EnumParticle;
import net.minecraft.server.v1_10_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_10_R1.EnumParticle;
import net.minecraft.server.v1_10_R1.PacketPlayOutWorldParticles;
public enum Eff_1_10_R1 { public enum Eff_1_10_R1 {
@ -67,17 +66,17 @@ public enum Eff_1_10_R1 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_11_R1.EnumParticle;
import net.minecraft.server.v1_11_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_11_R1.EnumParticle;
import net.minecraft.server.v1_11_R1.PacketPlayOutWorldParticles;
public enum Eff_1_11_R1 { public enum Eff_1_11_R1 {
@ -69,17 +68,17 @@ public enum Eff_1_11_R1 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_12_R1.EnumParticle;
import net.minecraft.server.v1_12_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_12_R1.EnumParticle;
import net.minecraft.server.v1_12_R1.PacketPlayOutWorldParticles;
public enum Eff_1_12_R1 { public enum Eff_1_12_R1 {
@ -69,17 +68,17 @@ public enum Eff_1_12_R1 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,12 +1,11 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles;
public enum Eff_1_7_R3 { public enum Eff_1_7_R3 {
HUGE_EXPLOSION("hugeexplosion"), HUGE_EXPLOSION("hugeexplosion"),
@ -52,16 +51,15 @@ public enum Eff_1_7_R3 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleName,
ReflectionUtil.setValue(packet, "a", particleName); (float) location.getX(),
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getY(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); offsetX,
ReflectionUtil.setValue(packet, "e", offsetX); offsetY,
ReflectionUtil.setValue(packet, "f", offsetY); offsetZ,
ReflectionUtil.setValue(packet, "g", offsetZ); speed,
ReflectionUtil.setValue(packet, "h", speed); count);
ReflectionUtil.setValue(packet, "i", count);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,12 +1,11 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
public enum Eff_1_7_R4 { public enum Eff_1_7_R4 {
HUGE_EXPLOSION("hugeexplosion"), HUGE_EXPLOSION("hugeexplosion"),
@ -52,16 +51,15 @@ public enum Eff_1_7_R4 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleName,
ReflectionUtil.setValue(packet, "a", particleName); (float) location.getX(),
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getY(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); offsetX,
ReflectionUtil.setValue(packet, "e", offsetX); offsetY,
ReflectionUtil.setValue(packet, "f", offsetY); offsetZ,
ReflectionUtil.setValue(packet, "g", offsetZ); speed,
ReflectionUtil.setValue(packet, "h", speed); count);
ReflectionUtil.setValue(packet, "i", count);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_8_R1.EnumParticle;
import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R1.EnumParticle;
import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles;
public enum Eff_1_8_R1 { public enum Eff_1_8_R1 {
EXPLOSION(EnumParticle.EXPLOSION_NORMAL), EXPLOSION(EnumParticle.EXPLOSION_NORMAL),
@ -60,17 +59,17 @@ public enum Eff_1_8_R1 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_8_R2.EnumParticle;
import net.minecraft.server.v1_8_R2.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R2.EnumParticle;
import net.minecraft.server.v1_8_R2.PacketPlayOutWorldParticles;
public enum Eff_1_8_R2 { public enum Eff_1_8_R2 {
EXPLOSION(EnumParticle.EXPLOSION_NORMAL), EXPLOSION(EnumParticle.EXPLOSION_NORMAL),
@ -60,17 +59,17 @@ public enum Eff_1_8_R2 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_8_R3.EnumParticle;
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R3.EnumParticle;
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
public enum Eff_1_8_R3 { public enum Eff_1_8_R3 {
EXPLOSION(EnumParticle.EXPLOSION_NORMAL), EXPLOSION(EnumParticle.EXPLOSION_NORMAL),
@ -60,17 +59,17 @@ public enum Eff_1_8_R3 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_9_R1.EnumParticle;
import net.minecraft.server.v1_9_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_9_R1.EnumParticle;
import net.minecraft.server.v1_9_R1.PacketPlayOutWorldParticles;
public enum Eff_1_9_R1 { public enum Eff_1_9_R1 {
EXPLOSION(EnumParticle.EXPLOSION_NORMAL), EXPLOSION(EnumParticle.EXPLOSION_NORMAL),
@ -64,17 +63,17 @@ public enum Eff_1_9_R1 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,13 +1,12 @@
package me.blackvein.particles; package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_9_R2.EnumParticle;
import net.minecraft.server.v1_9_R2.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_9_R2.EnumParticle;
import net.minecraft.server.v1_9_R2.PacketPlayOutWorldParticles;
public enum Eff_1_9_R2 { public enum Eff_1_9_R2 {
EXPLOSION(EnumParticle.EXPLOSION_NORMAL), EXPLOSION(EnumParticle.EXPLOSION_NORMAL),
@ -64,17 +63,17 @@ public enum Eff_1_9_R2 {
} }
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleEnum,
ReflectionUtil.setValue(packet, "a", particleEnum); false,
ReflectionUtil.setValue(packet, "b", (float) location.getX()); (float) location.getX(),
ReflectionUtil.setValue(packet, "c", (float) location.getY()); (float) location.getY(),
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); (float) location.getZ(),
ReflectionUtil.setValue(packet, "e", offsetX); offsetX,
ReflectionUtil.setValue(packet, "f", offsetY); offsetY,
ReflectionUtil.setValue(packet, "g", offsetZ); offsetZ,
ReflectionUtil.setValue(packet, "h", speed); speed,
ReflectionUtil.setValue(packet, "i", count); count,
ReflectionUtil.setValue(packet, "k", data); data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
} }

View File

@ -1,18 +0,0 @@
package me.blackvein.quests.util;
import java.lang.reflect.Field;
public class ReflectionUtil {
public static void setValue(Object instance, String fieldName, Object value) throws Exception {
Field field = instance.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(instance, value);
}
public static Object getValue(Object instance, String fieldName) throws Exception {
Field field = instance.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(instance);
}
}