Minor cleanup in /centre, also don't create a file for the player's nickname until they actually set it.

This commit is contained in:
UnknownShadow200 2016-03-29 22:47:34 +11:00
parent e827023e9d
commit d96c282a03
5 changed files with 10 additions and 26 deletions

View File

@ -266,9 +266,9 @@ namespace MCGalaxy.Commands {
return;
}
if (p.lastchatroomglobal.AddSeconds(30) < DateTime.Now) {
if (p.lastchatroomglobal.AddSeconds(30) < DateTime.UtcNow) {
Chat.GlobalChatRoom(p, message, true);
p.lastchatroomglobal = DateTime.Now;
p.lastchatroomglobal = DateTime.UtcNow;
} else {
Player.SendMessage(p, "Sorry, you must wait 30 seconds in between each global chatroom message!!");
}

View File

@ -19,23 +19,15 @@ namespace MCGalaxy.Commands {
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
p.centerstart[0] = x;
p.centerstart[1] = y;
p.centerstart[2] = z;
p.blockchangeObject = new Vec3U16(x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
p.centerend[0] = x;
p.centerend[1] = y;
p.centerend[2] = z;
int xCen = (int)((p.centerstart[0] + p.centerend[0]) / 2);
int yCen = (int)((p.centerstart[1] + p.centerend[1]) / 2);
int zCen = (int)((p.centerstart[2] + p.centerend[2]) / 2);
p.level.UpdateBlock(p, (ushort)xCen, (ushort)yCen, (ushort)zCen, (byte)Block.goldsolid, 0);
Vec3U16 start = (Vec3U16)p.blockchangeObject;
int xCen = (start.X + x) / 2, yCen = (start.Y + y) / 2, zCen = (start.Z + z) / 2;
p.level.UpdateBlock(p, (ushort)xCen, (ushort)yCen, (ushort)zCen, Block.goldsolid, 0);
Player.SendMessage(p, "A gold block was placed at (" + xCen + ", " + yCen + ", " + zCen + ").");
}

View File

@ -10,9 +10,7 @@ namespace MCGalaxy {
static char[] trimChars = {'='};
public static bool Load( Player p ) {
if (!File.Exists("players/" + p.name + "DB.txt")) {
Save(p); return false;
}
if (!File.Exists("players/" + p.name + "DB.txt")) return false;
foreach (string line in File.ReadAllLines( "players/" + p.name + "DB.txt")) {
if (string.IsNullOrEmpty(line) || line[0] == '#') continue;
@ -22,7 +20,6 @@ namespace MCGalaxy {
if (key.CaselessEq("nick"))
p.DisplayName = value;
p.timeLogged = DateTime.Now;
}
p.SetPrefix();
return true;

View File

@ -466,6 +466,7 @@ namespace MCGalaxy {
if (!Directory.Exists("players"))
Directory.CreateDirectory("players");
timeLogged = DateTime.Now;
PlayerDB.Load(this);
Game.Team = Team.FindTeam(this);
SetPrefix();

View File

@ -199,10 +199,6 @@ namespace MCGalaxy {
public int[] copyoffset = new int[3] { 0, 0, 0 };
public ushort[] copystart = new ushort[3] { 0, 0, 0 };
//Center
public int[] centerstart = new int[3] { 0, 0, 0 };
public int[] centerend = new int[3] { 0, 0, 0 };
// GlobalBlock
internal int gbStep = 0, gbTargetId = 0;
internal BlockDefinition gbBlock;
@ -287,10 +283,8 @@ namespace MCGalaxy {
//Global Chat
public bool ignoreGlobalChat;
public bool loggedIn;
public bool InGlobalChat { get; set; }
public Dictionary<string, string> sounds = new Dictionary<string, string>();
public bool InGlobalChat;
public bool isDev, isMod;
public bool isStaff;
@ -436,7 +430,7 @@ namespace MCGalaxy {
if (showname) {
string referee = "";
if (from.Game.Referee)
referee = Colors.green + "[Referee] ";
referee = Colors.green + "[Ref] ";
message = referee + from.color + from.voicestring + from.color + from.prefix + from.DisplayName + ": %r&f" + message;
}