File tree Expand file tree Collapse file tree
main/java/com/bencodez/advancedcore/api/player
test/java/com/bencodez/advancedcore/tests/user Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919public class UuidLookup {
2020
21- private static final UuidLookup instance = new UuidLookup ();
21+ private static final UuidLookup instance = new UuidLookup (AdvancedCorePlugin . getInstance () );
2222
2323 public static UuidLookup getInstance () {
2424 return instance ;
2525 }
2626
27- private final AdvancedCorePlugin plugin = AdvancedCorePlugin . getInstance () ;
27+ private final AdvancedCorePlugin plugin ;
2828
2929 // Fast local caches
3030 private final ConcurrentHashMap <String , String > uuidToName = new ConcurrentHashMap <>();
3131 private final ConcurrentHashMap <String , String > nameToUuid = new ConcurrentHashMap <>();
3232
33- private UuidLookup () {
33+ private UuidLookup (AdvancedCorePlugin plugin ) {
34+ this .plugin = plugin ;
3435 // Cache is owned here.
3536 }
3637
Original file line number Diff line number Diff line change @@ -61,11 +61,10 @@ void primaryThreadIdentityLookupUsesOnlyKnownOnlineOfflineOrCachedIdentity() thr
6161 AdvancedCoreConfigOptions options = mock (AdvancedCoreConfigOptions .class );
6262 when (plugin .getOptions ()).thenReturn (options );
6363 when (options .isOnlineMode ()).thenReturn (true );
64- try (var plugins = mockStatic (AdvancedCorePlugin .class ); var bukkit = mockStatic (Bukkit .class )) {
65- plugins .when (AdvancedCorePlugin ::getInstance ).thenReturn (plugin );
66- Constructor <UuidLookup > constructor = UuidLookup .class .getDeclaredConstructor ();
64+ try (var bukkit = mockStatic (Bukkit .class )) {
65+ Constructor <UuidLookup > constructor = UuidLookup .class .getDeclaredConstructor (AdvancedCorePlugin .class );
6766 constructor .setAccessible (true );
68- UuidLookup lookup = constructor .newInstance ();
67+ UuidLookup lookup = constructor .newInstance (plugin );
6968 String unknown = "Unknown" + UUID .randomUUID ().toString ().replace ("-" , "" );
7069
7170 assertEquals ("" , lookup .getUUIDWithoutStorage (unknown ));
You can’t perform that action at this time.
0 commit comments