本文整理匯總了Java中org.bukkit.configuration.ConfigurationSection.getInt方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationSection.getInt方法的具體用法?Java ConfigurationSection.getInt怎麽用?Java ConfigurationSection.getInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.configuration.ConfigurationSection
的用法示例。
在下文中一共展示了ConfigurationSection.getInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Channel
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
public Channel(ConfigurationSection section, MessageManager manager) {
allowIn = section.getBoolean("ALLOW_IN", false);
allowOut = section.getBoolean("ALLOW_OUT", false);
tryBroadcast = section.getBoolean("TRY_OUT", false);
minLength = (byte) section.getInt("MIN_CHAR", 2);
alone = manager.get(section.getString("ALONE"));
join = manager.get(section.getString(Node.JOIN.get()));
leave = manager.get(section.getString(Node.LEAVE.get()));
pJoin = manager.get(section.getString("P_"+Node.JOIN.get()));
pLeave = manager.get(section.getString("P_"+Node.LEAVE.get()));
muted = manager.get(section.getString("MUTED"));
muteIn = manager.get(section.getString("MUTE_IN"));
muteOut = manager.get(section.getString("MUTE_OUT"));
talkIn = manager.get(section.getString("TALK_IN"));
talkOut = manager.get(section.getString("TALK_OUT"));
unmuteIn = manager.get(section.getString("UNMUTE_IN"));
unmuteOut = manager.get(section.getString("UNMUTE_OUT"));
}
示例2: RewardStat
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
public RewardStat(ConfigurationSection section, MComponentManager manager) {
ErrorLogger.addPrefix(Node.ID.get());
this.stat = VanillaPlusCore.getStatManager().get((short)section.getInt(Node.ID.get()), true);
ErrorLogger.removePrefix();
int amount = section.getInt(Node.AMOUNT.get());
if(amount < 0) {
amount = - amount;
ErrorLogger.addError("Amount can't be negative.");
}else if(amount == 0) {
ErrorLogger.addError("Amount can't be 0.");
}
this.amount = amount;
ErrorLogger.addPrefix(Node.FORMAT.get());
this.format = manager.get(section.getString(Node.FORMAT.get(), "REWARD.STAT"));
ErrorLogger.removePrefix();
}
示例3: Menu
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
public Menu(MessageManager messageManager, YamlConfiguration section) {
ConfigurationSection settings = section.getConfigurationSection(Node.SETTINGS.get());
if(settings == null){
Error.MISSING_NODE.add(Node.SETTINGS.get());
title = new MComponent(VanillaPlusCore.getDefaultLang(), " ");
icons = new Icon[37];
type = InventoryType.CHEST;
refresh = 0;
return;
}else{
title = messageManager.getComponentManager().get(settings.getString(Node.NAME_PATH.get()));
type = InventoryType.valueOf(settings.getString(Node.TYPE.get(), "CHEST"));
if(type == InventoryType.CHEST) {
int size = settings.getInt("ROWS");
if(size < 0 || size > 12)
ErrorLogger.addError("ROWS must be between 0 and 12 inclulsive !");
icons = new Icon[9*size+1];
}
else
icons = new Icon[type.getDefaultSize()+1];
refresh = (byte) settings.getInt("REFRESH", 0);
}
}
示例4: PetType
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
PetType(ConfigurationSection config) {
super(config, config.getString("item"));
this.name = StringUtils.coloredLine(config.getString("name"));
this.itemName = StringUtils.coloredLine(config.getString("item-name"));
this.lore = StringUtils.coloredLines(config.getStringList("lore"));
this.role = Role.valueOf(config.getString("type", "COMPANION"));
this.skin = role.getPossibleSkin(config.getString("skin"));
this.health = config.getDouble("health");
this.damage = config.getDouble("damage", 0);
this.speed = config.getDouble("speed");
this.attackMobs = config.getBoolean("attack-mobs", false);
this.attackPlayers = config.getBoolean("attack-players", false);
this.revival = config.getBoolean("revival", true);
this.cooldown = this.revival ? config.getInt("cooldown") : 0;
this.createSpawnItem(config.getName());
this.storeFeatures(config.getStringList("features"));
}
示例5: init
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
public static void init() {
if (entityDistances != null) return;
entityDistances = Maps.newHashMap();
ConfigurationSection section = Bukkit.spigot().getConfig().getConfigurationSection("world-settings");
ConfigurationSection defaultSec = section.getConfigurationSection("default.entity-tracking-range");
for (String s : section.getKeys(false)) {
ConfigurationSection world = section.getConfigurationSection(s + ".entity-tracking-range");
int[] ranges = new int[]{
world.contains("players") ? world.getInt("players") : defaultSec.getInt("players"),
world.contains("animals") ? world.getInt("animals") : defaultSec.getInt("animals"),
world.contains("monsters") ? world.getInt("monsters") : defaultSec.getInt("monsters"),
world.contains("misc") ? world.getInt("misc") : defaultSec.getInt("misc"),
world.contains("other") ? world.getInt("other") : defaultSec.getInt("other")
};
int max = 0;
for (int range : ranges) {
if (range > max) max = range;
}
entityDistances.putIfAbsent(s, max);
}
}
示例6: setupConfiguration
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
private void setupConfiguration(final ConfigurationSection section) {
if (section.isConfigurationSection("worlds")) {
final ConfigurationSection wSection = section
.getConfigurationSection("worlds");
for (String wName : wSection.getKeys(false)) {
final int centerX = wSection.getInt(wName + ".centerX", 0);
final int centerZ = wSection.getInt(wName + ".centerZ", 0);
final int distance = wSection.getInt(
wName + ".distance", DEFAULT_DISTANCE);
final double knockback = wSection.getDouble(
wName + ".knockback-distance", DEFAULT_KNOCKBACK);
WorldBorder wb = new BasicWorldBorder(
centerX, centerZ, distance);
wb.setKnockbackDistance(knockback);
this.worldBorders.put(wName, wb);
this.plugin.getLogger().log(Level.INFO, "Created border"
+ " for world '" + wName + "'!" + lineSeparator()
+ "Knockback=" + knockback + lineSeparator()
+ "Distance = " + distance
);
}
}
}
示例7: isLinked
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
public static boolean isLinked(Player p){
String uuid = p.getUniqueId().toString();
UtilsStorage storageType = Utils.getStorageType();
if(storageType == UtilsStorage.FILE){
if(UltimateTs.linkedPlayers.getConfigurationSection("linked") == null) UltimateTs.linkedPlayers.createSection("linked");
ConfigurationSection cs = UltimateTs.linkedPlayers.getConfigurationSection("linked");
if((cs.contains(uuid)) && (cs.getInt(uuid) > 0)) return true;
}else if(storageType == UtilsStorage.SQL){
if(UltimateTs.main().sql.isUUIDLinked(uuid)){
int linkedId = UltimateTs.main().sql.getLinkedId(uuid);
if(linkedId > 0){
return true;
}
}
}
return false;
}
示例8: getLinkedWithDbId
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
public static int getLinkedWithDbId(Player p){
UtilsStorage storageType = Utils.getStorageType();
if(storageType == UtilsStorage.FILE){
if(isLinked(p)){
ConfigurationSection cs = UltimateTs.linkedPlayers.getConfigurationSection("linked");
int dbid = cs.getInt(p.getUniqueId().toString());
return dbid;
}
}else if(storageType == UtilsStorage.SQL){
if(UltimateTs.main().sql.isUUIDLinked(p.getUniqueId().toString())){
int dbId = UltimateTs.main().sql.getLinkedId(p.getUniqueId().toString());
return dbId;
}
}
return 0;
}
示例9: configureData
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
private boolean configureData(ConfigurationSection config) {
String host = config.getString("host", "localhost");
int port = config.getInt("port", 3306);
String dbname = config.getString("database", "cropcontrol");
String username = config.getString("user");
String password = config.getString("password");
int poolsize = config.getInt("poolsize", 5);
long connectionTimeout = config.getLong("connection_timeout", 10000l);
long idleTimeout = config.getLong("idle_timeout", 600000l);
long maxLifetime = config.getLong("max_lifetime", 7200000l);
try {
data = new ManagedDatasource(CropControl.getPlugin(), username, password, host, port, dbname,
poolsize, connectionTimeout, idleTimeout, maxLifetime);
data.getConnection().close();
} catch (Exception se) {
CropControl.getPlugin().info("Failed to initialize Database connection");
return false;
}
initializeTables();
stageUpdates();
long begin_time = System.currentTimeMillis();
try {
CropControl.getPlugin().info("Update prepared, starting database update.");
if (!data.updateDatabase()) {
CropControl.getPlugin().info( "Update failed, disabling plugin.");
return false;
}
} catch (Exception e) {
CropControl.getPlugin().severe("Update failed, disabling plugin. Cause:", e);
return false;
}
CropControl.getPlugin().info(String.format("Database update took %d seconds", (System.currentTimeMillis() - begin_time) / 1000));
activateDirtySave(config.getConfigurationSection("dirtysave"));
return true;
}
示例10: loadConfig
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
private void loadConfig() {
FileConfiguration config = new YamlConfiguration();
try {
config.load(new File(getDataFolder(), "config.yml"));
config.options().copyDefaults(true);
String user = config.getString("jdbc-username", "root");
String password = config.getString("jdbc-password", "password");
String jdbcUrl = config.getString("jdbc-url", "jdbc:mysql://localhost:3306/minecraft");
databaseManager = new DatabaseManager(jdbcUrl, user, password);
databaseManager.connect();
ConfigurationSection definitions = config.getConfigurationSection("definitions");
for (String definitionKey : definitions.getKeys(false)) {
ConfigurationSection definition = definitions.getConfigurationSection(definitionKey);
int priority = definition.getInt("priority", 1);
ImageType type = ImageType.valueOf(definition.getString("type", ImageType.OVERLAY.name()));
String permission = definition.getString("permission");
List<String> images = definition.getStringList("images");
SpigotImageDetails imageDetails = new SpigotImageDetails(priority, type, permission, images);
imageHandler.addImage(imageDetails);
}
config.save(new File(getDataFolder(), "config.yml"));
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
示例11: CPMessagePrivate
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
public CPMessagePrivate(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
if(instance == null){
instance = this;
new BukkitRunnable() {
@Override
public void run() {
for(Entry<VPPlayer, HashMap<VPPlayer, LiteEntry<Integer, Integer>>>entry : history.entrySet()){
if(entry.getValue() == null || entry.getValue().isEmpty()){
history.remove(entry.getKey());
}
for(Entry<VPPlayer, LiteEntry<Integer, Integer>>pEntry : entry.getValue().entrySet()){
if(pEntry.getValue() == null || pEntry.getValue().getValue() >=29){
entry.getValue().remove(pEntry.getKey());
}else{
pEntry.getValue().setValue(pEntry.getValue().getValue()+1);
}
}
if(entry.getValue().isEmpty()){
history.remove(entry.getKey());
}
}
}
}.runTaskLater(VanillaPlus.getInstance(), 20);
}
if(section.contains("CHANNEL_SPY")){
spy = VanillaPlusCore.getChannelManager().get(section.getString("CHANNEL_SPY"), true);
messageSpy = manager.get(section.getString("MESSAGE_SPY"));
if(spy == null || messageSpy == null){
ErrorLogger.addError("SPY error");
}
}
bypassChannelMute = section.getBoolean("BYPASS_CHANNEL_MUTE", false);
messageFrom = manager.get(section.getString(Node.MESSAGE_FROM.get()));
messageTo = manager.get(section.getString(Node.MESSAGE_TO.get()));
messageToLockMP = manager.get(section.getString("MESSAGE_TO_LOCKED"));
min = section.getInt("MIN", 0);
if(min < 0)
min = 0;
}
示例12: FoodStatus
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
FoodStatus(ConfigurationSection section){
abso = section.getInt(Node.ABSORPTION.get(), -1);
defaultAbso = abso;
food = section.getInt(Node.FOOD.get(), 0);
defaultFood = food;
saturation = section.getInt(Node.SATURATION.get(), 0);
defaultSaturation = saturation;
volume = (float) section.getDouble("VOLUME", 1);
pitch = (float) section.getDouble("SPEED", 1);
sound = Utils.matchEnum(Sound.values(), section.getString("SOUND"), true);
ConfigurationSection potion = section.getConfigurationSection(Node.EFFECT.getList());
effects = new ArrayList<PotionEffect>();
if(potion == null)
return;
for(String key : potion.getKeys(false)){
ConfigurationSection sub = potion.getConfigurationSection(key);
if(sub == null){
ErrorLogger.addError(key + " invalid !");
continue;
}
PotionEffect effect = MinecraftUtils.craftPotionEffect(key, sub);
if(effect.getType().equals(PotionEffectType.ABSORPTION)) {
absoEffect = effect;
reset();
}else
this.effects.add(effect);
}
}
示例13: Title
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
Title(int id,ConfigurationSection section, MComponentManager mComponentManager){
this.id = id;
name = mComponentManager.get(section.getString(Node.NAME_PATH.get()));
description = mComponentManager.get(section.getString(Node.LORE_PATH.get()));
int level = section.getInt(Node.LEVEL.get(), 1);
if( level < 1 ){
ErrorLogger.addError(Node.LEVEL.get() + " " + Error.INVALID.getMessage());
this.level = 1;
}else if( level > Byte.MAX_VALUE ){
ErrorLogger.addError(Node.LEVEL.get() + " " + Error.INVALID.getMessage());
this.level = Byte.MAX_VALUE;
}else
this.level = (byte) level;
}
示例14: CheckManager
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
/**
* Handle getting all the check data.
*
* @param configuration the configuration file.
*/
public CheckManager(FileConfiguration configuration) {
this.configuration = configuration;
for (CheckType check : CheckType.values()) {
String checkName = check.getCheckName().toLowerCase();
ConfigurationSection section = configuration.getConfigurationSection(checkName);
boolean isEnabled = configuration.getBoolean(checkName + ".enabled");
// if were not enabled, continue.
if (!isEnabled) {
continue;
}
// collect the violation levels from the config.
int banViolations = section.getInt("ban");
int cancelViolations = section.getInt("cancel-vl");
int notifyViolations = section.getInt("notify");
// populate the map with the new check data.
boolean cancelCheck = section.getBoolean("cancel");
CheckData data = new CheckData(notifyViolations, cancelViolations, banViolations, cancelCheck, banViolations > 0);
CHECK_DATA.put(check, data);
Arc.getPlugin().getLogger().info("Finished getting data for check: " + checkName);
}
}
示例15: BackpackType
import org.bukkit.configuration.ConfigurationSection; //導入方法依賴的package包/類
BackpackType(ConfigurationSection config) {
super(config.getString("item"));
this.id = config.getName();
this.name = StringUtils.coloredLine(config.getString("name"));
this.lore = StringUtils.coloredLines(config.getStringList("lore"));
this.size = config.getInt("size") < 56 ? config.getInt("size") : 56;
this.createItem();
}