Created
May 30, 2016 13:38
-
-
Save anonymous/2c3fb5c0daccec49cc07e8212649bd34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Construct CoolDown object. | |
Optional<CoolDown> coolDown = Optional.empty(); | |
if (plugin.getConfig().getBoolean("items." + str + ".cooldown.enabled")) { | |
coolDown = Optional.of(new CoolDown(plugin.getConfig().getDouble("items." + str + ".cooldown.duration"), | |
plugin.getConfig().getBoolean("items." + str + ".use-formatted-time"), | |
plugin.getConfig().getBoolean("items." + str + ".use-expired-message"), | |
t(plugin.getConfig().getStringList("items." + str + ".consume-message")), | |
t(plugin.getConfig().getStringList("items." + str + ".cooldown-message")), | |
t(plugin.getConfig().getStringList("items." + str + ".expired-message")))); | |
} | |
Optional<String> permissionNode = Optional.ofNullable(plugin.getConfig().getString("items." + str + ".permission")); | |
// Construct ConsumptionControl object. | |
Optional<ConsumptionControl> consumptionControl = Optional.empty(); | |
if (plugin.getConfig().getBoolean("items." + str + ".consumption-control.enabled")) { | |
consumptionControl = Optional.of(new ConsumptionControl(plugin.getConfig().getInt("items." + str + ".consumption-control.food-level"), | |
Float.valueOf(plugin.getConfig().getString("items." + str + ".consumption-control.saturation")), | |
plugin.getConfig().getStringList("items." + str + ".consumption-control.effects"))); | |
} | |
// Add the item to the set. | |
items.add(new Item(material, confData, permissionNode.orElseGet(null), coolDown.orElseGet(null), consumptionControl.orElseGet(null))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment