mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Make /rankinfo use relative timespans, also /time will now show server date.
This commit is contained in:
parent
174cd681f8
commit
f535973acd
@ -34,6 +34,8 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
Player.Message(p, "&1Rank information for " + target);
|
||||
bool found = false;
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
foreach (string line in Server.RankInfo.Find(target)) {
|
||||
string[] parts = line.Split(' ');
|
||||
Group newRank = Group.Find(parts[7]), oldRank = Group.Find(parts[8]);
|
||||
@ -44,12 +46,14 @@ namespace MCGalaxy.Commands {
|
||||
int days = Convert.ToInt32(parts[4]), months = Convert.ToInt32(parts[5]);
|
||||
int years = Convert.ToInt32(parts[6]);
|
||||
DateTime timeRanked = new DateTime(years, months, days, hours, minutes, 0);
|
||||
|
||||
string reason = parts.Length <= 9 ? "(no reason given)" :
|
||||
CP437Reader.ConvertToRaw(parts[9].Replace("%20", " "));
|
||||
TimeSpan delta = now - timeRanked;
|
||||
|
||||
Player.Message(p, "&aFrom {0} &ato {1} &aon %S{2}",
|
||||
oldRankName, newRankName, timeRanked);
|
||||
Player.Message(p, "&aBy %S{0} &a, reason: %S{1}", parts[1], reason);
|
||||
Player.Message(p, "&aFrom {0} &ato {1} &a{2} ago",
|
||||
oldRankName, newRankName, delta.Shorten(true, false));
|
||||
Player.Message(p, "&aBy %S{0}&a, reason: %S{1}", parts[1], reason);
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
|
@ -29,8 +29,7 @@ namespace MCGalaxy.Commands {
|
||||
public CmdTime() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string time = DateTime.Now.ToString("HH:mm:ss"); //DateTime.Now.ToString();
|
||||
Player.Message(p, "Server time is " + time);
|
||||
Player.Message(p, "Server time: {0:HH:mm:ss} on {0:d}", DateTime.Now);
|
||||
if (!Server.zombie.Running) return;
|
||||
|
||||
int delta = (int)(Server.zombie.RoundEnd - DateTime.UtcNow).TotalSeconds;
|
||||
|
Loading…
x
Reference in New Issue
Block a user