Fix chat tokens not working properly in welcome message.

This commit is contained in:
UnknownShadow200 2017-09-23 13:21:20 +10:00
parent b591b46ce6
commit f30759285d
3 changed files with 20 additions and 22 deletions

View File

@ -64,22 +64,6 @@ namespace MCGalaxy.Core {
if (!p.level.Config.UseBlockDB) {
Player.Message(p, "BlockDB is disabled here, &cyou will not be able to /undo or /redo");
}
ShowWelcome(p);
}
static void ShowWelcome(Player p) {
if (p.showedWelcome) return;
p.showedWelcome = true;
p.LastAction = DateTime.UtcNow;
TextFile welcomeFile = TextFile.Files["Welcome"];
try {
welcomeFile.EnsureExists();
string[] welcome = welcomeFile.GetText();
Player.MessageLines(p, welcome);
} catch (Exception ex) {
Logger.LogError(ex);
}
}
internal static void HandlePlayerClick(Player p, MouseButton button, MouseAction action, ushort yaw, ushort pitch,

View File

@ -182,7 +182,6 @@ namespace MCGalaxy {
public bool showPortals, showMBs;
public string prevMsg = "";
internal bool showedWelcome;
//Movement
internal int oldIndex = -1, lastWalkthrough = -1, startFallY = -1, lastFallY = -1;

View File

@ -20,10 +20,11 @@ using MCGalaxy.Commands;
using MCGalaxy.DB;
using MCGalaxy.Events.PlayerEvents;
using MCGalaxy.Games;
using MCGalaxy.Maths;
using MCGalaxy.Network;
using MCGalaxy.SQL;
using MCGalaxy.Tasks;
using MCGalaxy.Maths;
using MCGalaxy.Util;
namespace MCGalaxy {
public partial class Player : IDisposable {
@ -78,6 +79,7 @@ namespace MCGalaxy {
LastLogin = DateTime.Now;
TotalTime = TimeSpan.FromSeconds(1);
GetPlayerStats();
ShowWelcome();
Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero);
CheckState();
@ -159,6 +161,19 @@ namespace MCGalaxy {
Loading = false;
}
void ShowWelcome() {
LastAction = DateTime.UtcNow;
TextFile welcomeFile = TextFile.Files["Welcome"];
try {
welcomeFile.EnsureExists();
string[] welcome = welcomeFile.GetText();
Player.MessageLines(this, welcome);
} catch (Exception ex) {
Logger.LogError(ex);
}
}
unsafe static byte NextFreeId() {
byte* used = stackalloc byte[256];
for (int i = 0; i < 256; i++)