@Override public double getDouble(Key key) { if (cache.containsKey(key)) { return (Double) cache.get(key); } double doub = config.getDouble(key.path, (Double) key.def); cache.put(key, doub); return doub; }
@Override public double getDouble(String path) { return configFile.getDouble(path); }
private boolean isValid(String path) { return configuration.getDouble(path, INVALID_PATH) != INVALID_PATH; } }
double buyPrice = PriceUtil.getBuyPrice(event.getSignLine(PRICE_LINE)); if (isValid("min.buy_price." + itemType) && buyPrice < (configuration.getDouble("min.buy_price." + itemType) * amount)) { event.setOutcome(BUY_PRICE_BELOW_MIN); if (isValid("max.buy_price." + itemType) && buyPrice > (configuration.getDouble("max.buy_price." + itemType) * amount)) { event.setOutcome(BUY_PRICE_ABOVE_MAX); double sellPrice = PriceUtil.getSellPrice(event.getSignLine(PRICE_LINE)); if (isValid("min.sell_price." + itemType) && sellPrice < (configuration.getDouble("min.sell_price." + itemType) * amount)) { event.setOutcome(SELL_PRICE_BELOW_MIN); if (isValid("max.sell_price." + itemType) && sellPrice > (configuration.getDouble("max.sell_price." + itemType) * amount)) { event.setOutcome(SELL_PRICE_ABOVE_MAX);
@EventHandler(priority = EventPriority.LOW) public void onPreTransaction(PreTransactionEvent event) { if (event.isCancelled() || event.getTransactionType() != BUY || !(event.getOwnerInventory() instanceof AdminInventory)) { return; } Player client = event.getClient(); if (!PriceUtil.hasBuyPrice(event.getSign().getLine(PRICE_LINE))) { return; } for (String group : groupList) { if (Permission.has(client, Permission.DISCOUNT + group)) { event.setPrice(event.getPrice() * (config.getDouble(group) / 100)); return; } } } }
spaceBetweenLines = config.getDouble(ConfigNode.SPACE_BETWEEN_LINES.getPath()); preciseHologramMovement = config.getBoolean(ConfigNode.PRECISE_HOLOGRAM_MOVEMENT.getPath());
oddsOfAppearance = Math.max(0.0, Math.min(1.0, metaYaml.getDouble(tagOddsOfAppearance, oddsOfAppearance))); broadcastLocation = metaYaml.getBoolean(tagBroadcastLocation, broadcastLocation); decayable = metaYaml.getBoolean(tagDecayable, decayable);