Make many commands use Chat.MessageAll

This commit is contained in:
UnknownShadow200 2016-08-15 09:52:21 +10:00
parent 76acf539fc
commit 570bcf1088
20 changed files with 34 additions and 34 deletions

View File

@ -56,21 +56,21 @@ namespace MCGalaxy.Commands {
else SetNick(p, who, args);
}
static void SetBotNick(Player p, PlayerBot pBot, string[] args) {
static void SetBotNick(Player p, PlayerBot bot, string[] args) {
string newName = args.Length > 2 ? args[2] : "";
if (newName == "") {
pBot.DisplayName = pBot.name;
Player.GlobalMessage("Bot " + pBot.ColoredName + "'s %Sreverted to their original name.");
bot.DisplayName = bot.name;
Chat.MessageAll("Bot {0}'s %Sreverted to their original name.", bot.ColoredName);
} else {
string nameTag = newName.CaselessEq("empty") ? "" : newName;
if (newName.Length >= 30) { Player.Message(p, "Name must be under 30 letters."); return; }
Player.GlobalMessage("Bot " + pBot.ColoredName + "'s %Sname was set to " + nameTag + "%S.");
pBot.DisplayName = newName;
Chat.MessageAll("Bot {0}'s %Sname was set to {1}%S.", bot.ColoredName, nameTag);
bot.DisplayName = newName;
}
pBot.GlobalDespawn();
pBot.GlobalSpawn();
BotsFile.UpdateBot(pBot);
bot.GlobalDespawn();
bot.GlobalSpawn();
BotsFile.UpdateBot(bot);
}
static void SetNick(Player p, Player who, string[] args) {

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands {
if (message == "") { Help(p); return; }
message = Colors.EscapeColors(message);
Player.GlobalMessage(message);
Chat.MessageAll(message);
Server.IRC.Say(message);
}

View File

@ -57,7 +57,7 @@ namespace MCGalaxy.Commands
switch (Server.lava.Start(s.Length > 1 ? s[1] : ""))
{
case 0:
Player.GlobalMessage("Lava Survival has started! Join the fun with /ls go");
Chat.MessageAll("Lava Survival has started! Join the fun with /ls go");
return;
case 1:
Player.Message(p, "There is already an active Lava Survival game.");
@ -78,7 +78,7 @@ namespace MCGalaxy.Commands
switch (Server.lava.Stop())
{
case 0:
Player.GlobalMessage("Lava Survival has ended! We hope you had fun!");
Chat.MessageAll("Lava Survival has ended! We hope you had fun!");
return;
case 1:
Player.Message(p, "There isn't an active Lava Survival game.");

View File

@ -51,14 +51,14 @@ namespace MCGalaxy.Commands.Moderation {
string banMsg = null;
if (who == null) {
banMsg = target + " &f(offline) %Swas &8banned %Sby " + banner + "%S." + banReason;
Player.GlobalMessage(banMsg);
Chat.MessageAll(banMsg);
} else {
if (stealth) {
banMsg = who.ColoredName + " %Swas STEALTH &8banned %Sby " + banner + "%S." + banReason;
Chat.MessageOps(banMsg);
} else {
banMsg = who.ColoredName + " %Swas &8banned %Sby " + banner + "%S." + banReason;
Player.GlobalMessage(banMsg);
Chat.MessageAll(banMsg);
}
who.color = "";
}

View File

@ -52,10 +52,10 @@ namespace MCGalaxy.Commands.Moderation {
if (who == null) {
rankMsg = name + " &f(offline)%S's rank was set to " + newRank.ColoredName + "%S. (" + reason + "%S)";
Player.GlobalMessage(rankMsg);
Chat.MessageAll(rankMsg);
} else {
rankMsg = who.ColoredName + "%S's rank was set to " + newRank.ColoredName + "%S. (" + reason + "%S)";
Player.GlobalMessage(rankMsg);
Chat.MessageAll(rankMsg);
who.SendMessage("You are now ranked " + newRank.ColoredName + "%S, type /help for your new set of commands.");
}

View File

@ -69,7 +69,7 @@ namespace MCGalaxy.Commands {
}
static void Log(string message) {
Player.GlobalMessage("&4" + message);
Chat.MessageAll("&4" + message);
Server.s.Log(message);
}

View File

@ -37,7 +37,7 @@ namespace MCGalaxy.Commands.Moderation {
string warnedby = (p == null) ? "(console)" : p.ColoredName;
Player.GlobalMessage(warnedby + " %ewarned " + who.ColoredName + " %ebecause:");
Player.GlobalMessage("&c" + reason);
Chat.MessageAll("&c" + reason);
Server.IRC.Say(warnedby + " %ewarned " + who.ColoredName + " %efor: %c" + reason);
Server.s.Log(warnedby + " warned " + who.name);

View File

@ -63,7 +63,7 @@ namespace MCGalaxy.Commands {
LevelInfo.Loaded.Add(lvl);
if (p == null || !p.hidden)
Player.GlobalMessage("Level \"{0}\" loaded.", lvl.name);
Chat.MessageAll("Level \"{0}\" loaded.", lvl.name);
/*try {
Gui.Window.thisWindow.UpdatePlayerMapCombo();
Gui.Window.thisWindow.UnloadedlistUpdate();

View File

@ -42,7 +42,7 @@ namespace MCGalaxy.Commands {
Server.ErrorLog(ex);
}
}
Player.GlobalMessage("All levels have been saved.");
Chat.MessageAll("All levels have been saved.");
} else {
string[] args = message.Split(' ');
if (message == "") {
@ -67,10 +67,10 @@ namespace MCGalaxy.Commands {
if (restoreName == "") {
Server.s.Log("Backup " + num + " saved for " + lvl.name);
Player.GlobalMessage("Backup " + num + " saved for " + lvl.name);
Chat.MessageAll("Backup {0} saved for {1}", num, lvl.name);
} else {
Server.s.Log(lvl.name + " had a backup created named &b" + restoreName);
Player.GlobalMessage(lvl.name + " had a backup created named &b" + restoreName);
Chat.MessageAll("{1} had a backup created named &b{0}", restoreName, lvl.name);
}
}

View File

@ -43,7 +43,7 @@ namespace MCGalaxy.Commands
cmd.Use(p, args + " air");
CmdPhysics.SetPhysics(p.level, phys);
Chat.MessageLevel("Unflooded!");
Chat.MessageLevel(p.level, "Unflooded!");
}
public override void Help(Player p) {

View File

@ -161,7 +161,7 @@ namespace MCGalaxy.Commands.Building {
op.seconds = seconds;
DrawOp.DoDrawOp(op, null, p, new Vec3S32[] { Vec3U16.MaxVal, Vec3U16.MaxVal } );
Player.GlobalMessage("Physics were undone &b" + seconds + " %Sseconds");
Chat.MessageAll("Physics were undone &b{0} %Sseconds", seconds);
Server.s.Log( "Physics were undone &b" + seconds + " %Sseconds");
p.level.Save(true);
}

View File

@ -42,7 +42,7 @@ namespace MCGalaxy.Commands {
pl.SendMessage("You were summoned by " + p.ColoredName + "%S.");
}
}
Player.GlobalMessage(p.ColoredName + " %Ssummoned everyone!");
Chat.MessageAll("{0} %Ssummoned everyone!", p.ColoredName);
return;
}

View File

@ -26,7 +26,7 @@ namespace MCGalaxy.Games {
if (!Server.Countdown.players.Contains(p)) {
Server.Countdown.players.Add(p);
Player.Message(p, "You've joined the Countdown game!!");
Player.GlobalMessage(p.name + " has joined Countdown!!");
Chat.MessageAll("{0} has joined Countdown!!", p.name);
if (p.level != Server.Countdown.mapon)
PlayerActions.ChangeMap(p, "countdown");
p.playerofcountdown = true;

View File

@ -284,7 +284,7 @@ namespace MCGalaxy.Games {
Player.Message(pl, "The countdown game was canceled!");
Command.all.Find("spawn").Use(pl, "");
}
Player.GlobalMessage("The countdown game was canceled!!");
Chat.MessageAll("The countdown game was canceled!!");
gamestatus = CountdownGameStatus.Enabled;
playersleftlist.Clear();
players.Clear();

View File

@ -82,7 +82,7 @@ namespace MCGalaxy {
setPhysics(0);
ClearPhysics();
Player.GlobalMessage("Physics shutdown on &b" + name);
Chat.MessageAll("Physics shutdown on &b{0}", name);
Server.s.Log("Physics shutdown on " + name);
if (PhysicsStateChanged != null)
PhysicsStateChanged(this, PhysicsState.Stopped);

View File

@ -255,7 +255,7 @@ namespace MCGalaxy {
}
} catch (Exception e) {
Server.s.Log("FAILED TO SAVE :" + name);
Player.GlobalMessage("FAILED TO SAVE :" + name);
Chat.MessageAll("FAILED TO SAVE :{0}", name);
Server.ErrorLog(e);
}
GC.Collect();

View File

@ -231,7 +231,7 @@ namespace MCGalaxy {
CheckOutdatedClient();
} catch (Exception e) {
Server.ErrorLog(e);
Player.GlobalMessage("An error occurred: " + e.Message);
Chat.MessageAll("An error occurred: {0}", e.Message);
}
//OpenClassic Client Check

View File

@ -204,7 +204,7 @@ namespace MCGalaxy {
}
public static void GlobalMessage(Player from, string message) {
if (from == null) GlobalMessage(message, false);
if (from == null) Chat.MessageAll(message);
else SendChatFrom(from, message, false);
}

View File

@ -370,7 +370,7 @@ namespace MCGalaxy {
static void RandomMessage(SchedulerTask task) {
if (Player.number != 0 && messages.Count > 0)
Player.GlobalMessage(messages[new Random().Next(0, messages.Count)]);
Chat.MessageAll(messages[new Random().Next(0, messages.Count)]);
}
internal void SettingsUpdate() {

View File

@ -69,12 +69,12 @@ namespace MCGalaxy.Gui
{
if (Server.autoupdate || p != null)
{
Player.GlobalMessage("Updating in &f" + timeLeft + " %Sseconds.");
Chat.MessageAll("Updating in &f{0} %Sseconds.", timeLeft);
Server.s.Log("Updating in " + timeLeft + " seconds.");
timeLeft = timeLeft - 1;
if (timeLeft < 0)
{
Player.GlobalMessage("---UPDATING SERVER---");
Chat.MessageAll("---UPDATING SERVER---");
Server.s.Log("---UPDATING SERVER---");
countDown.Stop();
countDown.Dispose();
@ -83,7 +83,7 @@ namespace MCGalaxy.Gui
}
else
{
Player.GlobalMessage("Stopping auto restart.");
Chat.MessageAll("Stopping auto restart.");
Server.s.Log("Stopping auto restart.");
countDown.Stop();
countDown.Dispose();