Fixed /mcremove

This commit is contained in:
bm01 2012-07-07 23:37:29 +02:00
parent 3c7bcb990e
commit 8c178869b7

View File

@ -15,7 +15,9 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SpoutHud;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
@ -100,16 +102,21 @@ public class McremoveCommand implements CommandExecutor {
} }
//Force PlayerProfile stuff to update //Force PlayerProfile stuff to update
OfflinePlayer player = plugin.getServer().getOfflinePlayer(playerName); McMMOPlayer mcmmoPlayer = Users.getPlayer(playerName);
PlayerProfile playerProfile = Users.getProfile(player);
if (playerProfile != null) { if (mcmmoPlayer != null) {
playerProfile.getSpoutHud().removeWidgets(); Player player = mcmmoPlayer.getPlayer();
Users.remove(player.getName()); SpoutHud spoutHud = mcmmoPlayer.getProfile().getSpoutHud();
if (spoutHud != null) {
spoutHud.removeWidgets();
}
Users.remove(playerName);
if (player.isOnline()) { if (player.isOnline()) {
Users.addUser((Player) player); Users.addUser(player);
SpoutStuff.reloadSpoutPlayer((Player) player); SpoutStuff.reloadSpoutPlayer(player);
} }
} }