Fix for admin upgrade commands

This commit is contained in:
Fabrizio La Rosa 2020-07-08 08:48:57 +02:00
parent 2fe608aec2
commit fe9b01e0d9
2 changed files with 11 additions and 15 deletions

View File

@ -57,15 +57,13 @@ public class AddUpgradeCommand extends SubCommand {
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
targetPlayerName = targetPlayer.getName();
}
Upgrade.Type upgrade;
try {
upgrade = Upgrade.Type.valueOf(args[1].toUpperCase());
if(upgrade.equals(Upgrade.Type.Size) || upgrade.equals(Upgrade.Type.Members)){
upgrade = null;
Upgrade.Type upgrade = null;
for(Upgrade.Type type : Upgrade.Type.values()) {
if(type.name().toUpperCase().equals(args[1].toUpperCase())) {
upgrade = type;
break;
}
} catch(IllegalArgumentException e) {
upgrade = null;
}
if (islandOwnerUUID == null) {

View File

@ -58,14 +58,12 @@ public class RemoveUpgradeCommand extends SubCommand {
targetPlayerName = targetPlayer.getName();
}
Upgrade.Type upgrade;
try {
upgrade = Upgrade.Type.valueOf(args[1].toUpperCase());
if(upgrade.equals(Upgrade.Type.Size) || upgrade.equals(Upgrade.Type.Members)){
upgrade = null;
Upgrade.Type upgrade = null;
for(Upgrade.Type type : Upgrade.Type.values()) {
if(type.name().toUpperCase().equals(args[1].toUpperCase())) {
upgrade = type;
break;
}
} catch(IllegalArgumentException e) {
upgrade = null;
}
if (islandOwnerUUID == null) {