Java Code Examples for org.bukkit.configuration.file.FileConfiguration#getLong()
The following examples show how to use
org.bukkit.configuration.file.FileConfiguration#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: ListenerLegacyItemPickup.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
private void sendMessage(Player player) { if(player == null) return; UUID uuid = player.getUniqueId(); if(messageCooldownList.contains(uuid)) return; String message = this.plugin.getLanguageMessageColoredWithPrefix("cheat-prevention.items.no-pickup"); this.plugin.sendMessage(player, message); messageCooldownList.add(uuid); BukkitScheduler scheduler = Bukkit.getScheduler(); Runnable task = () -> messageCooldownList.remove(uuid); FileConfiguration config = this.expansion.getConfig("cheat-prevention.yml"); long messageCooldown = 20L * config.getLong("message-cooldown"); scheduler.runTaskLater(this.plugin.getPlugin(), task, messageCooldown); }
Example 2
Source File: ListenerRiptide.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
private void sendMessage(Player player) { if(player == null) return; UUID uuid = player.getUniqueId(); if(messageCooldownList.contains(uuid)) return; String message = this.plugin.getLanguageMessageColoredWithPrefix("cheat-prevention.no-riptide"); this.plugin.sendMessage(player, message); messageCooldownList.add(uuid); BukkitScheduler scheduler = Bukkit.getScheduler(); Runnable task = () -> messageCooldownList.remove(uuid); FileConfiguration config = this.expansion.getConfig("cheat-prevention.yml"); long messageCooldown = 20L * config.getLong("message-cooldown"); scheduler.runTaskLater(this.plugin.getPlugin(), task, messageCooldown); }
Example 3
Source File: ListenerBlocks.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
private void sendMessageWithCooldown(Player player, String path) { if(player == null || path == null || path.isEmpty()) return; List<UUID> messageCooldownList = messagePathToCooldownList.getOrDefault(path, Util.newList()); UUID uuid = player.getUniqueId(); if(messageCooldownList.contains(uuid)) return; String message = this.plugin.getLanguageMessageColoredWithPrefix(path); this.plugin.sendMessage(player, message); messageCooldownList.add(uuid); messagePathToCooldownList.put(path, messageCooldownList); BukkitScheduler scheduler = Bukkit.getScheduler(); Runnable task = () -> removeCooldown(player, path); FileConfiguration config = this.expansion.getConfig("cheat-prevention.yml"); long messageCooldown = 20L * config.getLong("message-cooldown"); scheduler.runTaskLater(this.plugin.getPlugin(), task, messageCooldown); }
Example 4
Source File: ListenerNewItemPickup.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
private void sendMessage(Player player) { if(player == null) return; UUID uuid = player.getUniqueId(); if(messageCooldownList.contains(uuid)) return; String message = this.plugin.getLanguageMessageColoredWithPrefix("cheat-prevention.items.no-pickup"); this.plugin.sendMessage(player, message); messageCooldownList.add(uuid); BukkitScheduler scheduler = Bukkit.getScheduler(); Runnable task = () -> messageCooldownList.remove(uuid); FileConfiguration config = this.expansion.getConfig("cheat-prevention.yml"); long messageCooldown = 20L * config.getLong("message-cooldown"); scheduler.runTaskLater(this.plugin.getPlugin(), task, messageCooldown); }
Example 5
Source File: ListenerNewbieProtection.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
private boolean isProtected(Player player) { if(player == null) return false; long firstJoinMillis = player.getFirstPlayed(); if(firstJoinMillis == 0) return false; long systemMillis = System.currentTimeMillis(); long subtract = (systemMillis - firstJoinMillis); FileConfiguration config = this.expansion.getConfig("newbie-helper.yml"); long protectionTimeMillis = config.getLong("newbie-protection.protection-timer") * 1000L; if(subtract > protectionTimeMillis) { removeProtection(player); return false; } YamlConfiguration dataFile = this.plugin.getDataFile(player); if(!dataFile.isSet("newbie-helper.protected")) { dataFile.set("newbie-helper.protected", true); this.plugin.saveDataFile(player, dataFile); } return dataFile.getBoolean("newbie-helper.protected"); }
Example 6
Source File: UhcWorldBorder.java From UhcCore with GNU General Public License v3.0 | 5 votes |
public UhcWorldBorder(){ FileConfiguration cfg = UhcCore.getPlugin().getConfig(); moving = cfg.getBoolean("border.moving",true); startSize = cfg.getInt("border.start-size",1000); endSize = cfg.getInt("border.end-size",0); timeToShrink = cfg.getLong("border.time-to-shrink",3600); timeBeforeShrink = cfg.getLong("border.time-before-shrink",0); Bukkit.getLogger().info("[UhcCore] Border start size is "+startSize); Bukkit.getLogger().info("[UhcCore] Border end size is "+startSize); Bukkit.getLogger().info("[UhcCore] Border moves : "+moving); Bukkit.getLogger().info("[UhcCore] Border timeBeforeEnd : "+timeToShrink); }
Example 7
Source File: ListenerCommandBlocker.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
private void addCooldown(Player player) { if(player == null) return; FileConfiguration config = this.expansion.getConfig("cheat-prevention.yml"); long cooldownSeconds = config.getLong("command-blocker.delay-after-combat"); if(cooldownSeconds <= 0) return; long cooldownMillis = TimeUnit.SECONDS.toMillis(cooldownSeconds); long systemTime = System.currentTimeMillis(); long expireTime = (systemTime + cooldownMillis); UUID uuid = player.getUniqueId(); cooldownMap.put(uuid, expireTime); }
Example 8
Source File: RegionManager.java From Civs with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") private Region loadRegion(File regionFile) { FileConfiguration regionConfig = new YamlConfiguration(); Region region; try { regionConfig.load(regionFile); int[] radii = new int[6]; radii[0] = regionConfig.getInt("xp-radius"); radii[1] = regionConfig.getInt("zp-radius"); radii[2] = regionConfig.getInt("xn-radius"); radii[3] = regionConfig.getInt("zn-radius"); radii[4] = regionConfig.getInt("yp-radius"); radii[5] = regionConfig.getInt("yn-radius"); Location location = Region.idToLocation(Objects.requireNonNull(regionConfig.getString("location"))); if (location == null) { throw new NullPointerException(); } double exp = regionConfig.getDouble("exp"); HashMap<UUID, String> people = new HashMap<>(); for (String s : Objects.requireNonNull(regionConfig.getConfigurationSection("people")).getKeys(false)) { people.put(UUID.fromString(s), regionConfig.getString("people." + s)); } RegionType regionType = (RegionType) ItemManager.getInstance() .getItemType(Objects.requireNonNull(regionConfig.getString("type")).toLowerCase()); region = new Region( Objects.requireNonNull(regionConfig.getString("type")).toLowerCase(), people, location, radii, (HashMap<String, String>) regionType.getEffects().clone(), exp); region.setWarehouseEnabled(regionConfig.getBoolean("warehouse-enabled", true)); double forSale = regionConfig.getDouble("sale", -1); if (forSale != -1) { region.setForSale(forSale); } long lastActive = regionConfig.getLong(ActiveEffect.LAST_ACTIVE_KEY, -1); if (lastActive > -1) { region.setLastActive(lastActive); } if (regionConfig.isSet("upkeep-history")) { for (String timeString : Objects.requireNonNull(regionConfig .getConfigurationSection("upkeep-history")).getKeys(false)) { Long time = Long.parseLong(timeString); region.getUpkeepHistory().put(time, regionConfig.getInt("upkeep-history." + timeString)); } } } catch (Exception e) { Civs.logger.log(Level.SEVERE, "Unable to read " + regionFile.getName(), e); return null; } return region; }
Example 9
Source File: TraitCombatLogX.java From CombatLogX with GNU General Public License v3.0 | 4 votes |
private long getSurvivalSeconds() { FileConfiguration config = this.expansion.getConfig("citizens-compatibility.yml"); return config.getLong("npc-options.survival-seconds", 30L); }