mirror of
https://github.com/songoda/EpicVouchers.git
synced 2024-11-14 22:25:29 +01:00
Optimization in base case and removal of final keyword
This commit is contained in:
parent
bfa3c17292
commit
80674df028
@ -106,9 +106,17 @@ 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);
|
||||
voucher.setData((short) cs.getInt("data", 0));
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user