Clean up code, replace switch and try-with-resource where possible.

This commit is contained in:
Đạt Nhân Trương
2022-08-07 21:51:10 +07:00
parent f983b4dccf
commit 0ef3e69638
22 changed files with 609 additions and 589 deletions

View File

@@ -418,7 +418,8 @@ public class AssignAPProcessor {
}
int newVal = 0;
if (type.equals(Stat.STR)) {
switch (type) {
case STR:
newVal = statUpdate[0] + gain;
if (newVal > YamlConfig.config.server.MAX_AP) {
statGain[0] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
@@ -427,7 +428,8 @@ public class AssignAPProcessor {
statGain[0] += gain;
statUpdate[0] = newVal;
}
} else if (type.equals(Stat.INT)) {
break;
case INT:
newVal = statUpdate[3] + gain;
if (newVal > YamlConfig.config.server.MAX_AP) {
statGain[3] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
@@ -436,7 +438,8 @@ public class AssignAPProcessor {
statGain[3] += gain;
statUpdate[3] = newVal;
}
} else if (type.equals(Stat.LUK)) {
break;
case LUK:
newVal = statUpdate[2] + gain;
if (newVal > YamlConfig.config.server.MAX_AP) {
statGain[2] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
@@ -445,7 +448,8 @@ public class AssignAPProcessor {
statGain[2] += gain;
statUpdate[2] = newVal;
}
} else if (type.equals(Stat.DEX)) {
break;
case DEX:
newVal = statUpdate[1] + gain;
if (newVal > YamlConfig.config.server.MAX_AP) {
statGain[1] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
@@ -454,6 +458,7 @@ public class AssignAPProcessor {
statGain[1] += gain;
statUpdate[1] = newVal;
}
break;
}
if (newVal > YamlConfig.config.server.MAX_AP) {