From 3219deed79038ee40aa0ca37daafa3ecbc09a9b8 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sun, 3 Feb 2013 19:07:12 +0100 Subject: [PATCH] Use isMinecraftClass to check for NMS classes. --- .../java/com/comphenix/protocol/injector/PacketInjector.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketInjector.java index 32bac7eb..095350a2 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketInjector.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketInjector.java @@ -128,7 +128,7 @@ class PacketInjector { throw new IllegalStateException("Packet ID " + packetID + " is not a valid packet ID in this version."); } // Check for previous injections - if (!old.getName().startsWith("net.minecraft.")) { + if (!MinecraftReflection.isMinecraftClass(old)) { throw new IllegalStateException("Packet " + packetID + " has already been injected."); } @@ -202,7 +202,7 @@ class PacketInjector { } // Called from the ReadPacketModified monitor - PacketEvent packetRecieved(PacketContainer packet, DataInputStream input) { + public PacketEvent packetRecieved(PacketContainer packet, DataInputStream input) { try { Player client = playerInjection.getPlayerByConnection(input); @@ -226,7 +226,6 @@ class PacketInjector { * @return The resulting packet event. */ public PacketEvent packetRecieved(PacketContainer packet, Player client) { - PacketEvent event = PacketEvent.fromClient((Object) manager, packet, client); manager.invokePacketRecieving(event);