public final void leaveGuild(final MapleGuildCharacter mgc) {
        lock.writeLock().lock();
        try {
            final Iterator<MapleGuildCharacter> itr = members.iterator();
            while (itr.hasNext()) {
                final MapleGuildCharacter mgcc = itr.next();

                if (mgcc.getId() == mgc.getId()) {
                    broadcast(GuildPacket.memberLeft(mgcc, true));
                    bDirty = true;
                    gainGP(mgcc.getGuildContribution() > 0 ? -mgcc.getGuildContribution() : -50);
                    members.remove(mgcc);
                    if (mgc.isOnline()) {
                        World.Guild.setGuildAndRank(mgcc.getId(), 0, 5, 0, 5);
                    } else {
                        setOfflineGuildStatus((short) 0, (byte) 5, 0, (byte) 5, mgcc.getId());
                    }
                    break;
                }
            }

        } finally {
            lock.writeLock().unlock();
        }
        if (bDirty && allianceid > 0) {
            World.Alliance.sendGuild(allianceid);
        }
    }