mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 06:43:25 -04:00
Reduce verbosity of /rankinfo, also can create non 128x64x128 maps in /os map add now.
This commit is contained in:
parent
16997d8ed5
commit
8d8c1aafa8
@ -35,7 +35,7 @@ namespace MCGalaxy.Commands
|
|||||||
p.SendMessage("Your rank is set to have 0 overseer maps. Therefore, you may not use overseer.");
|
p.SendMessage("Your rank is set to have 0 overseer maps. Therefore, you may not use overseer.");
|
||||||
if (message == "") { Help(p); return; }
|
if (message == "") { Help(p); return; }
|
||||||
|
|
||||||
string[] parts = message.Split(' ');
|
string[] parts = message.Split(trimChars, 3);
|
||||||
string cmd = parts[0].ToUpper();
|
string cmd = parts[0].ToUpper();
|
||||||
string arg = parts.Length > 1 ? parts[1].ToUpper() : "";
|
string arg = parts.Length > 1 ? parts[1].ToUpper() : "";
|
||||||
string arg2 = parts.Length > 2 ? parts[2] : "";
|
string arg2 = parts.Length > 2 ? parts[2] : "";
|
||||||
@ -182,10 +182,13 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == "" || MapGen.IsRecognisedFormat(value)) {
|
string[] args = value.Split(' ');
|
||||||
string type = value == "" ? "flat" : value;
|
bool noTypeArg = value == "" || args.Length == 3;
|
||||||
|
string type = noTypeArg ? "flat" : args[args.Length - 1];
|
||||||
|
if (MapGen.IsRecognisedFormat(type)) {
|
||||||
Player.SendMessage(p, "Creating a new map for you: " + level);
|
Player.SendMessage(p, "Creating a new map for you: " + level);
|
||||||
Command.all.Find("newlvl").Use(p, level + " 128 64 128 " + type);
|
string cmdArgs = args.Length == 1 ? "128 64 128 flat" : (noTypeArg ? value + " flat" : value);
|
||||||
|
Command.all.Find("newlvl").Use(p, level + " " + cmdArgs);
|
||||||
} else {
|
} else {
|
||||||
Player.SendMessage(p, "Invalid map type was specified.");
|
Player.SendMessage(p, "Invalid map type was specified.");
|
||||||
MapGen.PrintValidFormats(p);
|
MapGen.PrintValidFormats(p);
|
||||||
@ -250,7 +253,8 @@ namespace MCGalaxy.Commands
|
|||||||
Player.SendMessage(p, "Your texture has been updated!");
|
Player.SendMessage(p, "Your texture has been updated!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Player.SendMessage(p, "/os map add [type - default is flat] -- Creates your map");
|
Player.SendMessage(p, "/os map add [type - default is flat] -- Creates your map (128x64x128)");
|
||||||
|
Player.SendMessage(p, "/os map add [width] [height] [length] [type] -- Creates your map");
|
||||||
Player.SendMessage(p, "/os map physics -- Sets the physics on your map.");
|
Player.SendMessage(p, "/os map physics -- Sets the physics on your map.");
|
||||||
Player.SendMessage(p, "/os map delete -- Deletes your map");
|
Player.SendMessage(p, "/os map delete -- Deletes your map");
|
||||||
Player.SendMessage(p, "/os map save -- Saves your map");
|
Player.SendMessage(p, "/os map save -- Saves your map");
|
||||||
|
@ -29,7 +29,6 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (message != "") { Help(p); return; }
|
if (message != "") { Help(p); return; }
|
||||||
Chat.GlobalMessageOps(p.color + p.DisplayName + " %Sused &b/crashserver");
|
|
||||||
int code = p.random.Next(int.MinValue, int.MaxValue);
|
int code = p.random.Next(int.MinValue, int.MaxValue);
|
||||||
string msg = "Server crash! Error code 0x" + Convert.ToString(code, 16).ToUpper();
|
string msg = "Server crash! Error code 0x" + Convert.ToString(code, 16).ToUpper();
|
||||||
p.LeaveServer(msg, msg);
|
p.LeaveServer(msg, msg);
|
||||||
|
@ -34,27 +34,24 @@ namespace MCGalaxy.Commands {
|
|||||||
Player who = PlayerInfo.Find(message);
|
Player who = PlayerInfo.Find(message);
|
||||||
string target = who == null ? message : who.name;
|
string target = who == null ? message : who.name;
|
||||||
|
|
||||||
Player.SendMessage(p, "&1Rank Information of " + target);
|
Player.SendMessage(p, "&1Rank information for " + target);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach (string line in File.ReadAllLines("text/rankinfo.txt")) {
|
foreach (string line in File.ReadAllLines("text/rankinfo.txt")) {
|
||||||
if (!line.Contains(target))
|
if (!line.CaselessStarts(target)) continue;
|
||||||
continue;
|
|
||||||
string[] parts = line.Split(' ');
|
string[] parts = line.Split(' ');
|
||||||
if (parts[0] != target) continue;
|
if (!parts[0].CaselessEq(target)) continue;
|
||||||
|
|
||||||
Group newRank = Group.Find(parts[7]), oldRank = Group.Find(parts[8]);
|
Group newRank = Group.Find(parts[7]), oldRank = Group.Find(parts[8]);
|
||||||
int minutes = Convert.ToInt32(parts[2]), hours = Convert.ToInt32(parts[3]);
|
int minutes = Convert.ToInt32(parts[2]), hours = Convert.ToInt32(parts[3]);
|
||||||
int days = Convert.ToInt32(parts[4]), months = Convert.ToInt32(parts[5]);
|
int days = Convert.ToInt32(parts[4]), months = Convert.ToInt32(parts[5]);
|
||||||
int years = Convert.ToInt32(parts[6]);
|
int years = Convert.ToInt32(parts[6]);
|
||||||
DateTime timeRanked = new DateTime(years, months, days, hours, minutes, 0);
|
DateTime timeRanked = new DateTime(years, months, days, hours, minutes, 0);
|
||||||
string reason = parts.Length <= 9 ? null :
|
string reason = parts.Length <= 9 ? "(no reason given)" :
|
||||||
CP437Reader.ConvertToRaw(parts[9].Replace("%20", " "));
|
CP437Reader.ConvertToRaw(parts[9].Replace("%20", " "));
|
||||||
|
|
||||||
Player.SendMessage(p, "&aRank changed from: " + oldRank.color + oldRank.name
|
Player.SendMessage(p, "&aFrom " + oldRank.color + oldRank.name
|
||||||
+ " &ato " + newRank.color + newRank.name);
|
+ " &ato " + newRank.color + newRank.name + " &aon %S" + timeRanked);
|
||||||
Player.SendMessage(p, "&aRanked by: %S" + parts[1] + " &aon %S" + timeRanked);
|
Player.SendMessage(p, "&aBy %S" + parts[1] + " &awith reason: %S" + reason);
|
||||||
if (reason != null)
|
|
||||||
Player.SendMessage(p, "&aRank reason: %S" + reason);
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user