Make many commands use Chat.MessageAll

This commit is contained in:
UnknownShadow200 2016-08-15 09:26:08 +10:00
parent f96e0ad499
commit 76acf539fc
30 changed files with 89 additions and 99 deletions

View File

@ -76,7 +76,7 @@ namespace MCGalaxy.Commands.CPE {
if (isBot) { if (isBot) {
bot.model = model; bot.model = model;
Entities.UpdateModel(bot.id, model, bot.level, null); Entities.UpdateModel(bot.id, model, bot.level, null);
Player.GlobalMessage("Bot " + bot.ColoredName + "'s %Smodel was changed to a &c" + model); Chat.MessageAll("Bot {0}'s %Smodel was changed to a &c{1}", bot.ColoredName, model);
BotsFile.UpdateBot(bot); BotsFile.UpdateBot(bot);
} else { } else {
who.model = model; who.model = model;

View File

@ -36,14 +36,14 @@ namespace MCGalaxy.Commands.CPE {
if (message == "") message = p.truename; if (message == "") message = p.truename;
Player who = p; Player who = p;
PlayerBot pBot = null; PlayerBot bot = null;
bool isBot = message.CaselessStarts("bot "); bool isBot = message.CaselessStarts("bot ");
string[] args = message.SplitSpaces(isBot ? 3 : 2); string[] args = message.SplitSpaces(isBot ? 3 : 2);
string skin = null; string skin = null;
if (isBot && args.Length > 2) { if (isBot && args.Length > 2) {
pBot = PlayerBot.FindMatches(p, args[1]); bot = PlayerBot.FindMatches(p, args[1]);
if (pBot == null) return; if (bot == null) return;
skin = args[2]; skin = args[2];
} else if (args.Length >= 2) { } else if (args.Length >= 2) {
isBot = false; isBot = false;
@ -66,11 +66,11 @@ namespace MCGalaxy.Commands.CPE {
skin = "http://skins.minecraft.net/MinecraftSkins/" + skin.Substring(1) + ".png"; skin = "http://skins.minecraft.net/MinecraftSkins/" + skin.Substring(1) + ".png";
if (isBot) { if (isBot) {
pBot.SkinName = skin; bot.SkinName = skin;
pBot.GlobalDespawn(); bot.GlobalDespawn();
pBot.GlobalSpawn(); bot.GlobalSpawn();
Player.GlobalMessage("Bot " + pBot.ColoredName + "'s %Sskin was changed to &c" + skin); Chat.MessageAll("Bot {0}'s %Sskin was changed to &c{1}", bot.ColoredName, skin);
BotsFile.UpdateBot(pBot); BotsFile.UpdateBot(bot);
} else { } else {
who.skinName = skin; who.skinName = skin;
Entities.GlobalDespawn(who, true); Entities.GlobalDespawn(who, true);

View File

@ -48,13 +48,13 @@ namespace MCGalaxy.Commands {
if (!take) { if (!take) {
if (Awards.GiveAward(plName, award)) { if (Awards.GiveAward(plName, award)) {
Player.GlobalMessage(Server.FindColor(plName) + plName + " %Swas awarded: &b" + award); Chat.MessageAll("{0}{1} %Swas awarded: &b{2}", Server.FindColor(plName), plName, award);
} else { } else {
Player.Message(p, "The player already has that award."); return; Player.Message(p, "The player already has that award."); return;
} }
} else { } else {
if (Awards.TakeAward(plName, award)) { if (Awards.TakeAward(plName, award)) {
Player.GlobalMessage(Server.FindColor(plName) + plName + " %Shad their &b" + award + " %Saward removed"); Chat.MessageAll("{0}{1} %Shad their &b{2} %Saward removed", Server.FindColor(plName), plName, award);
} else { } else {
Player.Message(p, "The player didn't have the award you tried to take"); return; Player.Message(p, "The player didn't have the award you tried to take"); return;
} }

View File

@ -40,13 +40,13 @@ namespace MCGalaxy.Commands {
if (!Awards.Add(args[0], args[1])) { if (!Awards.Add(args[0], args[1])) {
Player.Message(p, "This award already exists."); return; Player.Message(p, "This award already exists."); return;
} else { } else {
Player.GlobalMessage("Award added: &6" + args[0] + " : " + args[1]); Chat.MessageAll("Award added: &6{0} : {1}", args[0], args[1]);
} }
} else { } else {
if (!Awards.Remove(args[1])) { if (!Awards.Remove(args[1])) {
Player.Message(p, "This award does not exist."); return; Player.Message(p, "This award does not exist."); return;
} else { } else {
Player.GlobalMessage("Award removed: &6" + args[1]); Chat.MessageAll("Award removed: &6{0}", args[1]);
} }
} }
Awards.Save(); Awards.Save();

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Commands {
if (amount < 0) { Player.Message(p, "You can't fakepay a negative amount."); return; } if (amount < 0) { Player.Message(p, "You can't fakepay a negative amount."); return; }
if (amount >= 16777215) { Player.Message(p, "You can only fakepay up to 16777215."); return; } if (amount >= 16777215) { Player.Message(p, "You can only fakepay up to 16777215."); return; }
Player.GlobalMessage(who.ColoredName + " %Swas given " + amount + " " + Server.moneys); Chat.MessageAll("{0} %Swas given {1} {2}", who.ColoredName, amount, Server.moneys);
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -186,11 +186,11 @@ namespace MCGalaxy.Commands {
Player.Message(p, "The last person alive will win!!"); Player.Message(p, "The last person alive will win!!");
} else if (hasPerm) { } else if (hasPerm) {
if (target == "all") { if (target == "all") {
Player.GlobalMessage("Countdown Rules being sent to everyone by " + p.ColoredName + ":"); Chat.MessageAll("Countdown Rules being sent to everyone by " + p.ColoredName + ":");
Player.GlobalMessage("The aim of the game is to stay alive the longest."); Chat.MessageAll("The aim of the game is to stay alive the longest.");
Player.GlobalMessage("Don't fall in the lava!!"); Chat.MessageAll("Don't fall in the lava!!");
Player.GlobalMessage("Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappering."); Chat.MessageAll("Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappering.");
Player.GlobalMessage("The last person alive will win!!"); Chat.MessageAll("The last person alive will win!!");
Player.Message(p, "Countdown rules sent to everyone"); Player.Message(p, "Countdown rules sent to everyone");
return; return;
} else if (target == "map") { } else if (target == "map") {
@ -269,7 +269,7 @@ namespace MCGalaxy.Commands {
Server.Countdown.mapon.motd = "Welcome to the Countdown map! -hax"; Server.Countdown.mapon.motd = "Welcome to the Countdown map! -hax";
Server.Countdown.gamestatus = CountdownGameStatus.Enabled; Server.Countdown.gamestatus = CountdownGameStatus.Enabled;
Player.GlobalMessage("Countdown has been enabled!!"); Chat.MessageAll("Countdown has been enabled!!");
} else { } else {
Player.Message(p, "A Game is either already enabled or is already progress"); Player.Message(p, "A Game is either already enabled or is already progress");
} }

View File

@ -44,7 +44,7 @@ namespace MCGalaxy.Commands
{ {
Player.Message(p, "Starting CTF.."); Player.Message(p, "Starting CTF..");
Server.ctf = new Auto_CTF(); Server.ctf = new Auto_CTF();
Player.GlobalMessage("A CTF GAME IS STARTING AT CTF! TYPE /goto CTF to join!"); Chat.MessageAll("A CTF GAME IS STARTING AT CTF! TYPE /goto CTF to join!");
} }
else if (Server.ctf.started) else if (Server.ctf.started)
{ {
@ -54,7 +54,7 @@ namespace MCGalaxy.Commands
else if (!Server.ctf.started) else if (!Server.ctf.started)
{ {
Server.ctf.Start(); Server.ctf.Start();
Player.GlobalMessage("A CTF GAME IS STARTING AT CTF! TYPE /goto CTF to join!"); Chat.MessageAll("A CTF GAME IS STARTING AT CTF! TYPE /goto CTF to join!");
} }
} }
if (message == "stop") if (message == "stop")

View File

@ -26,8 +26,8 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
Server.flipHead = !Server.flipHead; Server.flipHead = !Server.flipHead;
if (Server.flipHead) Player.GlobalMessage("All necks were broken"); if (Server.flipHead) Chat.MessageAll("All necks were broken");
else Player.GlobalMessage("All necks were mended"); else Chat.MessageAll("All necks were mended");
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -35,7 +35,7 @@ namespace MCGalaxy.Commands {
Player.Message(p, "Cannot disinfect player"); Player.Message(p, "Cannot disinfect player");
} else if (!who.Game.Referee) { } else if (!who.Game.Referee) {
Server.zombie.DisinfectPlayer(who); Server.zombie.DisinfectPlayer(who);
Player.GlobalMessage(who.ColoredName + " %Swas disinfected!"); Chat.MessageAll("{0} %Swas disinfected.", who.ColoredName);
} }
} }

View File

@ -33,7 +33,7 @@ namespace MCGalaxy.Commands {
Player.Message(p, "Cannot infect player"); Player.Message(p, "Cannot infect player");
} else if (!who.Game.Referee) { } else if (!who.Game.Referee) {
Server.zombie.InfectPlayer(who); Server.zombie.InfectPlayer(who);
Player.GlobalMessage(who.ColoredName + " %Swas infected!"); Chat.MessageAll("{0} %Swas infected.", who.ColoredName);
} }
} }

View File

@ -50,7 +50,7 @@ namespace MCGalaxy.Commands {
bool send = !Server.chatmod && !p.muted; bool send = !Server.chatmod && !p.muted;
if (p.IsAfk) { if (p.IsAfk) {
if (send) { if (send) {
Player.GlobalMessage("-" + p.ColoredName + "%S- is AFK " + message); Chat.MessageAll("-{0}%S- is AFK {1}", p.ColoredName, message);
Player.RaisePlayerAction(p, PlayerAction.AFK, message); Player.RaisePlayerAction(p, PlayerAction.AFK, message);
} else { } else {
Player.Message(p, "You are now marked as being AFK."); Player.Message(p, "You are now marked as being AFK.");
@ -61,7 +61,7 @@ namespace MCGalaxy.Commands {
OnPlayerAFKEvent.Call(p); OnPlayerAFKEvent.Call(p);
} else { } else {
if (send) { if (send) {
Player.GlobalMessage("-" + p.ColoredName + "%S- is no longer AFK"); Chat.MessageAll("-{0}%S- is no longer AFK", p.ColoredName);
Player.RaisePlayerAction(p, PlayerAction.UnAFK, message); Player.RaisePlayerAction(p, PlayerAction.UnAFK, message);
} else { } else {
Player.Message(p, "You are no longer marked as being AFK."); Player.Message(p, "You are no longer marked as being AFK.");

View File

@ -36,13 +36,13 @@ namespace MCGalaxy.Commands {
} }
if (lvl.guns) { if (lvl.guns) {
Player.GlobalMessage("&9Gun usage has been disabled on &c" + lvl.name + "&9!"); Chat.MessageAll("&9Gun usage has been disabled on &c{0}&9!", lvl.name);
Player[] players = PlayerInfo.Online.Items; Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) foreach (Player pl in players)
if (pl.level.name.CaselessEq(lvl.name)) if (pl.level.name.CaselessEq(lvl.name))
pl.aiming = false; pl.aiming = false;
} else { } else {
Player.GlobalMessage("&9Gun usage has been enabled on &c" + lvl.name + "&9!"); Chat.MessageAll("&9Gun usage has been enabled on &c{0}&9!", lvl.name);
} }
lvl.guns = !lvl.guns; lvl.guns = !lvl.guns;
Level.SaveSettings(lvl); Level.SaveSettings(lvl);

View File

@ -37,35 +37,29 @@ namespace MCGalaxy.Commands {
switch (args[0].ToLower()) { switch (args[0].ToLower()) {
case "rt": case "rt":
case "reloadthreshold": case "reloadthreshold":
Player.GlobalMessage("Threshold before drawing reloads map set to &b" + limit); SetLimit("Threshold before drawing reloads map set to {0}", ref Server.DrawReloadLimit, limit);
Server.DrawReloadLimit = limit; return;
SrvProperties.Save(); return;
case "rp": case "rp":
case "restartphysics": case "restartphysics":
Player.GlobalMessage("Custom /rp's limit was changed to &b" + limit); SetLimit("Custom /rp's limit was changed to {0}", ref Server.rpLimit, limit);
Server.rpLimit = limit; return;
SrvProperties.Save(); return;
case "rpnormal": case "rpnormal":
Player.GlobalMessage("Normal /rp's limit set to &b" + limit); SetLimit("Normal /rp's limit set to {0}", ref Server.rpNormLimit, limit);
Server.rpNormLimit = limit; return;
SrvProperties.Save(); return;
case "pu": case "pu":
case "physicsundo": case "physicsundo":
Player.GlobalMessage("Physics undo max entries set to &b" + limit); SetLimit("Physics undo max entries set to {0}", ref Server.physUndo, limit);
Server.physUndo = limit; return;
SrvProperties.Save(); return;
case "gen": case "gen":
case "genlimit": case "genlimit":
Player.GlobalMessage("Maximum volume of maps players can generate set to &b" + limit); SetLimit("Maximum volume of maps players can generate set to {0}", ref Server.MapGenLimit, limit);
Server.MapGenLimit = limit; return;
SrvProperties.Save(); return;
case "genadmin": case "genadmin":
case "genadminlimit": case "genadminlimit":
case "admingen": case "admingen":
case "admingenlimit": case "admingenlimit":
Player.GlobalMessage("Maximum volume of maps admins can generate set to &b" + limit); SetLimit("Maximum volume of maps admins can generate set to &b{0}", ref Server.MapGenLimitAdmin, limit);
Server.MapGenLimitAdmin = limit; return;
SrvProperties.Save(); return;
} }
if (args.Length == 2) { Player.Message(p, "You need to provide a rank name for this type."); return; } if (args.Length == 2) { Player.Message(p, "You need to provide a rank name for this type."); return; }
@ -80,13 +74,19 @@ namespace MCGalaxy.Commands {
case "mu": case "mu":
case "maxundo": case "maxundo":
Player.GlobalMessage(grp.ColoredName + "%S's undo limit set to &b" + limit); Player.GlobalMessage(grp.ColoredName + "%S's undo limit set to &b" + limit);
grp.maxUndo = limit; break; grp.maxUndo = limit; break;
default: default:
Help(p); return; Help(p); return;
} }
Group.saveGroups(Group.GroupList); Group.saveGroups(Group.GroupList);
} }
static void SetLimit(string format, ref int target, int limit) {
Chat.MessageAll(format, "&b" + limit);
target = limit;
SrvProperties.Save();
}
public override void Help(Player p) { public override void Help(Player p) {
Player.Message(p, "%T/limit <type> <amount> [rank]"); Player.Message(p, "%T/limit <type> <amount> [rank]");
Player.Message(p, "%HSets the limit for <type>"); Player.Message(p, "%HSets the limit for <type>");

View File

@ -29,10 +29,10 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (message == "" && Server.updateTimer.Interval > 1000) { if (message == "" && Server.updateTimer.Interval > 1000) {
Server.PositionInterval = 100; Server.PositionInterval = 100;
Player.GlobalMessage("&dLow lag %Sturned &cOFF %S- positions update every &b100%S ms."); Chat.MessageAll("&dLow lag %Sturned &cOFF %S- positions update every &b100%S ms.");
} else if (message == "") { } else if (message == "") {
Server.PositionInterval = 2000; Server.PositionInterval = 2000;
Player.GlobalMessage("&dLow lag %Sturned &aON %S- positions update every &b2000%S ms."); Chat.MessageAll("&dLow lag %Sturned &aON %S- positions update every &b2000%S ms.");
} else { } else {
int interval; int interval;
if (!int.TryParse(message, out interval)) { if (!int.TryParse(message, out interval)) {
@ -42,7 +42,7 @@ namespace MCGalaxy.Commands
Player.Message(p, "Interval must be between 20 and 2000 milliseconds."); return; Player.Message(p, "Interval must be between 20 and 2000 milliseconds."); return;
} }
Server.PositionInterval = interval; Server.PositionInterval = interval;
Player.GlobalMessage("Positions now update every &b" + interval + " %Smilliseconds."); Chat.MessageAll("Positions now update every &b{0} %Smilliseconds.", interval);
} }
Server.updateTimer.Interval = Server.PositionInterval; Server.updateTimer.Interval = Server.PositionInterval;
SrvProperties.Save(); SrvProperties.Save();

View File

@ -28,9 +28,9 @@ namespace MCGalaxy.Commands {
if (message != "") { Help(p); return; } if (message != "") { Help(p); return; }
if (Server.chatmod) { if (Server.chatmod) {
Player.GlobalMessage("Chat moderation has been disabled. Everyone can now speak."); Chat.MessageAll("Chat moderation has been disabled. Everyone can now speak.");
} else { } else {
Player.GlobalMessage("Chat moderation engaged! Silence the plebians!"); Chat.MessageAll("Chat moderation engaged! Silence the plebians!");
} }
Server.chatmod = !Server.chatmod; Server.chatmod = !Server.chatmod;
} }

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Commands.Moderation {
if (Server.muted.Contains(message)) { if (Server.muted.Contains(message)) {
Server.muted.Remove(message); Server.muted.Remove(message);
Server.muted.Save(); Server.muted.Save();
Player.GlobalMessage(message + " %Sis not online but is now &bun-muted"); Chat.MessageAll("{0} %Sis not online but is now &bun-muted", message);
} }
return; return;
} }

View File

@ -42,8 +42,8 @@ namespace MCGalaxy.Commands {
} }
Chat.MessageOps(p.ColoredName + " %Sused &a/votekick"); Chat.MessageOps(p.ColoredName + " %Sused &a/votekick");
Player.GlobalMessage("&9A vote to kick " + who.ColoredName + " %Shas been called!"); Chat.MessageAll("&9A vote to kick {0} %Shas been called!", who.ColoredName);
Player.GlobalMessage("&9Type &aY %Sor &cN %Sto vote."); Chat.MessageAll("&9Type &aY %Sor &cN %Sto vote.");
// 1/3rd of the players must vote or nothing happens // 1/3rd of the players must vote or nothing happens
// Keep it at 0 to disable min number of votes // Keep it at 0 to disable min number of votes
@ -65,7 +65,7 @@ namespace MCGalaxy.Commands {
string name = (string)task.State; string name = (string)task.State;
Player who = PlayerInfo.FindExact(name); Player who = PlayerInfo.FindExact(name);
if (who == null) { if (who == null) {
Player.GlobalMessage(name + " was not kicked, as they already left the server."); return; Chat.MessageAll("{0} was not kicked, as they already left the server.", name); return;
} }
int netVotesYes = votesYes - votesNo; int netVotesYes = votesYes - votesNo;
@ -74,12 +74,12 @@ namespace MCGalaxy.Commands {
Server.s.Log("VoteKick results for " + who.DisplayName + ": " + votesYes + " yes and " + votesNo + " no votes."); Server.s.Log("VoteKick results for " + who.DisplayName + ": " + votesYes + " yes and " + votesNo + " no votes.");
if (votesYes + votesNo < Server.voteKickVotesNeeded) { if (votesYes + votesNo < Server.voteKickVotesNeeded) {
Player.GlobalMessage("Not enough votes were made. " + who.ColoredName + " %Sshall remain!"); Chat.MessageAll("Not enough votes were made. {0} %Sshall remain!", who.ColoredName);
} else if (netVotesYes > 0) { } else if (netVotesYes > 0) {
Player.GlobalMessage("The people have spoken, " + who.ColoredName + " %Sis gone!"); Chat.MessageAll("The people have spoken, {0} %Sis gone!", who.ColoredName);
who.Kick("Vote-Kick: The people have spoken!"); who.Kick("Vote-Kick: The people have spoken!");
} else { } else {
Player.GlobalMessage(who.ColoredName + " %Sshall remain!"); Chat.MessageAll("{0} %Sshall remain!", who.ColoredName);
} }
} }

View File

@ -57,7 +57,7 @@ namespace MCGalaxy.Commands {
PlayerActions.ChangeMap(pl, xjailMap); PlayerActions.ChangeMap(pl, xjailMap);
pl.BlockUntilLoad(10); pl.BlockUntilLoad(10);
jail.Use(p, message); jail.Use(p, message);
Player.GlobalMessage(pl.ColoredName + " %Swas XJailed!"); Chat.MessageAll("{0} %Swas XJailed!", pl.ColoredName);
} else { } else {
if (pl.muted) mute.Use(p, message); if (pl.muted) mute.Use(p, message);
if (pl.frozen) freeze.Use(p, message); if (pl.frozen) freeze.Use(p, message);
@ -67,7 +67,7 @@ namespace MCGalaxy.Commands {
jail.Use(p, message); jail.Use(p, message);
spawn.Use(pl, ""); spawn.Use(pl, "");
Player.GlobalMessage(pl.ColoredName + " %Swas released from XJail!"); Chat.MessageAll("{0} %Swas released from XJail!", pl.ColoredName);
} }
} }

View File

@ -54,7 +54,7 @@ namespace MCGalaxy.Commands {
Player.Message(p, "Time must be positive and greater than zero."); return; Player.Message(p, "Time must be positive and greater than zero."); return;
} }
Player.GlobalMessage(muter.color + muter.DisplayName + " %Shas been muted for " + time + " seconds"); Chat.MessageAll("{0} %Shas been muted for {1} seconds", muter.ColoredName, time);
Player.Message(muter, "You have been muted for " + time + " seconds"); Player.Message(muter, "You have been muted for " + time + " seconds");
Thread.Sleep(time * 1000); Thread.Sleep(time * 1000);
Command.all.Find("mute").Use(p, muter.name); Command.all.Find("mute").Use(p, muter.name);

View File

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

View File

@ -44,11 +44,11 @@ namespace MCGalaxy.Commands {
string path = "text/lockdown/map/" + args[1]; string path = "text/lockdown/map/" + args[1];
if (!File.Exists(path)) { if (!File.Exists(path)) {
File.Create(path).Dispose(); File.Create(path).Dispose();
Player.GlobalMessage("The map " + args[1] + " has been locked"); Chat.MessageAll("The map {0} has been locked", args[1]);
Chat.MessageOps("Locked by: " + ((p == null) ? "Console" : p.name)); Chat.MessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
} else { } else {
File.Delete(path); File.Delete(path);
Player.GlobalMessage("The map " + args[1] + " has been unlocked"); Chat.MessageAll("The map {0} has been unlocked", args[1]);
Chat.MessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name)); Chat.MessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
} }
} else { } else {
@ -64,10 +64,10 @@ namespace MCGalaxy.Commands {
PlayerActions.ChangeMap(who, p.level.name); PlayerActions.ChangeMap(who, p.level.name);
who.BlockUntilLoad(500); who.BlockUntilLoad(500);
} }
Player.GlobalMessage(who.ColoredName + " %Shas been locked down!"); Chat.MessageAll("{0} %Shas been locked down!", who.ColoredName);
Chat.MessageOps("Locked by: " + ((p == null) ? "Console" : p.name)); Chat.MessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
} else { } else {
Player.GlobalMessage(who.ColoredName + " %Shas been unlocked."); Chat.MessageAll("{0} %Shas been unlocked.", who.ColoredName);
Chat.MessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name)); Chat.MessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
} }
who.jailed = !who.jailed; who.jailed = !who.jailed;

View File

@ -69,7 +69,7 @@ namespace MCGalaxy.Commands.World {
} }
string format = seed != "" ? "Level \"{0}\" created with seed \"{1}\"" : "Level \"{0}\" created"; string format = seed != "" ? "Level \"{0}\" created with seed \"{1}\"" : "Level \"{0}\" created";
Player.GlobalMessage(String.Format(format, name, seed)); Chat.MessageAll(format, name, seed);
} }
internal static bool CheckMapSize(Player p, int x, int y, int z) { internal static bool CheckMapSize(Player p, int x, int y, int z) {

View File

@ -49,11 +49,11 @@ namespace MCGalaxy.Commands {
lvl.PhysicsEnabled = enabled; lvl.PhysicsEnabled = enabled;
lvl.physPause = !lvl.physPause; lvl.physPause = !lvl.physPause;
if (enabled) { if (enabled) {
Player.GlobalMessage("Physics on " + lvl.name + " were re-enabled."); Chat.MessageAll("Physics on {0} were re-enabled.", lvl.name);
} else { } else {
Server.MainScheduler.QueueOnce(PauseCallback, lvl.name, Server.MainScheduler.QueueOnce(PauseCallback, lvl.name,
TimeSpan.FromSeconds(seconds)); TimeSpan.FromSeconds(seconds));
Player.GlobalMessage("Physics on " + lvl.name + " were temporarily disabled."); Chat.MessageAll("Physics on {0} were temporarily disabled.", lvl.name);
} }
} }
@ -63,7 +63,7 @@ namespace MCGalaxy.Commands {
if (lvl == null) return; if (lvl == null) return;
lvl.PhysicsEnabled = true; lvl.PhysicsEnabled = true;
Player.GlobalMessage("Physics on " + lvl.name + " were re-enabled."); Chat.MessageAll("Physics on {0} were re-enabled.", lvl.name);
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

@ -42,7 +42,7 @@ namespace MCGalaxy.Commands.World {
LevelActions.Rename(lvl.name.ToLower(), newName.ToLower()); LevelActions.Rename(lvl.name.ToLower(), newName.ToLower());
try { Command.all.Find("load").Use(p, newName); } try { Command.all.Find("load").Use(p, newName); }
catch { } catch { }
Player.GlobalMessage("Renamed " + lvl.name + " to " + newName); Chat.MessageAll("Renamed {0} to {1}", lvl.name, newName);
} }
public override void Help(Player p) { public override void Help(Player p) {

View File

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

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Games {
MainLoopCore(); MainLoopCore();
} catch (Exception ex) { } catch (Exception ex) {
Server.ErrorLog(ex); Server.ErrorLog(ex);
Player.GlobalMessage("&cZombie survival disabled due to an error."); Chat.MessageAll("&cZombie survival disabled due to an error.");
try { try {
ResetState(); ResetState();
} catch (Exception ex2) { } catch (Exception ex2) {

View File

@ -59,7 +59,7 @@ namespace MCGalaxy.Games {
CurLevel = level; CurLevel = level;
} }
Player.GlobalMessage("A game of zombie survival is starting on: " + CurLevelName); Chat.MessageAll("A game of zombie survival is starting on: {0}", CurLevelName);
Player[] players = PlayerInfo.Online.Items; Player[] players = PlayerInfo.Online.Items;
foreach (Player p in players) { foreach (Player p in players) {
if (p.level != CurLevel) continue; if (p.level != CurLevel) continue;

View File

@ -649,10 +649,8 @@ return;
} else { } else {
Chat.GlobalChatLevel(this, text, true); Chat.GlobalChatLevel(this, text, true);
} }
//IRCBot.Say(name + ": " + text);
} }
catch ( Exception e ) { Server.ErrorLog(e); Player.GlobalMessage("An error occurred: " + e.Message); } catch ( Exception e ) { Server.ErrorLog(e); Chat.MessageAll("An error occurred: {0}", e.Message); }
} }
string HandleJoker(string text) { string HandleJoker(string text) {
@ -757,7 +755,7 @@ return;
//DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla //DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla
if (cmd == "pony") { if (cmd == "pony") {
if (ponycount < 2) { if (ponycount < 2) {
GlobalMessage(color + DisplayName + " %Sjust so happens to be a proud brony! Everyone give " + color + DisplayName + " %Sa brohoof!"); Chat.MessageAll("{0} %Sjust so happens to be a proud brony! Everyone give {0} %Sa brohoof!", ColoredName);
ponycount++; ponycount++;
} else { } else {
SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!");
@ -765,7 +763,7 @@ return;
return false; return false;
} else if (cmd == "rainbowdashlikescoolthings") { } else if (cmd == "rainbowdashlikescoolthings") {
if (rdcount < 2) { if (rdcount < 2) {
GlobalMessage("&1T&2H&3I&4S &5S&6E&7R&8V&9E&aR &bJ&cU&dS&eT &fG&0O&1T &22&30 &4P&CE&7R&DC&EE&9N&1T &5C&6O&7O&8L&9E&aR&b!"); Chat.MessageAll("&1T&2H&3I&4S &5S&6E&7R&8V&9E&aR &bJ&cU&dS&eT &fG&0O&1T &22&30 &4P&CE&7R&DC&EE&9N&1T &5C&6O&7O&8L&9E&aR&b!");
rdcount++; rdcount++;
} else { } else {
SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!");

View File

@ -133,7 +133,7 @@ namespace MCGalaxy {
CompleteLoginProcess(); CompleteLoginProcess();
} catch (Exception e) { } catch (Exception e) {
Server.ErrorLog(e); Server.ErrorLog(e);
Player.GlobalMessage("An error occurred: " + e.Message); Chat.MessageAll("An error occurred: {0}", e.Message);
} }
} }
@ -379,12 +379,12 @@ namespace MCGalaxy {
void CheckState() { void CheckState() {
if (Server.muted.Contains(name)) { if (Server.muted.Contains(name)) {
muted = true; muted = true;
GlobalMessage(DisplayName + " is still muted from the last time they went offline."); Chat.MessageAll("{0} is still muted from the last time they went offline.", DisplayName);
Player.Message(this, "!%cYou are still %8muted%c since your last login."); Player.Message(this, "!%cYou are still %8muted%c since your last login.");
} }
if (Server.frozen.Contains(name)) { if (Server.frozen.Contains(name)) {
frozen = true; frozen = true;
GlobalMessage(DisplayName + " is still frozen from the last time they went offline."); Chat.MessageAll("{0} is still frozen from the last time they went offline.", DisplayName);
Player.Message(this, "!%cYou are still %8frozen%c since your last login."); Player.Message(this, "!%cYou are still %8frozen%c since your last login.");
} }
} }

View File

@ -187,17 +187,10 @@ namespace MCGalaxy {
} }
public static List<ChatMessage> Last50Chat = new List<ChatMessage>(); public static List<ChatMessage> Last50Chat = new List<ChatMessage>();
public static void GlobalMessage(string message) { GlobalMessage(message, false); } [Obsolete("Use Chat.MessageAll() instead")]
public static void GlobalMessage(string message, bool global) { public static void GlobalMessage(string message) { Chat.MessageAll(message); }
message = Colors.EscapeColors(message); [Obsolete("Use Chat.MessageAll() instead")]
Player[] players = PlayerInfo.Online.Items; public static void GlobalMessage(string message, bool global) { Chat.MessageAll(message); }
foreach (Player p in players) {
if (p.ignoreAll || (global && p.ignoreGlobal)) continue;
if (p.level.worldChat && p.Chatroom == null)
p.SendMessage(message, !global);
}
}
public static void GlobalIRCMessage(string message) { public static void GlobalIRCMessage(string message) {
message = Colors.EscapeColors(message); message = Colors.EscapeColors(message);
@ -651,7 +644,7 @@ namespace MCGalaxy {
muteCooldown = Server.mutespamtime; muteCooldown = Server.mutespamtime;
Command.all.Find("mute").Use(null, name); Command.all.Find("mute").Use(null, name);
Player.GlobalMessage(color + DisplayName + " %Shas been &0muted &efor spamming!"); Chat.MessageAll("{0} %Shas been &0muted %Sfor spamming!", ColoredName);
muteTimer.Elapsed += MuteTimerElapsed; muteTimer.Elapsed += MuteTimerElapsed;
muteTimer.Start(); muteTimer.Start();
} }