Fix /skin [name] [skin] temp changing your own skin

This commit is contained in:
UnknownShadow200 2025-06-09 21:14:27 +10:00
parent 35f59dce99
commit f92d78bb6b
2 changed files with 18 additions and 15 deletions

View File

@ -25,13 +25,23 @@ namespace MCGalaxy
{
public static class PlayerActions
{
/// <summary>
/// Changes the skin of this player. Does not save the skin change for future logins -- see PlayerOperations.SetSkin for that.
/// </summary>
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); }

View File

@ -31,7 +31,7 @@ namespace MCGalaxy
/// Attempts to set the skin for the given target, which will be saved across play sessions.
/// </summary>
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);
}
/// <summary> Attempts to change the login message of the target player </summary>