13
0
geforkt von Mirrors/Paper

[Bleeding] Cache packet ID instead of doing lookups each time it is needed

Dieser Commit ist enthalten in:
Mike Primm 2012-08-11 23:14:23 -05:00 committet von Travis Watkins
Ursprung 627cf2ef8b
Commit eaa3154b0e

Datei anzeigen

@ -21,8 +21,12 @@ public abstract class Packet {
public static long p; public static long p;
public static long q; public static long q;
public boolean lowPriority = false; public boolean lowPriority = false;
// CraftBukkit start - calculate packet ID once - used a bunch of times
public Packet() {} private int packetID;
public Packet() {
packetID = ((Integer) a.get(this.getClass())).intValue();
} // CraftBukkit end
static void a(int i, boolean flag, boolean flag1, Class oclass) { static void a(int i, boolean flag, boolean flag1, Class oclass) {
if (l.b(i)) { if (l.b(i)) {
@ -73,7 +77,7 @@ public abstract class Packet {
} }
public final int k() { public final int k() {
return ((Integer) a.get(this.getClass())).intValue(); return packetID; // ((Integer) a.get(this.getClass())).intValue(); // CraftBukkit
} }
public static Packet a(DataInputStream datainputstream, boolean flag) throws IOException { // CraftBukkit - throws IOException public static Packet a(DataInputStream datainputstream, boolean flag) throws IOException { // CraftBukkit - throws IOException