Added init annotation and method for boon's.

This commit is contained in:
Willem 2022-02-04 21:59:42 +01:00
parent 08de7c0f4f
commit 5a0b3978d1
18 changed files with 61 additions and 26 deletions

View file

@ -1,5 +1,6 @@
package love.distributedrebirth.bassboonyd;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@ -18,6 +19,18 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
PUT_OBJ(key, new HashMap<>());
}
default void INIT_BOON(Object boon) {
try {
for (Method m:boon.getClass().getMethods()) {
if (m.isAnnotationPresent(BãßBȍőnInitMethodʸᴰ.class)) {
m.invoke(boon, this);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() {
return new BãßBȍőnCoffinOpenʸᴰ<Y>() {
final Map<Y,Object> initMap = new HashMap<>();

View file

@ -0,0 +1,13 @@
package love.distributedrebirth.bassboonyd;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface BãßBȍőnInitMethodʸᴰ {
}