diff --git a/MCGalaxy/Player/PlayerActions.cs b/MCGalaxy/Player/PlayerActions.cs
index 8cd6502f3..2f8d2b301 100644
--- a/MCGalaxy/Player/PlayerActions.cs
+++ b/MCGalaxy/Player/PlayerActions.cs
@@ -25,13 +25,23 @@ namespace MCGalaxy
{
public static class PlayerActions
{
- ///
- /// Changes the skin of this player. Does not save the skin change for future logins -- see PlayerOperations.SetSkin for that.
- ///
- public static void SetSkin(Player p, string skin) {
- p.SkinName = skin;
- Entities.GlobalRespawn(p);
+ public static void SetSkin(string target, string skin) {
+ string rawName = Server.ToRawUsername(target);
+
+ if (skin == rawName) {
+ Server.skins.Remove(target);
+ } else {
+ Server.skins.Update(target, skin);
+ }
+ Server.skins.Save();
+
+ Player who = PlayerInfo.FindExact(target);
+ if (who == null) return;
+
+ who.SkinName = skin;
+ Entities.GlobalRespawn(who);
}
+
public static bool ChangeMap(Player p, string name) { return ChangeMap(p, null, name); }
public static bool ChangeMap(Player p, Level lvl) { return ChangeMap(p, lvl, null); }
diff --git a/MCGalaxy/Player/PlayerOperations.cs b/MCGalaxy/Player/PlayerOperations.cs
index 7821b4e47..972333b98 100644
--- a/MCGalaxy/Player/PlayerOperations.cs
+++ b/MCGalaxy/Player/PlayerOperations.cs
@@ -31,7 +31,7 @@ namespace MCGalaxy
/// Attempts to set the skin for the given target, which will be saved across play sessions.
///
public static void SetSkin(Player p, string target, string skin) {
- string rawName = target.RemoveLastPlus();
+ string rawName = Server.ToRawUsername(target);
skin = HttpUtil.FilterSkin(p, skin, rawName);
if (skin == null) return;
@@ -42,14 +42,7 @@ namespace MCGalaxy
MessageAction(p, target, who, "λACTOR &Schanged λTARGET skin to &c" + skin);
}
- if (who != null) PlayerActions.SetSkin(p, skin);
-
- if (skin == rawName) {
- Server.skins.Remove(target);
- } else {
- Server.skins.Update(target, skin);
- }
- Server.skins.Save();
+ PlayerActions.SetSkin(target, skin);
}
/// Attempts to change the login message of the target player