Created
June 8, 2013 05:34
-
-
Save riking/5734179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void purgePowerlessUsers() { | |
mcMMO.p.getLogger().info("Purging powerless users..."); | |
try { | |
// This does the deleting and returns the usernames of who we deleted | |
ResultSet result = SQLStatements.getInstance().getStatement("powerlessPurge").executeQuery(); | |
int purgeCount = 0; | |
while (result.next()) { | |
Misc.profileCleanup(result.getString(0)); | |
purgeCount++; | |
} | |
mcMMO.p.getLogger().info("Purged " + purgeCount + " users from the database."); | |
} catch (SQLException e) { | |
printErrors(e); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addStatement("powerlessPurge", | |
"SELECT u.user FROM OLD TABLE (" + | |
"DELETE FROM u, e, h, s, c USING {TAB}users u " + | |
"JOIN {TAB}experience e ON (u.id = e.user_id) " + | |
"JOIN {TAB}huds h ON (u.id = h.user_id) " + | |
"JOIN {TAB}skills s ON (u.id = s.user_id) " + | |
"JOIN {TAB}cooldowns c ON (u.id = c.user_id) " + | |
"WHERE (s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing) = 0" + | |
")"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment