public final void changeGuildLeader(final int cid) {
        if (changeRank(cid, 1) && changeRank(leader, 2)) {
            if (allianceid > 0) {
                int aRank = getMGC(leader).getAllianceRank();
                if (aRank == 1) {
                    World.Alliance.changeAllianceLeader(allianceid, cid, true);
                } else {
                    changeARank(cid, aRank);
                }
                changeARank(leader, 3);
            }
            broadcast(GuildPacket.guildLeaderChanged(id, leader, cid, allianceid));
            this.leader = cid;
            try {
                Connection con = DatabaseConnection.getConnection();
                try (PreparedStatement ps = con.prepareStatement("UPDATE guilds SET leader = ? WHERE guildid = ?")) {
                    ps.setInt(1, cid);
                    ps.setInt(2, id);
                    ps.execute();
                }
            } catch (SQLException e) {
                System.err.println("Saving leaderid ERROR" + e);
            }
        }
    }