1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-21 13:28:12 +03:00

Votekick edit (#4924)

* Add "yes" and "no" compatibility to votekicks

* Lowercase
This commit is contained in:
TranquillyUnpleasant 2021-03-12 02:54:10 +05:00 committed by GitHub
parent 78a7d15f3e
commit e08052d7d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -464,12 +464,18 @@ public class NetServer implements ApplicationListener{
return; return;
} }
if(!arg[0].equalsIgnoreCase("y") && !arg[0].equalsIgnoreCase("n")){ int sign;
switch(arg[0].toLowerCase()){
case "y", "yes" -> sign = 1;
case "n", "no" -> sign = -1;
default -> sign = 0;
}
if(sign == 0){
player.sendMessage("[scarlet]Vote either 'y' (yes) or 'n' (no)."); player.sendMessage("[scarlet]Vote either 'y' (yes) or 'n' (no).");
return; return;
} }
int sign = arg[0].equalsIgnoreCase("y") ? 1 : -1;
currentlyKicking[0].vote(player, sign); currentlyKicking[0].vote(player, sign);
} }
}); });