diff --git a/MCGalaxy/Database/PlayerData.cs b/MCGalaxy/Database/PlayerData.cs index 415031bb7..d482ccb9e 100644 --- a/MCGalaxy/Database/PlayerData.cs +++ b/MCGalaxy/Database/PlayerData.cs @@ -71,28 +71,29 @@ namespace MCGalaxy.DB { } } - internal static void Apply(PlayerData data, Player p) { - p.TimesVisited = data.Logins + 1; - p.TotalTime = data.TotalTime; - p.DatabaseID = data.DatabaseID; - p.FirstLogin = data.FirstLogin; + /// Initialises the given player's stats from this instance. + public void ApplyTo(Player p) { + p.TimesVisited = Logins + 1; + p.TotalTime = TotalTime; + p.DatabaseID = DatabaseID; + p.FirstLogin = FirstLogin; - p.title = data.Title; - p.titlecolor = data.TitleColor; + p.title = Title; + p.titlecolor = TitleColor; - string col = data.Color; + string col = Color; if (col.Length == 0) col = p.group.Color; p.SetColor(col); - p.TotalModified = data.TotalModified; - p.TotalDrawn = data.TotalDrawn; - p.TotalPlaced = data.TotalPlaced; - p.TotalDeleted = data.TotalDeleted; + p.TotalModified = TotalModified; + p.TotalDrawn = TotalDrawn; + p.TotalPlaced = TotalPlaced; + p.TotalDeleted = TotalDeleted; - p.TimesDied = data.Deaths; - p.TotalMessagesSent = data.Messages; - p.money = data.Money; - p.TimesBeenKicked = data.Kicks; + p.TimesDied = Deaths; + p.TotalMessagesSent = Messages; + p.money = Money; + p.TimesBeenKicked = Kicks; } internal static PlayerData Parse(IDataRecord record) { diff --git a/MCGalaxy/Player/Player.Login.cs b/MCGalaxy/Player/Player.Login.cs index 18750e65e..b1d9dc1a4 100644 --- a/MCGalaxy/Player/Player.Login.cs +++ b/MCGalaxy/Player/Player.Login.cs @@ -217,7 +217,7 @@ namespace MCGalaxy { Chat.MessageFrom(this, "λNICK %Shas connected for the first time!"); Message("Welcome " + ColoredName + "%S! This is your first visit."); } else { - PlayerData.Apply((PlayerData)raw, this); + ((PlayerData)raw).ApplyTo(this); Message("Welcome back " + FullName + "%S! You've been here " + TimesVisited + " times!"); } gotSQLData = true;