2
0
Эх сурвалжийг харах

Removed unused OfflinePlayer from PlayerProfile

bm01 13 жил өмнө
parent
commit
54011fdeb7

+ 1 - 1
src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java

@@ -60,7 +60,7 @@ public class InspectCommand implements CommandExecutor {
                     return true;
                 }
 
-                profile = new PlayerProfile(target, false); //Temporary Profile
+                profile = new PlayerProfile(target.getName(), false); //Temporary Profile
 
                 if (!profile.isLoaded()) {
                     sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));

+ 1 - 1
src/main/java/com/gmail/nossr50/commands/general/MmoeditCommand.java

@@ -104,7 +104,7 @@ public class MmoeditCommand implements CommandExecutor {
                 return true;
             }
             else {
-                profile = new PlayerProfile(modifiedPlayer, false); //Temporary Profile
+                profile = new PlayerProfile(modifiedPlayer.getName(), false); //Temporary Profile
 
                 if (!profile.isLoaded()) {
                     sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));

+ 3 - 2
src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java

@@ -22,9 +22,10 @@ public class McMMOPlayer {
     private Party invite;
 
     public McMMOPlayer (Player player) {
+        String playerName = player.getName();
         this.player = player;
-        this.profile = new PlayerProfile(player, true);
-        this.party = PartyManager.getInstance().getPlayerParty(player.getName());
+        this.profile = new PlayerProfile(playerName, true);
+        this.party = PartyManager.getInstance().getPlayerParty(playerName);
     }
 
     /**

+ 4 - 18
src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java

@@ -7,9 +7,6 @@ import java.io.FileWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import org.bukkit.OfflinePlayer;
-import org.bukkit.entity.Player;
-
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.SpoutConfig;
@@ -19,6 +16,8 @@ import com.gmail.nossr50.util.Misc;
 
 public class PlayerProfile {
 
+    private String playerName;
+    
     /* HUD */
     private SpoutHud spoutHud;
 
@@ -51,14 +50,10 @@ public class PlayerProfile {
     HashMap<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>();
     HashMap<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
 
-    private OfflinePlayer player;
-    private String playerName;
     private final static String location = mcMMO.usersFile;
 
-    public PlayerProfile(OfflinePlayer player, boolean addNew) {
-        this.player = player;
-        this.playerName = player.getName();
-
+    public PlayerProfile(String playerName, boolean addNew) {
+        this.playerName = playerName;
         party = PartyManager.getInstance().getPlayerParty(playerName);
 
         for (AbilityType abilityType : AbilityType.values()) {
@@ -84,19 +79,10 @@ public class PlayerProfile {
         }
     }
 
-//    public Player getPlayer() {
-//        return player;
-//    }
-
     public String getPlayerName() {
         return playerName;
     }
 
-    public void setPlayer(Player player) {
-        this.player = player;
-        this.playerName = player.getName();
-    }
-
     public boolean loadMySQL() {
         userId = mcMMO.database.getInt("SELECT id FROM " + Config.getInstance().getMySQLTablePrefix() + "users WHERE user = '" + playerName + "'");