本文整理汇总了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"));
}
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}