Skip to content

Commit 0c705ef

Browse files
committed
Restore backwards compatibility with server pings
I don't know why people are using 1.8.1, but whatever
1 parent b17af68 commit 0c705ef

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,16 +1652,22 @@ public static Class<?> getTileEntityClass() {
16521652
return getMinecraftClass("TileEntity");
16531653
}
16541654

1655+
private static Class<?> gsonClass = null;
1656+
16551657
/**
16561658
* Retrieve the Gson class used by Minecraft.
1657-
* @return The GSON class.
1659+
* @return The Gson class.
16581660
*/
16591661
public static Class<?> getMinecraftGsonClass() {
1660-
try {
1661-
return getClass("com.google.gson.Gson");
1662-
} catch (RuntimeException e) {
1663-
return getClass("org.bukkit.craftbukkit.libs.com.google.gson.Gson");
1662+
if (gsonClass == null) {
1663+
try {
1664+
return gsonClass = getClass("org.bukkit.craftbukkit.libs.com.google.gson.Gson");
1665+
} catch (RuntimeException e) {
1666+
return gsonClass = getClass("com.google.gson.Gson");
1667+
}
16641668
}
1669+
1670+
return gsonClass;
16651671
}
16661672

16671673
/**

0 commit comments

Comments
 (0)