Java Code Examples for org.bukkit.configuration.ConfigurationSection#getLong()

The following examples show how to use org.bukkit.configuration.ConfigurationSection#getLong() . 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: GovernmentManager.java    From Civs with GNU General Public License v3.0 5 votes vote down vote up
private ArrayList<GovTransition> processTransitionList(ConfigurationSection section) {
    ArrayList<GovTransition> transitions = new ArrayList<>();
    if (section == null) {
        return transitions;
    }
    for (String index : section.getKeys(false)) {
        int power = -1;
        int moneyGap = -1;
        int revolt = -1;
        long inactive = -1;
        String governmentType = null;
        for (String key : section.getConfigurationSection(index).getKeys(false)) {
            if ("power".equals(key)) {
                power = section.getInt(index + "." + key);
            } else if ("money-gap".equals(key)) {
                moneyGap = section.getInt(index + "." + key);
            } else if ("revolt".equals(key)) {
                revolt = section.getInt(index + "." + key);
            } else if ("inactive".equals(key)) {
                inactive = section.getLong(index + "." + key);
            } else {
                governmentType = section.getString(index + "." + key);
            }
        }
        if (governmentType == null) {
            continue;
        }
        transitions.add(new GovTransition(revolt, moneyGap, power, inactive, governmentType));
    }
    return transitions;
}
 
Example 2
Source File: ParticleEffect.java    From Civs with GNU General Public License v3.0 5 votes vote down vote up
public ParticleEffect(Spell spell, String key, Object target, Entity origin, int level, ConfigurationSection section) {
    super(spell, key, target, origin, level, section);
    this.particle = section.getString("particle", "reddust");
    this.pattern = section.getString("pattern", "reddust");
    this.duration = section.getLong("duration", 100);

    String tempTarget = section.getString("target", "not-a-string");
    if (!tempTarget.equals("not-a-string")) {
        this.target = tempTarget;
    }
}
 
Example 3
Source File: DatabaseRecord.java    From PlayTimeTracker with MIT License 5 votes vote down vote up
public static DatabaseRecord deserialize(UUID id, ConfigurationSection sec) {
    DatabaseRecord rec = new DatabaseRecord();
    rec.uuid = id;
    rec.lastSeen = ZonedDateTime.parse(sec.getString("last_seen"));
    rec.dailyTime = sec.getLong("daily_play_time");
    rec.weeklyTime = sec.getLong("weekly_play_time");
    rec.monthlyTime = sec.getLong("monthly_play_time");
    rec.totalTime = sec.getLong("total_play_time");
    rec.completedDailyMissions = new HashSet<>(sec.getStringList("completed_daily_mission"));
    rec.completedWeeklyMissions = new HashSet<>(sec.getStringList("completed_weekly_mission"));
    rec.completedMonthlyMissions = new HashSet<>(sec.getStringList("completed_monthly_mission"));
    rec.completedLifetimeMissions = new HashSet<>(sec.getStringList("completed_lifetime_mission"));
    return rec;
}
 
Example 4
Source File: Rule.java    From PlayTimeTracker with MIT License 5 votes vote down vote up
public Rule(String name, ConfigurationSection s) {
    this.name = name;
    switch (s.getString("period")) {
        case "day": {
            period = PeriodType.DAY;
            break;
        }
        case "week": {
            period = PeriodType.WEEK;
            break;
        }
        case "month": {
            period = PeriodType.MONTH;
            break;
        }
        case "disposable": {
            period = PeriodType.DISPOSABLE;
            break;
        }
        case "session": {
            period = PeriodType.SESSION;
            break;
        }
        case "longtimenosee": {
            period = PeriodType.LONGTIMENOSEE;
            break;
        }
    }
    require = s.getLong("require");
    autoGive = s.getBoolean("auto-give");
    timeout = s.contains("timeout") ? s.getLong("timeout") : -1;
    group = s.contains("eligible-group") ? new HashSet<>(s.getStringList("eligible-group")) : null;
    reward = s.getString("reward");
}
 
Example 5
Source File: DurabilityMaterial.java    From ObsidianDestroyer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Storage for a tracked material from the config
 *
 * @param type    the type of material
 * @param section the configuration section to load
 */
public DurabilityMaterial(Material type, int typeData, ConfigurationSection section) {
    this.type = type;
    this.name = type.name();
    this.typeData = typeData;
    this.blastRadius = section.getInt("BlastRadius", 2);
    this.destructible = section.getBoolean("Destructible", true);
    this.bypassFluidProtect = section.getBoolean("BypassFluidProtection", false);
    this.bypassFactionProtect = section.getBoolean("BypassFactionProtection", false);
    this.durability = section.getInt("Durability.Amount", 5);
    this.fluidDamper = section.getDouble("Durability.FluidDamper", 0);
    this.enabled = section.getBoolean("Durability.Enabled", true);
    this.chanceToDrop = section.getDouble("Durability.ChanceToDrop", 0.7);
    this.resetEnabled = section.getBoolean("Durability.ResetEnabled", false);
    this.resetTime = section.getLong("Durability.ResetAfter", 10000L);
    this.tntEnabled = section.getBoolean("EnabledFor.TNT", true);
    this.cannonsEnabled = section.getBoolean("EnabledFor.Cannons", false);
    this.creepersEnabled = section.getBoolean("EnabledFor.Creepers", false);
    this.ghastsEnabled = section.getBoolean("EnabledFor.Ghasts", false);
    this.withersEnabled = section.getBoolean("EnabledFor.Withers", false);
    this.tntMinecartsEnabled = section.getBoolean("EnabledFor.Minecarts", false);
    this.nullEnabled = section.getBoolean("EnabledFor.NullDamage", true);
    this.tntDamage = section.getInt("Damage.TNT", 1);
    this.cannonImpactDamage = section.getInt("Damage.Cannons", section.getInt("Damage.CannonsImpact", 1));
    this.cannonPierceDamage = section.getInt("Damage.CannonsPierce", 1);
    this.creeperDamage = section.getInt("Damage.Creepers", 1);
    this.chargedCreeperDamage = section.getInt("Damage.ChargedCreepers", 1);
    this.ghastDamage = section.getInt("Damage.Ghasts", 1);
    this.witherDamage = section.getInt("Damage.Withers", 1);
    this.tntMinecartDamage = section.getInt("Damage.Minecarts", 1);
    this.nullDamage = section.getInt("Damage.NullDamage", 1);
    this.enderCrystalEnabled = section.getBoolean("EnabledFor.EnderCrystal", false);
    this.enderCrystalDamage = section.getInt("Damage.EnderCrystal", 1);
    this.tallyKittens();
}