summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Primm <mike@primmhome.com>2012-08-11 23:14:23 -0500
committerTravis Watkins <amaranth@ubuntu.com>2012-08-19 09:51:04 -0500
commiteaa3154b0e267d4369158eaa9e6d3f6640f6728f (patch)
tree70562ee36781ad6ff50c8e4fbe822d23bf439e17 /src
parent627cf2ef8b6271c46d10a315dc827ecd8bf8e517 (diff)
downloadcraftbukkit-eaa3154b0e267d4369158eaa9e6d3f6640f6728f.tar
craftbukkit-eaa3154b0e267d4369158eaa9e6d3f6640f6728f.tar.gz
craftbukkit-eaa3154b0e267d4369158eaa9e6d3f6640f6728f.tar.lz
craftbukkit-eaa3154b0e267d4369158eaa9e6d3f6640f6728f.tar.xz
craftbukkit-eaa3154b0e267d4369158eaa9e6d3f6640f6728f.zip
[Bleeding] Cache packet ID instead of doing lookups each time it is needed
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/Packet.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index 65ac4095..bd253cff 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -21,8 +21,12 @@ public abstract class Packet {
public static long p;
public static long q;
public boolean lowPriority = false;
-
- public Packet() {}
+ // CraftBukkit start - calculate packet ID once - used a bunch of times
+ 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) {
if (l.b(i)) {
@@ -73,7 +77,7 @@ public abstract class Packet {
}
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