From 13c4d654db424e2c2a2362de2c0df1f9800372a0 Mon Sep 17 00:00:00 2001 From: asofold Date: Mon, 1 Oct 2012 02:59:02 +0200 Subject: [PATCH] Use char[] for captcha generation. --- src/fr/neatmonster/nocheatplus/checks/chat/Captcha.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/chat/Captcha.java b/src/fr/neatmonster/nocheatplus/checks/chat/Captcha.java index da29e796..2d6ad0a2 100644 --- a/src/fr/neatmonster/nocheatplus/checks/chat/Captcha.java +++ b/src/fr/neatmonster/nocheatplus/checks/chat/Captcha.java @@ -61,10 +61,11 @@ public class Captcha extends AsyncCheck implements ICaptcha{ @Override public void generateCaptcha(ChatConfig cc, ChatData data, boolean reset) { if (reset) data.captchTries = 0; - data.captchaGenerated = ""; + final char[] chars = new char[cc.captchaLength]; for (int i = 0; i < cc.captchaLength; i++) - data.captchaGenerated += cc.captchaCharacters.charAt(random + chars[i] = cc.captchaCharacters.charAt(random .nextInt(cc.captchaCharacters.length())); + data.captchaGenerated = new String(chars); } @Override