Optimization in base case and removal of final keyword

This commit is contained in:
theone1000 2019-09-17 01:54:10 -06:00
parent bfa3c17292
commit 80674df028
2 changed files with 11 additions and 4 deletions

View File

@ -106,9 +106,17 @@ public class EpicVouchers extends JavaPlugin {
key = key.toLowerCase(); key = key.toLowerCase();
Voucher voucher = new Voucher(key, this); Voucher voucher = new Voucher(key, this);
ConfigurationSection cs = vouchersFile.getConfig().getConfigurationSection("vouchers." + key); ConfigurationSection cs = vouchersFile.getConfig().getConfigurationSection("vouchers." + key);
Material material = cs.getString("material") == null || cs.getString("material").equals("") ? Material.PAPER :
Material.matchMaterial(cs.getString("material")) == null ? Material.PAPER : Material.matchMaterial(cs.getString("material"));
Material material;
String stringMaterial = cs.getString("material");
if (stringMaterial == null || stringMaterial.isEmpty()) {
material = Material.PAPER;
} else {
material = Material.matchMaterial(stringMaterial);
if(material == null) material = Material.PAPER;
}
voucher.setPermission(cs.getString("permission", "")); voucher.setPermission(cs.getString("permission", ""));
voucher.setMaterial(material); voucher.setMaterial(material);
voucher.setData((short) cs.getInt("data", 0)); voucher.setData((short) cs.getInt("data", 0));

View File

@ -28,7 +28,6 @@ public class CoolDownManager {
} }
public boolean isOnCoolDown(UUID uuid) { public boolean isOnCoolDown(UUID uuid) {
Long time = entries.get(uuid); Long time = entries.get(uuid);
if (time == null) { if (time == null) {
@ -44,7 +43,7 @@ public class CoolDownManager {
} }
public long getTime(UUID uuid) { public long getTime(UUID uuid) {
final Long time = entries.get(uuid); Long time = entries.get(uuid);
if (time == null) { if (time == null) {
return 0L; return 0L;