@Override
    public final void onKeyPress(char var1, int var2) {
        if (var2 == 14 && name.length() > 0) {
            name = name.substring(0, name.length() - 1);
        }

        String canUse = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_\'*!\"#%/()=+?[]{}<>";
        if (numbersOnly) {
            canUse = "0123456789";
        }
        if (allowedChars != null) {
            canUse = allowedChars;
        }
        if (canUse.indexOf(var1) >= 0 && name.length() < stringLimit) {
            name = name + var1;
        }

        buttons.get(0).active = name.trim().length() > 0;
    }