private static final void deleteBBSThread(final MapleClient c, final int localthreadid) {
	if (c.getPlayer().getGuildId() <= 0) {
	    return;
	}
	Connection con = DatabaseConnection.getConnection();
	try {
	    PreparedStatement ps = con.prepareStatement("SELECT threadid, postercid FROM bbs_threads WHERE guildid = ? AND localthreadid = ?");
	    ps.setInt(1, c.getPlayer().getGuildId());
	    ps.setInt(2, localthreadid);
	    ResultSet threadRS = ps.executeQuery();

	    if (!threadRS.next()) {
		threadRS.close();
		ps.close();
		return; // thread no longer exists, deleted?
	    }
	    if (c.getPlayer().getId() != threadRS.getInt("postercid") && c.getPlayer().getGuildRank() > 2) {
		threadRS.close();
		ps.close();
		return; // [hax] deleting a thread that he didn't make
	    }
	    int threadid = threadRS.getInt("threadid");
	    threadRS.close();
	    ps.close();

	    ps = con.prepareStatement("DELETE FROM bbs_replies WHERE threadid = ?");
	    ps.setInt(1, threadid);
	    ps.execute();
	    ps.close();

	    ps = con.prepareStatement("DELETE FROM bbs_threads WHERE threadid = ?");
	    ps.setInt(1, threadid);
	    ps.execute();
	    ps.close();
	} catch (SQLException se) {
	    System.err.println("SQLException: " + se.getLocalizedMessage() + se);
	}
    }