Support SetupOrder still (to be deprecated).

This commit is contained in:
asofold 2017-04-24 20:16:49 +02:00
parent f82d387a88
commit 6ce8e62e7e
2 changed files with 15 additions and 0 deletions

View File

@ -478,6 +478,14 @@ public class RegistrationOrder {
private final String beforeTag; // TODO: Set ?
private final String afterTag; // TODO: Set ?
/**
* LEGACY support, to be deprecated.
* @param bluePrint
*/
public RegistrationOrder(SetupOrder bluePrint) {
this(bluePrint.priority());
}
/**
*
* @param bluePrint

View File

@ -14,6 +14,7 @@ import fr.neatmonster.nocheatplus.components.registry.order.IRegisterWithOrder;
import fr.neatmonster.nocheatplus.components.registry.order.RegisterWithOrder;
import fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder;
import fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder.AbstractRegistrationOrderSort;
import fr.neatmonster.nocheatplus.components.registry.order.SetupOrder;
/**
* Keep sorted lists of registered (generic) items by type (support
@ -198,7 +199,9 @@ public class RegisteredItemStore {
throw new AlreadyRegisteredException("Already registered for type: " + type.getName());
}
// Ensure to have a RegistrationOrder instance, copy external ones.
// (No merging of information is done here.)
// TODO: Try/Catch ?
// TODO: (Perhaps not ListenerOrder...)
// Check the most specific interface.
if (order == null && item instanceof IRegisterWithOrder) {
order = ((IRegisterWithOrder) item).getRegistrationOrder(type);
@ -211,9 +214,13 @@ public class RegisteredItemStore {
if (order == null) {
// Check Annotations.
RegisterWithOrder annoOrder = item.getClass().getAnnotation(RegisterWithOrder.class);
SetupOrder setupOrder = item.getClass().getAnnotation(SetupOrder.class); // To be deprecated.
if (annoOrder != null) {
order = new RegistrationOrder(annoOrder);
}
else if (setupOrder != null) { // To be deprecated.
order = new RegistrationOrder(setupOrder);
}
else {
// Default order.
order = RegistrationOrder.DEFAULT_ORDER;