Made /skin and /model use PlayersExtList.

This commit is contained in:
UnknownShadow200 2016-06-09 16:42:29 +10:00
parent c87c60fa35
commit f8f54b278e
7 changed files with 20 additions and 27 deletions

View File

@ -81,9 +81,10 @@ namespace MCGalaxy.Commands.CPE {
else
Player.Message(who, "Changed your own model to a &c" + model);
Server.Models.DeleteStartsWith(who.name + " ");
Server.models.Remove(who.name);
if (model != "humanoid")
Server.Models.Append(who.name + " " + model);
Server.models.Add(who.name, model);
Server.models.Save();
}
}

View File

@ -17,7 +17,6 @@
*/
namespace MCGalaxy.Commands.CPE {
public sealed class CmdReachDistance : Command {
public override string name { get { return "reachdistance"; } }

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands.CPE {
public override void Use(Player p, string message) {
if (CheckSuper(p, message, "player or bot name")) return;
message = p.truename;
if (message == "") message = p.truename;
Player who = p;
PlayerBot pBot = null;
@ -73,9 +73,10 @@ namespace MCGalaxy.Commands.CPE {
else
Player.Message(who, "Changed your own skin to &c" + skin);
Server.Skins.DeleteStartsWith(who.name + " ");
Server.skins.Remove(who.name);
if (skin != who.truename)
Server.Skins.Append(who.name + " " + skin);
Server.skins.Add(who.name, skin);
Server.skins.Save();
}
}

View File

@ -602,24 +602,16 @@ namespace MCGalaxy {
}
void LoadCpeData() {
try {
foreach (string line in Server.Skins.Find(name)) {
string[] parts = line.Split(trimChars, 2);
if (parts.Length == 1) continue;
skinName = parts[1];
}
} catch (Exception ex) {
Server.ErrorLog(ex);
string line = Server.skins.Find(name);
if (line != null) {
int sep = line.IndexOf(' ');
if (sep >= 0) skinName = line.Substring(sep + 1);
}
try {
foreach (string line in Server.Models.Find(name)) {
string[] parts = line.Split(trimChars, 2);
if (parts.Length == 1) continue;
model = parts[1];
}
} catch (Exception ex) {
Server.ErrorLog(ex);
line = Server.models.Find(name);
if (line != null) {
int sep = line.IndexOf(' ');
if (sep >= 0) model = line.Substring(sep + 1);
}
}

View File

@ -97,7 +97,7 @@ namespace MCGalaxy {
int space = line.IndexOf(' ');
string name = space >= 0 ? line.Substring(0, space) : line;
list.players.Add(line);
list.players.Add(name);
}
}
return list;

View File

@ -72,6 +72,8 @@ namespace MCGalaxy {
frozen = PlayerList.Load("frozen.txt");
hidden = PlayerList.Load("hidden.txt");
jailed = PlayerExtList.Load("ranks/jailed.txt");
models = PlayerExtList.Load("extra/models.txt");
skins = PlayerExtList.Load("extra/skins.txt");
foreach (Group grp in Group.GroupList)
grp.playerList = PlayerList.Load(grp.fileName);

View File

@ -70,8 +70,6 @@ namespace MCGalaxy
public static PlayersFile RankInfo = new PlayersFile("text/rankinfo.txt");
public static PlayersFile TempRanks = new PlayersFile("text/tempranks.txt");
public static PlayersFile Notes = new PlayersFile("text/notes.txt");
public static PlayersFile Skins = new PlayersFile("extra/skins.txt");
public static PlayersFile Models = new PlayersFile("extra/models.txt");
public static Version Version { get { return System.Reflection.Assembly.GetAssembly(typeof(Server)).GetName().Version; } }
public static string VersionString {
@ -100,7 +98,7 @@ namespace MCGalaxy
public static bool ServerSetupFinished = false;
public static Auto_CTF ctf = null;
public static PlayerList bannedIP, whiteList, ircControllers, muted, ignored, frozen, hidden;
public static PlayerExtList jailed;
public static PlayerExtList jailed, models, skins;
public static readonly List<string> Devs = new List<string>(), Mods = new List<string>();