mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-08-03 19:36:14 -04:00
Fix /skin [name] [skin] temp changing your own skin
This commit is contained in:
parent
35f59dce99
commit
f92d78bb6b
@ -25,13 +25,23 @@ namespace MCGalaxy
|
|||||||
{
|
{
|
||||||
public static class PlayerActions
|
public static class PlayerActions
|
||||||
{
|
{
|
||||||
/// <summary>
|
public static void SetSkin(string target, string skin) {
|
||||||
/// Changes the skin of this player. Does not save the skin change for future logins -- see PlayerOperations.SetSkin for that.
|
string rawName = Server.ToRawUsername(target);
|
||||||
/// </summary>
|
|
||||||
public static void SetSkin(Player p, string skin) {
|
if (skin == rawName) {
|
||||||
p.SkinName = skin;
|
Server.skins.Remove(target);
|
||||||
Entities.GlobalRespawn(p);
|
} 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, string name) { return ChangeMap(p, null, name); }
|
||||||
public static bool ChangeMap(Player p, Level lvl) { return ChangeMap(p, lvl, null); }
|
public static bool ChangeMap(Player p, Level lvl) { return ChangeMap(p, lvl, null); }
|
||||||
|
@ -31,7 +31,7 @@ namespace MCGalaxy
|
|||||||
/// Attempts to set the skin for the given target, which will be saved across play sessions.
|
/// Attempts to set the skin for the given target, which will be saved across play sessions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetSkin(Player p, string target, string skin) {
|
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);
|
skin = HttpUtil.FilterSkin(p, skin, rawName);
|
||||||
if (skin == null) return;
|
if (skin == null) return;
|
||||||
|
|
||||||
@ -42,14 +42,7 @@ namespace MCGalaxy
|
|||||||
MessageAction(p, target, who, "λACTOR &Schanged λTARGET skin to &c" + skin);
|
MessageAction(p, target, who, "λACTOR &Schanged λTARGET skin to &c" + skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (who != null) PlayerActions.SetSkin(p, skin);
|
PlayerActions.SetSkin(target, skin);
|
||||||
|
|
||||||
if (skin == rawName) {
|
|
||||||
Server.skins.Remove(target);
|
|
||||||
} else {
|
|
||||||
Server.skins.Update(target, skin);
|
|
||||||
}
|
|
||||||
Server.skins.Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Attempts to change the login message of the target player </summary>
|
/// <summary> Attempts to change the login message of the target player </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user