Skip to content

Commit 7fd2043

Browse files
committed
Fix compatibility with older bungees
1 parent be49f87 commit 7fd2043

File tree

1 file changed

+11
-5
lines changed
  • core/core-platform-bungee/src/main/java/net/lax1dude/eaglercraft/backend/server/bungee

1 file changed

+11
-5
lines changed

core/core-platform-bungee/src/main/java/net/lax1dude/eaglercraft/backend/server/bungee/BungeeUnsafe.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,22 @@ public class BungeeUnsafe {
9999
class_PluginMessage = Class.forName("net.md_5.bungee.protocol.packet.PluginMessage");
100100
method_PluginMessage_getData = class_PluginMessage.getMethod("getData");
101101
class_LoginResult = Class.forName("net.md_5.bungee.connection.LoginResult");
102-
class_Property = Class.forName("net.md_5.bungee.protocol.data.Property");
103-
Class<?> propArrayClass = Array.newInstance(class_Property, 0).getClass();
102+
Class<?> prop;
103+
try {
104+
prop = Class.forName("net.md_5.bungee.protocol.data.Property");
105+
} catch (Exception ex) {
106+
prop = Class.forName("net.md_5.bungee.protocol.Property");
107+
}
108+
class_Property = prop;
109+
Class<?> propArrayClass = Array.newInstance(prop, 0).getClass();
104110
constructor_LoginResult = class_LoginResult.getConstructor(String.class, String.class, propArrayClass);
105111
method_LoginResult_getProperties = class_LoginResult.getMethod("getProperties");
106112
method_LoginResult_setProperties = class_LoginResult.getMethod("setProperties", propArrayClass);
107-
constructor_Property = class_Property.getConstructor(String.class, String.class, String.class);
113+
constructor_Property = prop.getConstructor(String.class, String.class, String.class);
108114
isEaglerPlayerPropertyT = constructor_Property.newInstance("isEaglerPlayer", "true", null);
109115
isEaglerPlayerPropertyF = constructor_Property.newInstance("isEaglerPlayer", "false", null);
110-
method_Property_getName = class_Property.getMethod("getName");
111-
method_Property_getValue = class_Property.getMethod("getValue");
116+
method_Property_getName = prop.getMethod("getName");
117+
method_Property_getValue = prop.getMethod("getValue");
112118
class_BungeeCord = Class.forName("net.md_5.bungee.BungeeCord");
113119
field_BungeeCord_listeners = class_BungeeCord.getDeclaredField("listeners");
114120
field_BungeeCord_listeners.setAccessible(true);

0 commit comments

Comments
 (0)