From 01345a5dc43a001c52738ccab72157b0e0fecefc Mon Sep 17 00:00:00 2001 From: bm01 Date: Fri, 8 Jun 2012 20:03:02 +0200 Subject: [PATCH] Fixed /mcremove on existing PlayerProfile --- Changelog.txt | 1 + .../nossr50/commands/mc/McremoveCommand.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 0d5c74e60..f74bc11aa 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -11,6 +11,7 @@ Version 1.3.09 + Added compatibility with AntiCheat (Which I highly recommend to prevent cheating) + Added several permission nodes to give individual users special perks (Double/Triple/Quadruple XP) + Added API for plugins to add custom tools directly via Spout - repair / abilities do not work ATM + = Fixed /mcremove being applied only after a reload = Fixed Archery PVE disablement not working properly = Fixed possible NPE when a projectile is shot by a dispenser or doesn't have any shooter = Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing) 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 f946c822d..1431d9b02 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -5,6 +5,7 @@ import java.io.FileReader; import java.io.FileWriter; import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -13,6 +14,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Users; @@ -96,12 +98,15 @@ public class McremoveCommand implements CommandExecutor { } //Force PlayerProfile stuff to update - Player player = plugin.getServer().getPlayer(playerName); + OfflinePlayer player = plugin.getServer().getOfflinePlayer(playerName); + PlayerProfile playerProfile = Users.getProfile(player); - //TODO fix this - if (player != null /*&& Users.getProfiles().containsKey(player)*/) { - Users.removeUser(player); - Users.addUser(player); + if (playerProfile != null) { + Users.removeUser(playerProfile); + + if (player.isOnline()) { + Users.addUser((Player) player); + } } return true;