Search in sources :

Example 1 with PlaceholderManager

use of io.github.wysohn.triggerreactor.bukkit.manager.PlaceholderManager 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();
    }
}
Also used : VariableManager(io.github.wysohn.triggerreactor.bukkit.manager.VariableManager) AbstractVariableManager(io.github.wysohn.triggerreactor.core.manager.AbstractVariableManager) AbstractExecutorManager(io.github.wysohn.triggerreactor.core.manager.AbstractExecutorManager) ExecutorManager(io.github.wysohn.triggerreactor.bukkit.manager.ExecutorManager) SQLException(java.sql.SQLException) RepeatingTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.RepeatingTriggerManager) AbstractPlayerLocationManager(io.github.wysohn.triggerreactor.core.manager.AbstractPlayerLocationManager) AreaSelectionManager(io.github.wysohn.triggerreactor.bukkit.manager.AreaSelectionManager) ClickTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.ClickTriggerManager) AbstractLocationBasedTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractLocationBasedTriggerManager) AbstractAreaTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractAreaTriggerManager) AbstractExecutorManager(io.github.wysohn.triggerreactor.core.manager.AbstractExecutorManager) AbstractNamedTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractNamedTriggerManager) InventoryTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.InventoryTriggerManager) PermissionManager(io.github.wysohn.triggerreactor.bukkit.manager.PermissionManager) AbstractPermissionManager(io.github.wysohn.triggerreactor.core.manager.AbstractPermissionManager) ExecutorManager(io.github.wysohn.triggerreactor.bukkit.manager.ExecutorManager) AbstractRepeatingTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractRepeatingTriggerManager) VariableManager(io.github.wysohn.triggerreactor.bukkit.manager.VariableManager) AbstractCommandTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractCommandTriggerManager) AbstractPlaceholderManager(io.github.wysohn.triggerreactor.core.manager.AbstractPlaceholderManager) PlayerLocationManager(io.github.wysohn.triggerreactor.bukkit.manager.PlayerLocationManager) MiniConnectionPoolManager(io.github.wysohn.triggerreactor.tools.mysql.MiniConnectionPoolManager) AbstractAreaSelectionManager(io.github.wysohn.triggerreactor.core.manager.AbstractAreaSelectionManager) PlaceholderManager(io.github.wysohn.triggerreactor.bukkit.manager.PlaceholderManager) AreaTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.AreaTriggerManager) CustomTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.CustomTriggerManager) WalkTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.WalkTriggerManager) AbstractScriptEditManager(io.github.wysohn.triggerreactor.core.manager.AbstractScriptEditManager) ScriptEditManager(io.github.wysohn.triggerreactor.bukkit.manager.ScriptEditManager) Manager(io.github.wysohn.triggerreactor.core.manager.Manager) AbstractCustomTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractCustomTriggerManager) CommandTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.CommandTriggerManager) AbstractVariableManager(io.github.wysohn.triggerreactor.core.manager.AbstractVariableManager) AbstractInventoryTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractInventoryTriggerManager) NamedTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.NamedTriggerManager) AbstractPlaceholderManager(io.github.wysohn.triggerreactor.core.manager.AbstractPlaceholderManager) PlaceholderManager(io.github.wysohn.triggerreactor.bukkit.manager.PlaceholderManager) InvalidConfigurationException(org.bukkit.configuration.InvalidConfigurationException) AbstractCommandTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractCommandTriggerManager) CommandTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.CommandTriggerManager) AbstractAreaTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractAreaTriggerManager) AreaTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.AreaTriggerManager) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) ScriptException(javax.script.ScriptException) AbstractNamedTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractNamedTriggerManager) NamedTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.NamedTriggerManager) InventoryTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.InventoryTriggerManager) AbstractInventoryTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractInventoryTriggerManager) AbstractAPISupport(io.github.wysohn.triggerreactor.core.manager.trigger.share.api.AbstractAPISupport) ClickTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.ClickTriggerManager) WalkTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.WalkTriggerManager) PermissionManager(io.github.wysohn.triggerreactor.bukkit.manager.PermissionManager) AbstractPermissionManager(io.github.wysohn.triggerreactor.core.manager.AbstractPermissionManager) IOException(java.io.IOException) AreaSelectionManager(io.github.wysohn.triggerreactor.bukkit.manager.AreaSelectionManager) AbstractAreaSelectionManager(io.github.wysohn.triggerreactor.core.manager.AbstractAreaSelectionManager) AbstractScriptEditManager(io.github.wysohn.triggerreactor.core.manager.AbstractScriptEditManager) ScriptEditManager(io.github.wysohn.triggerreactor.bukkit.manager.ScriptEditManager) RepeatingTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.RepeatingTriggerManager) AbstractRepeatingTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractRepeatingTriggerManager) CustomTriggerManager(io.github.wysohn.triggerreactor.bukkit.manager.trigger.CustomTriggerManager) AbstractCustomTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.AbstractCustomTriggerManager) AbstractPlayerLocationManager(io.github.wysohn.triggerreactor.core.manager.AbstractPlayerLocationManager) PlayerLocationManager(io.github.wysohn.triggerreactor.bukkit.manager.PlayerLocationManager)

Aggregations

AreaSelectionManager (io.github.wysohn.triggerreactor.bukkit.manager.AreaSelectionManager)1 ExecutorManager (io.github.wysohn.triggerreactor.bukkit.manager.ExecutorManager)1 PermissionManager (io.github.wysohn.triggerreactor.bukkit.manager.PermissionManager)1 PlaceholderManager (io.github.wysohn.triggerreactor.bukkit.manager.PlaceholderManager)1 PlayerLocationManager (io.github.wysohn.triggerreactor.bukkit.manager.PlayerLocationManager)1 ScriptEditManager (io.github.wysohn.triggerreactor.bukkit.manager.ScriptEditManager)1 VariableManager (io.github.wysohn.triggerreactor.bukkit.manager.VariableManager)1 AreaTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.AreaTriggerManager)1 ClickTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.ClickTriggerManager)1 CommandTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.CommandTriggerManager)1 CustomTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.CustomTriggerManager)1 InventoryTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.InventoryTriggerManager)1 NamedTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.NamedTriggerManager)1 RepeatingTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.RepeatingTriggerManager)1 WalkTriggerManager (io.github.wysohn.triggerreactor.bukkit.manager.trigger.WalkTriggerManager)1 AbstractAreaSelectionManager (io.github.wysohn.triggerreactor.core.manager.AbstractAreaSelectionManager)1 AbstractExecutorManager (io.github.wysohn.triggerreactor.core.manager.AbstractExecutorManager)1 AbstractPermissionManager (io.github.wysohn.triggerreactor.core.manager.AbstractPermissionManager)1 AbstractPlaceholderManager (io.github.wysohn.triggerreactor.core.manager.AbstractPlaceholderManager)1 AbstractPlayerLocationManager (io.github.wysohn.triggerreactor.core.manager.AbstractPlayerLocationManager)1