Use isMinecraftClass to check for NMS classes.

This commit is contained in:
Kristian S. Stangeland 2013-02-03 19:07:12 +01:00
parent eaf7ea9618
commit 3219deed79

View File

@ -128,7 +128,7 @@ class PacketInjector {
throw new IllegalStateException("Packet ID " + packetID + " is not a valid packet ID in this version."); throw new IllegalStateException("Packet ID " + packetID + " is not a valid packet ID in this version.");
} }
// Check for previous injections // Check for previous injections
if (!old.getName().startsWith("net.minecraft.")) { if (!MinecraftReflection.isMinecraftClass(old)) {
throw new IllegalStateException("Packet " + packetID + " has already been injected."); throw new IllegalStateException("Packet " + packetID + " has already been injected.");
} }
@ -202,7 +202,7 @@ class PacketInjector {
} }
// Called from the ReadPacketModified monitor // Called from the ReadPacketModified monitor
PacketEvent packetRecieved(PacketContainer packet, DataInputStream input) { public PacketEvent packetRecieved(PacketContainer packet, DataInputStream input) {
try { try {
Player client = playerInjection.getPlayerByConnection(input); Player client = playerInjection.getPlayerByConnection(input);
@ -226,7 +226,6 @@ class PacketInjector {
* @return The resulting packet event. * @return The resulting packet event.
*/ */
public PacketEvent packetRecieved(PacketContainer packet, Player client) { public PacketEvent packetRecieved(PacketContainer packet, Player client) {
PacketEvent event = PacketEvent.fromClient((Object) manager, packet, client); PacketEvent event = PacketEvent.fromClient((Object) manager, packet, client);
manager.invokePacketRecieving(event); manager.invokePacketRecieving(event);