Extract method call booleans from PluginInfo

This commit is contained in:
Rsl1122 2019-03-24 15:59:54 +02:00
parent f73cef8587
commit 91bb5bf31b
2 changed files with 23 additions and 0 deletions

View File

@ -114,6 +114,10 @@ public class DataProviderExtractor {
private void extractAllDataProviders() {
PluginInfo pluginInfo = extensionExtractor.getPluginInfo();
dataProviders.setCallPlayerMethodsOnPlayerLeave(pluginInfo.updatePlayerDataOnLeave());
dataProviders.setCallServerMethodsPeriodically(pluginInfo.updateServerDataPeriodically());
MethodAnnotations methodAnnotations = extensionExtractor.getMethodAnnotations();
Map<Method, Tab> tabs = methodAnnotations.getMethodAnnotations(Tab.class);
Map<Method, Conditional> conditions = methodAnnotations.getMethodAnnotations(Conditional.class);

View File

@ -29,10 +29,29 @@ public class DataProviders {
private Map<MethodType, Map<Class, List<DataProvider>>> byMethodType;
private boolean callPlayerMethodsOnPlayerLeave;
private boolean callServerMethodsPeriodically;
public DataProviders() {
byMethodType = new EnumMap<>(MethodType.class);
}
public void setCallPlayerMethodsOnPlayerLeave(boolean callPlayerMethodsOnPlayerLeave) {
this.callPlayerMethodsOnPlayerLeave = callPlayerMethodsOnPlayerLeave;
}
public void setCallServerMethodsPeriodically(boolean callServerMethodsPeriodically) {
this.callServerMethodsPeriodically = callServerMethodsPeriodically;
}
public boolean shouldCallPlayerMethodsOnPlayerLeave() {
return callPlayerMethodsOnPlayerLeave;
}
public boolean shouldCallServerMethodsPeriodically() {
return callServerMethodsPeriodically;
}
public <T> void put(DataProvider<T> provider) {
MethodWrapper<T> method = provider.getMethod();