Use Player.Message in more places so things work from IRC and console.

This commit is contained in:
UnknownShadow200 2016-08-03 19:15:07 +10:00
parent 59c0d50f2a
commit aeb4ac8fd8
9 changed files with 44 additions and 45 deletions

View File

@ -187,15 +187,15 @@ namespace MCGalaxy.Commands {
}
static void SendPresetsMessage(Player p) {
p.SendMessage("/env preset [type] -- Uses an env preset on your current map");
p.SendMessage("Valid types: Cartoon/Midnight/Midnight2/Noir/Normal/Trippy/Watery/Sunset/Gloomy/Cloudy");
Player.Message(p, "/env preset [type] -- Uses an env preset on your current map");
Player.Message(p, "Valid types: Cartoon/Midnight/Midnight2/Noir/Normal/Trippy/Watery/Sunset/Gloomy/Cloudy");
if (!Directory.Exists("presets")) return;
string custom = "";
foreach (string s in Directory.GetFiles("presets/", "*.env"))
custom += ", " + Path.GetFileNameWithoutExtension(s);
if (custom != "")
p.SendMessage("Custom preset types: " + custom.Remove(0, 2));
Player.Message(p, "Custom preset types: " + custom.Remove(0, 2));
}
public override void Help(Player p) {

View File

@ -45,36 +45,36 @@ namespace MCGalaxy.Commands.World {
return;
}
string url = args[1];
string url = args[1];
if (url.ToLower() == "normal" || url.ToLower() == "reset") {
url = "";
} else if (!(url.StartsWith("http://") || url.StartsWith("https://"))) {
p.SendMessage("Please use http:// or https:// in front of your URL"); return;
Player.Message(p, "Please use http:// or https:// in front of your URL"); return;
}
if ((scope == "global" || scope == "level") && !(url == "" || url.EndsWith(".png"))) {
p.SendMessage("The terrain URL must end in a .png"); return;
Player.Message(p, "The terrain URL must end in a .png"); return;
}
if ((scope == "globalzip" || scope == "levelzip") && !(url == "" || url.EndsWith(".zip"))) {
p.SendMessage("The texture pack URL must end in a .zip"); return;
Player.Message(p, "The texture pack URL must end in a .zip"); return;
}
if (url.Length > 64) { p.SendMessage("The URL must be 64 characters or less."); return; }
if (scope == "global") {
Server.defaultTerrainUrl = url;
p.SendMessage("Set server's default terrain to " + args[1]);
Player.Message(p, "Set server's default terrain to " + args[1]);
UpdateGlobally(p, false);
} else if (scope == "level") {
p.level.terrainUrl = url;
p.SendMessage("Set level's terrain to " + args[1]);
Player.Message(p, "Set level's terrain to " + args[1]);
UpdateLevel(p, false);
} else if (scope == "globalzip") {
Server.defaultTextureUrl = url;
p.SendMessage("Set server's default texture pack to " + args[1]);
Player.Message(p, "Set server's default texture pack to " + args[1]);
UpdateGlobally(p, true);
} else if (scope == "levelzip") {
p.level.texturePackUrl = url;
p.SendMessage("Set level's texture pack to " + args[1]);
Player.Message(p, "Set level's texture pack to " + args[1]);
UpdateLevel(p, true);
} else {
Help(p);

View File

@ -33,7 +33,7 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) {
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (Server.chatmod || p.muted) { Player.SendMessage(p, "Cannot use 8-ball while muted."); return; }
if (Server.chatmod || p.muted) { Player.Message(p, "Cannot use 8-ball while muted."); return; }
if (message == "") { Help(p); return; }
TimeSpan delta = nextUse - DateTime.UtcNow;

View File

@ -87,7 +87,7 @@ namespace MCGalaxy.Commands {
HandleTutorial(p); return;
}
}
p.SendMessage("Sorry, you aren't a high enough rank or that wasn't a correct command addition.");
Player.Message(p, "Sorry, you aren't a high enough rank or that wasn't a correct command addition.");
}
void HandleJoin(Player p) {
@ -326,7 +326,7 @@ namespace MCGalaxy.Commands {
case "ultimate":
game.speed = 150; game.speedtype = "ultimate"; break;
default:
p.SendMessage("You didn't specify a speed, resorting to 'normal'");
Player.Message(p, "You didn't specify a speed, resorting to 'normal'");
game.speed = 650; game.speedtype = "normal"; break;
}
Server.Countdown.freezemode = (par2 == "freeze" || par2 == "frozen");
@ -354,35 +354,34 @@ namespace MCGalaxy.Commands {
}
void HandleTutorial(Player p) {
p.SendMessage("First, generate the map using /cd generate");
p.SendMessage("Next, type /cd enable to enable the game mode");
p.SendMessage("Next, type /cd join to join the game and tell other players to join aswell");
p.SendMessage("When some people have joined, type /cd start [speed] to start it");
p.SendMessage("[speed] can be 'ultimate', 'extreme', 'fast', 'normal' or 'slow'");
p.SendMessage("When you are done, type /cd reset [map/all]");
p.SendMessage("use map to reset only the map and all to reset everything.");
Player.Message(p, "First, generate the map using /cd generate");
Player.Message(p, "Next, type /cd enable to enable the game mode");
Player.Message(p, "Next, type /cd join to join the game and tell other players to join aswell");
Player.Message(p, "When some people have joined, type /cd start [speed] to start it");
Player.Message(p, "[speed] can be 'ultimate', 'extreme', 'fast', 'normal' or 'slow'");
Player.Message(p, "When you are done, type /cd reset [map/all]");
Player.Message(p, "use map to reset only the map and all to reset everything.");
}
public override void Help(Player p) {
p.SendMessage("/cd join - join the game");
p.SendMessage("/cd leave - leave the game");
p.SendMessage("/cd goto - goto the countdown map");
p.SendMessage("/cd players - view players currently playing");
Player.Message(p, "/cd join - join the game");
Player.Message(p, "/cd leave - leave the game");
Player.Message(p, "/cd goto - goto the countdown map");
Player.Message(p, "/cd players - view players currently playing");
if (CheckExtraPerm(p, 1))
p.SendMessage("/cd rules <all/map/player> - the rules of countdown. with send: all to send to all, map to send to map and have a player's name to send to a player");
Player.Message(p, "/cd rules <all/map/player> - the rules of countdown. with send: all to send to all, map to send to map and have a player's name to send to a player");
else
p.SendMessage("/cd rules - view the rules of countdown");
Player.Message(p, "/cd rules - view the rules of countdown");
if (CheckExtraPerm(p, 2)) {
p.SendMessage("/cd generate [width] [height] [length] - generates the countdown map (default size is 32x32x32)");
p.SendMessage("/cd enable - enable the game");
p.SendMessage("/cd disable - disable the game");
p.SendMessage("/cd cancel - cancels a game");
p.SendMessage("/cd start [speed] [mode] - start the game, speeds are 'slow', 'normal', 'fast', 'extreme' and 'ultimate', modes are 'normal' and 'freeze'");
p.SendMessage("/cd reset [all/map] - reset the whole game (all) or only the map (map)");
p.SendMessage("/cd tutorial - a tutorial on how to setup countdown");
}
if (!CheckExtraPerm(p, 2)) return;
Player.Message(p, "/cd generate [width] [height] [length] - generates the countdown map (default size is 32x32x32)");
Player.Message(p, "/cd enable - enable the game");
Player.Message(p, "/cd disable - disable the game");
Player.Message(p, "/cd cancel - cancels a game");
Player.Message(p, "/cd start [speed] [mode] - start the game, speeds are 'slow', 'normal', 'fast', 'extreme' and 'ultimate', modes are 'normal' and 'freeze'");
Player.Message(p, "/cd reset [all/map] - reset the whole game (all) or only the map (map)");
Player.Message(p, "/cd tutorial - a tutorial on how to setup countdown");
}
}
}

