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) { if (!p.level.Config.UseBlockDB) {
Player.Message(p, "BlockDB is disabled here, &cyou will not be able to /undo or /redo"); 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, 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 bool showPortals, showMBs;
public string prevMsg = ""; public string prevMsg = "";
internal bool showedWelcome;
//Movement //Movement
internal int oldIndex = -1, lastWalkthrough = -1, startFallY = -1, lastFallY = -1; internal int oldIndex = -1, lastWalkthrough = -1, startFallY = -1, lastFallY = -1;

View File

@ -20,10 +20,11 @@ using MCGalaxy.Commands;
using MCGalaxy.DB; using MCGalaxy.DB;
using MCGalaxy.Events.PlayerEvents; using MCGalaxy.Events.PlayerEvents;
using MCGalaxy.Games; using MCGalaxy.Games;
using MCGalaxy.Maths;
using MCGalaxy.Network; using MCGalaxy.Network;
using MCGalaxy.SQL; using MCGalaxy.SQL;
using MCGalaxy.Tasks; using MCGalaxy.Tasks;
using MCGalaxy.Maths; using MCGalaxy.Util;
namespace MCGalaxy { namespace MCGalaxy {
public partial class Player : IDisposable { public partial class Player : IDisposable {
@ -78,6 +79,7 @@ namespace MCGalaxy {
LastLogin = DateTime.Now; LastLogin = DateTime.Now;
TotalTime = TimeSpan.FromSeconds(1); TotalTime = TimeSpan.FromSeconds(1);
GetPlayerStats(); GetPlayerStats();
ShowWelcome();
Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero); Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero);
CheckState(); CheckState();
@ -89,7 +91,7 @@ namespace MCGalaxy {
Directory.CreateDirectory("players"); Directory.CreateDirectory("players");
PlayerDB.Load(this); PlayerDB.Load(this);
Game.Team = Team.FindTeam(this); Game.Team = Team.FindTeam(this);
SetPrefix(); SetPrefix();
LoadCpeData(); LoadCpeData();
if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank) if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank)
@ -105,7 +107,7 @@ namespace MCGalaxy {
} }
OnPlayerConnectEvent.Call(this); OnPlayerConnectEvent.Call(this);
if (cancellogin) { cancellogin = false; return; } if (cancellogin) { cancellogin = false; return; }
string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this); string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this);
if (hidden) joinm = "&8(hidden)" + joinm; if (hidden) joinm = "&8(hidden)" + joinm;
@ -127,7 +129,7 @@ namespace MCGalaxy {
SendMessage("&cPlease complete admin verification with %T/Pass [Password]!"); SendMessage("&cPlease complete admin verification with %T/Pass [Password]!");
} }
try { try {
if (group.CanExecute("inbox") && Database.TableExists("Inbox" + name) ) { if (group.CanExecute("inbox") && Database.TableExists("Inbox" + name) ) {
using (DataTable table = Database.Backend.GetRows("Inbox" + name, "*")) { using (DataTable table = Database.Backend.GetRows("Inbox" + name, "*")) {
if (table.Rows.Count > 0) if (table.Rows.Count > 0)
@ -159,7 +161,20 @@ namespace MCGalaxy {
Loading = false; Loading = false;
} }
unsafe static byte NextFreeId() { 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]; byte* used = stackalloc byte[256];
for (int i = 0; i < 256; i++) for (int i = 0; i < 256; i++)
used[i] = 0; used[i] = 0;