Initialization cleanup: use provider classes for Settings and DataSource

- Separate provider methods from other tasks performed on startup
  - No longer requires BukkitService to be instantiated manually
- Merge MetricsManager and Initializer into OnStartUpTasks
This commit is contained in:
ljacqu
2016-11-06 18:51:07 +01:00
parent f2cafe4f25
commit 72853a382f
11 changed files with 340 additions and 255 deletions
@@ -17,6 +17,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import javax.inject.Inject;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
@@ -40,7 +41,8 @@ public class BukkitService implements SettingsDependent {
private Method getOnlinePlayers;
private boolean useAsyncTasks;
public BukkitService(AuthMe authMe, Settings settings) {
@Inject
BukkitService(AuthMe authMe, Settings settings) {
this.authMe = authMe;
getOnlinePlayersIsCollection = initializeOnlinePlayersIsCollectionField();
reload(settings);