From d3dedca4a8c12c11f5b3496618d52401bab27b20 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 19 Apr 2012 18:53:03 -0700 Subject: [PATCH] mcremove is smarter about dealing with MySQL now --- Changelog.txt | 1 + .../com/gmail/nossr50/commands/mc/McremoveCommand.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 0e1b3b367..74f6a8fa4 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -19,6 +19,7 @@ Version 1.3.06-dev = Fixed bug with Nether Wart not awarding XP = Fixed bug with fishing treasures when treasures list is empty = Fixed bug with only getting one level when there was enough XP for multiple levels. + ! Changed mcremove to check for users in the MySQL DB before sending queries to remove them ! Changed how the tree feller threshold worked for the better ! Changed mcremove to no longer kick players when they are removed from database ! Changed mcremove to work on offline users for FlatFile diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java index 4cdefe196..6f7fe6de6 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -44,8 +44,10 @@ public class McremoveCommand implements CommandExecutor { //If the server is using MySQL if(LoadProperties.useMySQL) { - int userId = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'"); + int userId = 0; + userId = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'"); + if(userId > 0) { //Remove user from tables mcMMO.database.write("DELETE FROM " +LoadProperties.MySQLdbName+"." @@ -73,6 +75,9 @@ public class McremoveCommand implements CommandExecutor { +LoadProperties.MySQLtablePrefix+"experience.user_id="+userId); sender.sendMessage("User "+playerName+" removed from MySQL DB!"); //TODO: Needs more locale. + } else { + sender.sendMessage("Unabled to find player named "+playerName+" in the database!"); + } } else { if(removeFlatFileUser(playerName)) { sender.sendMessage(ChatColor.GREEN+"[mcMMO] It worked! User was removed.");