Skip to content

Commit 54acb04

Browse files
committed
that's a very big woopsie
1 parent 158d564 commit 54acb04

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bukkit/src/main/java/revxrsal/commands/bukkit/util/PluginCommands.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ public final class PluginCommands {
6161
Constructor<PluginCommand> ctr;
6262
Field knownCommands = null;
6363
CommandMap commandMap;
64-
MethodHandle getPluginMeta;
64+
MethodHandle getPluginMeta = null;
65+
try {
66+
getPluginMeta = MethodHandles.lookup().unreflect(
67+
JavaPlugin.class.getDeclaredMethod("getPluginMeta")
68+
);
69+
} catch (Exception ignored) {
70+
}
6571
try {
6672
ctr = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
6773
ctr.setAccessible(true);
@@ -72,9 +78,6 @@ public final class PluginCommands {
7278
knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands");
7379
knownCommands.setAccessible(true);
7480
}
75-
getPluginMeta = MethodHandles.lookup().unreflect(
76-
JavaPlugin.class.getDeclaredMethod("getPluginMeta")
77-
);
7881
} catch (NoSuchMethodException e) {
7982
e.printStackTrace();
8083
throw new IllegalStateException("Unable to access PluginCommand(String, Plugin) construtor!");

0 commit comments

Comments
 (0)