use of io.github.wysohn.triggerreactor.bukkit.manager.trigger.NamedTriggerManager in project TriggerReactor by wysohn.
the class JavaPluginBridge method onEnable.
public void onEnable(io.github.wysohn.triggerreactor.bukkit.main.TriggerReactor plugin) {
Thread.currentThread().setContextClassLoader(plugin.getClass().getClassLoader());
this.bukkitPlugin = plugin;
for (Entry<String, Class<? extends AbstractAPISupport>> entry : APISupport.getSharedVars().entrySet()) {
AbstractAPISupport.addSharedVar(sharedVars, entry.getKey(), entry.getValue());
}
try {
executorManager = new ExecutorManager(this);
} catch (ScriptException | IOException e) {
initFailed(e);
return;
}
try {
placeholderManager = new PlaceholderManager(this);
} catch (ScriptException | IOException e) {
initFailed(e);
return;
}
try {
variableManager = new VariableManager(this);
} catch (IOException | InvalidConfigurationException e) {
initFailed(e);
return;
}
scriptEditManager = new ScriptEditManager(this);
locationManager = new PlayerLocationManager(this);
permissionManager = new PermissionManager(this);
selectionManager = new AreaSelectionManager(this);
clickManager = new ClickTriggerManager(this);
walkManager = new WalkTriggerManager(this);
cmdManager = new CommandTriggerManager(this);
invManager = new InventoryTriggerManager(this);
areaManager = new AreaTriggerManager(this);
customManager = new CustomTriggerManager(this);
repeatManager = new RepeatingTriggerManager(this);
namedTriggerManager = new NamedTriggerManager(this);
for (Manager manager : Manager.getManagers()) {
manager.reload();
}
bungeeHelper = new BungeeCordHelper();
bungeeConnectionThread = new Thread(bungeeHelper);
bungeeConnectionThread.setPriority(Thread.MIN_PRIORITY);
bungeeConnectionThread.start();
tpsHelper = new Lag();
Bukkit.getScheduler().scheduleSyncRepeatingTask(bukkitPlugin, tpsHelper, 100L, 1L);
FileConfiguration config = plugin.getConfig();
if (config.getBoolean("Mysql.Enable", false)) {
try {
plugin.getLogger().info("Initializing Mysql support...");
mysqlHelper = new MysqlSupport(config.getString("Mysql.Address"), config.getString("Mysql.DbName"), "data", config.getString("Mysql.UserName"), config.getString("Mysql.Password"));
plugin.getLogger().info(mysqlHelper.toString());
plugin.getLogger().info("Done!");
} catch (SQLException e) {
e.printStackTrace();
plugin.getLogger().warning("Failed to initialize Mysql. Check for the error above.");
}
} else {
String path = "Mysql.Enable";
if (!config.isSet(path))
config.set(path, false);
path = "Mysql.Address";
if (!config.isSet(path))
config.set(path, "127.0.0.1:3306");
path = "Mysql.DbName";
if (!config.isSet(path))
config.set(path, "TriggerReactor");
path = "Mysql.UserName";
if (!config.isSet(path))
config.set(path, "root");
path = "Mysql.Password";
if (!config.isSet(path))
config.set(path, "1234");
plugin.saveConfig();
}
}
Aggregations