View File

@ -126,7 +126,7 @@ namespace MCGalaxy.Commands {
team = Team.FindTeam(args[1]);
if (team != null) { Player.Message(p, "There is already an existing team with that name."); return; }
if (args[1].Length > 8) {
Player.SendMessage(p, "Team names must be 8 characters or less."); return;
Player.Message(p, "Team names must be 8 characters or less."); return;
}
team = new Team(args[1], p.name);

View File

@ -83,9 +83,9 @@ namespace MCGalaxy.Commands {
}
public override void Help(Player p) {
Player.SendMessage(p, "%T/infoswap [source] [other]");
Player.SendMessage(p, "%HSwaps all the player's info from [source] to [other].");
Player.SendMessage(p, "%HNote that both players must be offline for this to work.");
Player.Message(p, "%T/infoswap [source] [other]");
Player.Message(p, "%HSwaps all the player's info from [source] to [other].");
Player.Message(p, "%HNote that both players must be offline for this to work.");
}
}
}

View File

@ -52,7 +52,7 @@ namespace MCGalaxy.Commands {
static bool CopyBlocks(Player p, Level other, Vec3S32[] m) {
byte[] blocks = other.blocks;
if (blocks.Length != p.level.blocks.Length) {
p.SendMessage("Cant restore selection of different size maps.");
p.Sessage("Cannot restore selection of different size maps.");
return false;
}

View File

@ -28,12 +28,12 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) {
if (message == "" || message.IndexOf(' ') != -1) { Help(p); return; }
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
who.ignoreGrief = !who.ignoreGrief;
Player.Message(p, who.ColoredName + "%S's trust status: " + who.ignoreGrief);
who.SendMessage("Your trust status was changed to: " + who.ignoreGrief);
Player.Message(who, "Your trust status was changed to: " + who.ignoreGrief);
}
public override void Help(Player p) {

View File

@ -34,10 +34,10 @@ namespace MCGalaxy.Commands {
if (who.voice) {
Player.Message(p, "Removing voice status from " + who.ColoredName);
who.SendMessage("Your voice status has been revoked.");
Player.Message(who, "Your voice status has been revoked.");
} else {
Player.Message(p, "Giving voice status to " + who.ColoredName);
who.SendMessage("You have received voice status.");
Player.Message(who, "You have received voice status.");
}
who.voice = !who.voice;
}