Browse Source

Fixed /mcremove on existing PlayerProfile

bm01 13 years ago
parent
commit
01345a5dc4
2 changed files with 11 additions and 5 deletions
  1. 1 0
      Changelog.txt
  2. 10 5
      src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java

+ 1 - 0
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)

+ 10 - 5
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;