private static boolean isDefaultProperPhase(RegistryModule module) { try { Method method = module.getClass().getMethod("registerDefaults"); DelayedRegistration delay = method.getDeclaredAnnotation(DelayedRegistration.class); if (delay == null) { return SpongeImpl.getRegistry().getPhase() == RegistrationPhase.PRE_REGISTRY; } else { return SpongeImpl.getRegistry().getPhase() == delay.value(); } } catch (NoSuchMethodException e) { e.printStackTrace(); } return false; }
private static boolean isCustomProperPhase(RegistryModule module) { for (Method method : module.getClass().getMethods()) { CustomCatalogRegistration registration = method.getDeclaredAnnotation(CustomCatalogRegistration.class); DelayedRegistration delay = method.getDeclaredAnnotation(DelayedRegistration.class); if (registration != null) { if (delay == null) { return SpongeImpl.getRegistry().getPhase() == RegistrationPhase.PRE_REGISTRY; } else { return SpongeImpl.getRegistry().getPhase() == delay.value(); } } } return false; }