mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Possible fix for NPE on save
This commit is contained in:
@ -1,23 +1,20 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
|
||||
public class RemoveProfileFromMemoryTask implements Runnable {
|
||||
private Player player;
|
||||
private String playerName = null;
|
||||
|
||||
public RemoveProfileFromMemoryTask(Player player) {
|
||||
this.player = player;
|
||||
public RemoveProfileFromMemoryTask(String playerName) {
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String playerName = player.getName();
|
||||
//Check if the profile still exists (stuff like MySQL reconnection removes profiles)
|
||||
if (Users.players.containsKey(playerName.toLowerCase())) {
|
||||
Users.getProfileByName(playerName).save(); //We save here so players don't quit/reconnect to cause lag
|
||||
Users.removeUserByName(playerName);
|
||||
Users.getProfileByName(playerName.toLowerCase()).save(); //We save here so players don't quit/reconnect to cause lag
|
||||
Users.removeUserByName(playerName.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user