File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed
src/main/java/meteordevelopment/meteorclient/pathing Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change 8
8
import meteordevelopment .meteorclient .MeteorClient ;
9
9
import meteordevelopment .meteorclient .utils .PreInit ;
10
10
11
+ import java .lang .reflect .InvocationTargetException ;
12
+
11
13
public class PathManagers {
12
14
private static IPathManager INSTANCE = new NopPathManager ();
13
15
@@ -17,13 +19,31 @@ public static IPathManager get() {
17
19
18
20
@ PreInit
19
21
public static void init () {
20
- try {
21
- Class .forName ("baritone.api.BaritoneAPI" );
22
+ if (exists ("meteordevelopment.voyager.PathManager" )) {
23
+ try {
24
+ INSTANCE = (IPathManager ) Class .forName ("meteordevelopment.voyager.PathManager" ).getConstructor ().newInstance ();
25
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException |
26
+ NoSuchMethodException | ClassNotFoundException e ) {
27
+ throw new RuntimeException (e );
28
+ }
29
+ }
22
30
31
+ if (exists ("baritone.api.BaritoneAPI" )) {
23
32
BaritoneUtils .IS_AVAILABLE = true ;
24
- INSTANCE = new BaritonePathManager ();
25
33
26
- MeteorClient .LOG .info ("Found Baritone, using a Baritone path manager" );
27
- } catch (ClassNotFoundException ignored ) {}
34
+ if (INSTANCE instanceof NopPathManager )
35
+ INSTANCE = new BaritonePathManager ();
36
+ }
37
+
38
+ MeteorClient .LOG .info ("Path Manager: {}" , INSTANCE .getName ());
39
+ }
40
+
41
+ private static boolean exists (String name ) {
42
+ try {
43
+ Class .forName (name );
44
+ return true ;
45
+ } catch (ClassNotFoundException e ) {
46
+ return false ;
47
+ }
28
48
}
29
49
}
You can’t perform that action at this time.
0 commit comments