-1

正在编译... src\server\model\players\packets\Commands.java:1389: 解析时到达文件末尾 }→ ^ 1 错误 按任意键继续。. .

我错过了什么?

if (playerCommand.startsWith("auth") && playerCommand.length() > 5) {
    if (!Config.MYSQL_ACTIVE) {
        c.sendMessage("Sorry this is currently disabled.");
        return;
    } else {
        try {
            PreparedStatement ps = Database.getConnection().prepareStatement("SELECT * FROM votes WHERE username = ? AND used = '1' LIMIT 1");
            ps.setString(1, c.playerName);
            ResultSet results = ps.executeQuery();
            if (results.next()) {
                c.sendMessage("You have already voted once today.");
            } else {
                ps.close();
                ps = Database.getConnection().prepareStatement("SELECT * FROM votes WHERE authcode = ? AND used = '0' LIMIT 1");
                ps.setString(1, playerCommand.substring(5));
                results = ps.executeQuery();
                if (results.next()) {
                    ps.close();
                    ps = Database.getConnection().prepareStatement("UPDATE votes SET used = '1' WHERE authcode = ?");
                    ps.setString(1, playerCommand.substring(5));
                    ps.executeUpdate();
                    c.getItems().addItem(995, 10000000);
                    c.sendMessage("Thank you for voting.");
                } else {
                    c.sendMessage("The auth code is not valid!");
                }
            }
            ps.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return;
4

1 回答 1

0

确保您的班级有正确的左大括号和右大括号 { ... } 缺少大括号通常是导致此类错误的原因...

于 2013-10-04T02:23:10.043 回答