当前位置: 首页>>代码示例>>Java>>正文


Java Configurator类代码示例

本文整理汇总了Java中com.publicuhc.pluginframework.configuration.Configurator的典型用法代码示例。如果您正苦于以下问题:Java Configurator类的具体用法?Java Configurator怎么用?Java Configurator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Configurator类属于com.publicuhc.pluginframework.configuration包,在下文中一共展示了Configurator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setConfigurator

import com.publicuhc.pluginframework.configuration.Configurator; //导入依赖的package包/类
@Inject(optional = true)
protected void setConfigurator(Configurator configurator)
{
    Optional<FileConfiguration> configurationOptional = configurator.getConfig("locales");

    if(configurationOptional.isPresent()) {
        FileConfiguration config = configurationOptional.get();
        commandBlockLocale = LocaleUtils.toLocale(config.getString("commandBlock", "en_US"));
        remoteConsoleLocale = LocaleUtils.toLocale(config.getString("remoteConsole", "en_US"));
        consoleLocale = LocaleUtils.toLocale(config.getString("console", "en_US"));
    }
}
 
开发者ID:Eluinhost,项目名称:pluginframework,代码行数:13,代码来源:BukkitLocaleProvider.java

示例2: DefaultFeatureManager

import com.publicuhc.pluginframework.configuration.Configurator; //导入依赖的package包/类
/**
 * Create a new feature manager
 *
 * @param configManager the config manager
 * @param plugin        the plugin
 */
@Inject
public DefaultFeatureManager(Configurator configManager, Plugin plugin, PluginLogger logger)
{
    this.plugin = plugin;
    this.logger = logger;
    Optional<FileConfiguration> mainConfig = configManager.getConfig("main");
    if(!mainConfig.isPresent()) {
        throw new IllegalStateException("Config file 'main' was not found, cannot find configuration values");
    }
    config = mainConfig.get();
}
 
开发者ID:Eluinhost,项目名称:ultrahardcore,代码行数:18,代码来源:DefaultFeatureManager.java

示例3: PlayerListFeature

import com.publicuhc.pluginframework.configuration.Configurator; //导入依赖的package包/类
/**
 * Handles the player list health better than base mc, normal behaviour when disabled
 *
 * @param plugin        the plugin
 * @param configManager the config manager
 */
@Inject
private PlayerListFeature(Plugin plugin, Configurator configManager)
{
    Optional<FileConfiguration> mainConfig = configManager.getConfig("main");
    if(!mainConfig.isPresent()) {
        throw new IllegalStateException("Config file 'main' was not found, cannot find configuration values");
    }
    config = mainConfig.get();
    this.plugin = plugin;
}
 
开发者ID:Eluinhost,项目名称:ultrahardcore,代码行数:17,代码来源:PlayerListFeature.java

示例4: PortalsFeature

import com.publicuhc.pluginframework.configuration.Configurator; //导入依赖的package包/类
/**
 * Changes the radius portals will connect, normal when disabled
 *
 * @param plugin        the plugin
 * @param configManager the config manager
 * @param translate     the translator
 */
@Inject
private PortalsFeature(Plugin plugin, Configurator configManager, Translate translate)
{
    Optional<FileConfiguration> mainConfig = configManager.getConfig("main");
    if(!mainConfig.isPresent()) {
        throw new IllegalStateException("Config file 'main' was not found, cannot find configuration values");
    }
    config = mainConfig.get();
}
 
开发者ID:Eluinhost,项目名称:ultrahardcore,代码行数:17,代码来源:PortalsFeature.java

示例5: GhastDropsFeature

import com.publicuhc.pluginframework.configuration.Configurator; //导入依赖的package包/类
/**
 * Stops ghasts dropping tears to get rid of regen potions
 *
 * @param configManager the config manager
 */
@Inject
private GhastDropsFeature(Configurator configManager)
{
    Optional<FileConfiguration> mainConfig = configManager.getConfig("main");
    if(!mainConfig.isPresent()) {
        throw new IllegalStateException("Config file 'main' was not found, cannot find configuration values");
    }
    config = mainConfig.get();
}
 
开发者ID:Eluinhost,项目名称:ultrahardcore,代码行数:15,代码来源:GhastDropsFeature.java

示例6: ExampleCommand

import com.publicuhc.pluginframework.configuration.Configurator; //导入依赖的package包/类
@Inject
protected ExampleCommand(Translate translate, Configurator configurator, ExampleService service) {
    this.translator = translate;
    this.configurator = configurator;
    this.service = service;
}
 
开发者ID:Eluinhost,项目名称:pluginframework-quickstart,代码行数:7,代码来源:ExampleCommand.java

示例7: PlayerFreezeFeature

import com.publicuhc.pluginframework.configuration.Configurator; //导入依赖的package包/类
/**
 * handles frozen players
 *
 * @param plugin        the plugin
 * @param configManager the config manager
 * @param translate     the translator
 */
@Inject
private PlayerFreezeFeature(Plugin plugin, Configurator configManager, Translate translate, PluginLogger logger)
{
    this.plugin = plugin;
    Optional<FileConfiguration> mainConfig = configManager.getConfig("main");
    if(!mainConfig.isPresent()) {
        throw new IllegalStateException("Config file 'main' was not found, cannot find configuration values");
    }
    config = mainConfig.get();

    List<String> potionEffectsList = config.getStringList("PlayerFreeze.potion.effects");

    int duration = config.getInt("PlayerFreezepotion.duration");
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    for(String potionEffectString : potionEffectsList) {
        String[] parts = potionEffectString.split(":");
        if(parts.length != 2) {
            logger.log(Level.SEVERE, "Potion effect " + potionEffectString + " does not contain a ':', skipping it.");
            continue;
        }

        int amplifier = -1;
        try {
            amplifier = Integer.parseInt(parts[1]);
        } catch(NumberFormatException ignored) {
        }

        if(amplifier < 0) {
            logger.log(Level.SEVERE, "Potion effect " + potionEffectString + " has an invalid potion effect level '" + parts[1] + "', skipping it");
            continue;
        }

        PotionEffectType type = PotionEffectType.getByName(parts[0]);

        if(null == type) {
            logger.log(Level.SEVERE, "Potion effect " + potionEffectString + " has an invalid potion effect type '" + parts[0] + "', skipping it");
            continue;
        }

        effects.add(new PotionEffect(type, duration, amplifier, true));
    }

    freezer = new FreezeRunnable(effects);
    Bukkit.getPluginManager().registerEvents(freezer, plugin);
}
 
开发者ID:Eluinhost,项目名称:ultrahardcore,代码行数:53,代码来源:PlayerFreezeFeature.java


注:本文中的com.publicuhc.pluginframework.configuration.Configurator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。