Fixed a memory leak in MySQL that would cause errors if users were

removed from the DB
This commit is contained in:
nossr50
2019-05-29 10:14:04 -07:00
parent 54eca5b8ba
commit 4795143fca
7 changed files with 43 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
@ -12,6 +13,7 @@ import org.bukkit.util.StringUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class McremoveCommand implements TabExecutor {
@Override
@ -24,7 +26,13 @@ public class McremoveCommand implements TabExecutor {
return true;
}
if (mcMMO.getDatabaseManager().removeUser(playerName)) {
UUID uuid = null;
if(Bukkit.getPlayer(playerName) != null) {
uuid = Bukkit.getPlayer(playerName).getUniqueId();
}
if (mcMMO.getDatabaseManager().removeUser(playerName, uuid)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
}
else {