org.spongepowered.api.config.ConfigDir Java Examples

The following examples show how to use org.spongepowered.api.config.ConfigDir. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Metrics.java    From EagleFactions with MIT License 6 votes vote down vote up
@Inject
private Metrics(PluginContainer plugin, Logger logger, @ConfigDir(sharedRoot = true) Path configDir)
{
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;

    try
    {
        loadConfig();
    }
    catch (IOException e)
    {
        // Failed to load configuration
        logger.warn("Failed to load bStats config!", e);
        return;
    }

    // We are not allowed to send data about this server :(
    if (!enabled)
    {
        return;
    }

    startSubmitting();
}
 
Example #2
Source File: Metrics2.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Inject
private Metrics2(PluginContainer plugin, Logger logger, @ConfigDir(sharedRoot = true) Path configDir) {
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;

    Sponge.getEventManager().registerListeners(plugin, this);
}
 
Example #3
Source File: Settings.java    From FlexibleLogin with MIT License 5 votes vote down vote up
@Inject
//We will place more than one config there (i.e. H2/SQLite database)
Settings(Logger logger, @ConfigDir(sharedRoot = false) Path dataFolder) {
    this.logger = logger;
    this.dataFolder = dataFolder;

    try {
        configMapper = options.getObjectMapperFactory().getMapper(General.class).bindToNew();
        textMapper = options.getObjectMapperFactory().getMapper(TextConfig.class).bindToNew();
    } catch (ObjectMappingException objMappingExc) {
        logger.error("Invalid plugin structure", objMappingExc);
    }
}
 
Example #4
Source File: SpongeSparkPlugin.java    From spark with GNU General Public License v3.0 4 votes vote down vote up
@Inject
public SpongeSparkPlugin(Game game, @ConfigDir(sharedRoot = false) Path configDirectory, @AsynchronousExecutor SpongeExecutorService asyncExecutor) {
    this.game = game;
    this.configDirectory = configDirectory;
    this.asyncExecutor = asyncExecutor;
}
 
Example #5
Source File: Metrics2.java    From bStats-Metrics with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject
private Factory(PluginContainer plugin, Logger logger, @ConfigDir(sharedRoot = true) Path configDir) {
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;
}
 
Example #6
Source File: MetricsLite2.java    From bStats-Metrics with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject
private Factory(PluginContainer plugin, Logger logger, @ConfigDir(sharedRoot = true) Path configDir) {
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;
}
 
Example #7
Source File: ChangeSkinSponge.java    From ChangeSkin with MIT License 4 votes vote down vote up
@Inject
ChangeSkinSponge(Logger logger, @ConfigDir(sharedRoot = false) Path dataFolder, Injector injector) {
    this.dataFolder = dataFolder;
    this.logger = logger;
    this.injector = injector.createChildInjector(binder -> binder.bind(ChangeSkinCore.class).toInstance(core));
}