Trivial code householding

- Replace `if (!x) ... else ...` with `if(x) ... else ...`
- Avoid throwing RuntimeException; use children
This commit is contained in:
ljacqu
2016-05-30 12:18:55 +02:00
parent 9349993faf
commit 9b1ee86b2f
19 changed files with 77 additions and 82 deletions
@@ -68,12 +68,12 @@ public class AsynchronousLogin implements AsynchronousProcess {
private boolean needsCaptcha(Player player) {
final String name = player.getName().toLowerCase();
if (service.getProperty(SecuritySettings.USE_CAPTCHA)) {
if (!plugin.captcha.containsKey(name)) {
plugin.captcha.putIfAbsent(name, 1);
} else {
if (plugin.captcha.containsKey(name)) {
int i = plugin.captcha.get(name) + 1;
plugin.captcha.remove(name);
plugin.captcha.putIfAbsent(name, i);
} else {
plugin.captcha.putIfAbsent(name, 1);
}
if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) > Settings.maxLoginTry) {
plugin.cap.putIfAbsent(name, RandomString.generate(Settings.captchaLength));