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,8 +106,16 @@ public class EpicVouchers extends JavaPlugin {
key = key.toLowerCase();
Voucher voucher = new Voucher(key, this);
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.setMaterial(material);

View File

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