diff --git a/Commands/CPE/CmdReachDistance.cs b/Commands/CPE/CmdReachDistance.cs
index e55cf7764..536e7d1da 100644
--- a/Commands/CPE/CmdReachDistance.cs
+++ b/Commands/CPE/CmdReachDistance.cs
@@ -27,12 +27,8 @@ namespace MCGalaxy.Commands {
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override void Use(Player p, string message) {
- if (p == null) {
- Player.SendMessage(p, "This command cannot be used from console."); return;
- }
- if (message == "") {
- Help(p); return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
+ if (message == "") { Help(p); return; }
float dist;
if( !float.TryParse(message, out dist)) {
diff --git a/Commands/Chat/CmdChatRoom.cs b/Commands/Chat/CmdChatRoom.cs
index e81efddad..f243c8399 100644
--- a/Commands/Chat/CmdChatRoom.cs
+++ b/Commands/Chat/CmdChatRoom.cs
@@ -27,10 +27,9 @@ namespace MCGalaxy.Commands {
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override void Use(Player p, string message) {
- if (p == null) {
- Server.s.Log("This command can only be used in-game."); return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
string[] parts = message.ToLower().Split(' ');
+
if (parts.Length == 0) {
if (Server.Chatrooms.Count == 0) {
Player.SendMessage(p, "There are currently no rooms");
diff --git a/Commands/Chat/CmdIgnore.cs b/Commands/Chat/CmdIgnore.cs
index 134914685..f72de2cd8 100644
--- a/Commands/Chat/CmdIgnore.cs
+++ b/Commands/Chat/CmdIgnore.cs
@@ -34,7 +34,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
if (message.Split(' ')[0] == "all")
{
p.ignoreglobal = !p.ignoreglobal;
diff --git a/Commands/Chat/CmdMe.cs b/Commands/Chat/CmdMe.cs
index 5da3894e2..23de5401c 100644
--- a/Commands/Chat/CmdMe.cs
+++ b/Commands/Chat/CmdMe.cs
@@ -29,7 +29,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
if (message == "") { Player.SendMessage(p, "You"); return; }
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
if (p.muted) { Player.SendMessage(p, "You are currently muted and cannot use this command."); return; }
if (Server.chatmod && !p.voice) { Player.SendMessage(p, "Chat moderation is on, you cannot emote."); return; }
diff --git a/Commands/Command.cs b/Commands/Command.cs
index 9a458ae41..edfd80624 100644
--- a/Commands/Command.cs
+++ b/Commands/Command.cs
@@ -37,19 +37,14 @@ namespace MCGalaxy
public static CommandList all = new CommandList();
public static CommandList core = new CommandList();
- ///
- /// Add a command to the server
- ///
- /// The command to add
- public void AddCommand(Command command)
- {
- all.Add(command);
- }
-
protected static void RevertAndClearState(Player p, ushort x, ushort y, ushort z) {
p.ClearBlockchange();
p.RevertBlock(x, y, z);
}
+
+ protected void MessageInGameOnly(Player p) {
+ Player.SendMessage(p, "/" + name + " can only be used in-game.");
+ }
}
public sealed class CommandTypes {
diff --git a/Commands/Information/CmdAbout.cs b/Commands/Information/CmdAbout.cs
index fe048323d..c2d7f2af9 100644
--- a/Commands/Information/CmdAbout.cs
+++ b/Commands/Information/CmdAbout.cs
@@ -33,15 +33,11 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p != null)
- {
- Player.SendMessage(p, "Break/build a block to display information.");
- p.ClearBlockchange();
- p.Blockchange += new Player.BlockchangeEventHandler(AboutBlockchange);
- return;
- }
- Player.SendMessage(p, "This command can only be used in-game");
-
+ if (p == null) { MessageInGameOnly(p); return; }
+
+ Player.SendMessage(p, "Break/build a block to display information.");
+ p.ClearBlockchange();
+ p.Blockchange += new Player.BlockchangeEventHandler(AboutBlockchange);
}
public override void Help(Player p)
{
diff --git a/Commands/Information/CmdAfk.cs b/Commands/Information/CmdAfk.cs
index 5c3e10b7f..172e779b6 100644
--- a/Commands/Information/CmdAfk.cs
+++ b/Commands/Information/CmdAfk.cs
@@ -28,53 +28,36 @@ namespace MCGalaxy.Commands
public static string keywords { get { return ""; } }
public CmdAfk() { }
- public override void Use(Player p, string message)
- {
- if (p != null)
- {
-
- if (Server.chatmod) {
- Player.SendMessage(p, "You cannot use /afk while chat moderation is enabled");
- return;
- }
-
- if (message != "list")
- {
- if (p.joker)
- {
- message = "";
- }
- if (!Server.afkset.Contains(p.name))
- {
- Server.afkset.Add(p.name);
- if (p.muted)
- {
- message = "";
- }
- Player.GlobalMessage("-" + p.color + p.DisplayName + Server.DefaultColor + "- is AFK " + message);
- //IRCBot.Say(p.name + " is AFK " + message);
- Server.IRC.Say(p.DisplayName + " is AFK " + message);
- p.afkStart = DateTime.Now;
- return;
-
- }
- else
- {
- Server.afkset.Remove(p.name);
- Player.GlobalMessage("-" + p.color + p.DisplayName + Server.DefaultColor + "- is no longer AFK");
- //IRCBot.Say(p.name + " is no longer AFK");
- Server.IRC.Say(p.DisplayName + " is no longer AFK");
- return;
- }
- }
- else
- {
- foreach (string s in Server.afkset) Player.SendMessage(p, s);
- return;
- }
+ public override void Use(Player p, string message) {
+ if (p == null) { MessageInGameOnly(p); return; }
+ if (Server.chatmod) {
+ Player.SendMessage(p, "You cannot use /afk while chat moderation is enabled");
+ return;
+ }
+
+ if (message != "list") {
+ if (p.joker)
+ message = "";
+ if (!Server.afkset.Contains(p.name)) {
+ Server.afkset.Add(p.name);
+ if (p.muted)
+ message = "";
+ Player.GlobalMessage("-" + p.color + p.DisplayName + Server.DefaultColor + "- is AFK " + message);
+ //IRCBot.Say(p.name + " is AFK " + message);
+ Server.IRC.Say(p.DisplayName + " is AFK " + message);
+ p.afkStart = DateTime.Now;
+ } else {
+ Server.afkset.Remove(p.name);
+ Player.GlobalMessage("-" + p.color + p.DisplayName + Server.DefaultColor + "- is no longer AFK");
+ //IRCBot.Say(p.name + " is no longer AFK");
+ Server.IRC.Say(p.DisplayName + " is no longer AFK");
+ }
+ } else {
+ foreach (string s in Server.afkset)
+ Player.SendMessage(p, s);
}
- Player.SendMessage(p, "This command can only be used in-game");
}
+
public override void Help(Player p)
{
Player.SendMessage(p, "/afk - mark yourself as AFK. Use again to mark yourself as back");
diff --git a/Commands/Moderation/CmdBotAdd.cs b/Commands/Moderation/CmdBotAdd.cs
index 57e881763..c25f003fe 100644
--- a/Commands/Moderation/CmdBotAdd.cs
+++ b/Commands/Moderation/CmdBotAdd.cs
@@ -26,22 +26,16 @@ namespace MCGalaxy.Commands
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public CmdBotAdd() { }
- public override void Use(Player p, string message)
- {
+ public override void Use(Player p, string message) {
if (message == "") { Help(p); return; }
- if (p != null)
- {
- if (!Player.ValidName(message)) { Player.SendMessage(p, "bot name " + message + " not valid!"); return; }
- PlayerBot bot = new PlayerBot(message, p.level, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
- PlayerBot.Add(bot);
- //who.SendMessage("You were summoned by " + p.color + p.name + "&e.");
- return;
- }
- Player.SendMessage(p, "This command can only be used in-game");
+ if (p == null) { MessageInGameOnly(p); return; }
+
+ if (!Player.ValidName(message)) { Player.SendMessage(p, "bot name " + message + " not valid!"); return; }
+ PlayerBot bot = new PlayerBot(message, p.level, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
+ PlayerBot.Add(bot);
}
- public override void Help(Player p)
- {
+ public override void Help(Player p) {
Player.SendMessage(p, "/botadd - Add a new bot at your position.");
}
}
diff --git a/Commands/Moderation/CmdBotRemove.cs b/Commands/Moderation/CmdBotRemove.cs
index 4a5047419..42080c3a0 100644
--- a/Commands/Moderation/CmdBotRemove.cs
+++ b/Commands/Moderation/CmdBotRemove.cs
@@ -31,26 +31,22 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
- if (p == null) {
- Player.SendMessage(p, "This command can only be used in-game!"); return;
- }
- try
- {
- if (message.ToLower() == "all")
- {
- PlayerBot.RemoveAllFromLevel(p.level);
- }
- else
- {
- PlayerBot who = PlayerBot.Find(message);
- if (who == null) { Player.SendMessage(p, "There is no bot " + who + "!"); return; }
- if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
- PlayerBot.Remove(who);
- Player.SendMessage(p, "Removed bot.");
- }
+ if (p == null) { MessageInGameOnly(p); return; }
+
+ try
+ {
+ if (message.ToLower() == "all") {
+ PlayerBot.RemoveAllFromLevel(p.level);
+ } else {
+ PlayerBot who = PlayerBot.Find(message);
+ if (who == null) { Player.SendMessage(p, "There is no bot " + who + "!"); return; }
+ if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
+ PlayerBot.Remove(who);
+ Player.SendMessage(p, "Removed bot.");
}
- catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error caught"); }
}
+ catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error caught"); }
+ }
public override void Help(Player p)
{
diff --git a/Commands/Moderation/CmdBotSummon.cs b/Commands/Moderation/CmdBotSummon.cs
index 834338ffb..972cfb955 100644
--- a/Commands/Moderation/CmdBotSummon.cs
+++ b/Commands/Moderation/CmdBotSummon.cs
@@ -29,11 +29,8 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
+
PlayerBot who = PlayerBot.Find(message);
if (who == null) { Player.SendMessage(p, "There is no bot " + message + "!"); return; }
if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
diff --git a/Commands/Moderation/CmdFollow.cs b/Commands/Moderation/CmdFollow.cs
index fc6df1a9f..0c5232578 100644
--- a/Commands/Moderation/CmdFollow.cs
+++ b/Commands/Moderation/CmdFollow.cs
@@ -29,11 +29,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
if (!p.canBuild)
{
Player.SendMessage(p, "You're currently being &4possessed" + Server.DefaultColor + "!");
diff --git a/Commands/Moderation/CmdHide.cs b/Commands/Moderation/CmdHide.cs
index 05cf40d6a..1c201ca93 100644
--- a/Commands/Moderation/CmdHide.cs
+++ b/Commands/Moderation/CmdHide.cs
@@ -29,7 +29,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
if (message == "check")
{
if (p.hidden)
diff --git a/Commands/Moderation/CmdReferee.cs b/Commands/Moderation/CmdReferee.cs
index a330d777a..e03755219 100644
--- a/Commands/Moderation/CmdReferee.cs
+++ b/Commands/Moderation/CmdReferee.cs
@@ -27,7 +27,7 @@ namespace MCGalaxy.Commands
public CmdReferee() { }
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
if (p.referee)
{
p.referee = false;
diff --git a/Commands/Moderation/CmdVoteKick.cs b/Commands/Moderation/CmdVoteKick.cs
index 310648a4b..f4fe473dc 100644
--- a/Commands/Moderation/CmdVoteKick.cs
+++ b/Commands/Moderation/CmdVoteKick.cs
@@ -28,7 +28,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
if (message == "" || message.IndexOf(' ') != -1) { Help(p); return; }
if (Server.voteKickInProgress) { p.SendMessage("Please wait for the current vote to finish!"); return; }
diff --git a/Commands/Moderation/CmdXhide.cs b/Commands/Moderation/CmdXhide.cs
index db34c88a4..6f2d52121 100644
--- a/Commands/Moderation/CmdXhide.cs
+++ b/Commands/Moderation/CmdXhide.cs
@@ -28,7 +28,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
if (message != "") { Help(p); return; }
if (p.possess != "")
{
diff --git a/Commands/World/CmdGoto.cs b/Commands/World/CmdGoto.cs
index 1637f656b..78740ad49 100644
--- a/Commands/World/CmdGoto.cs
+++ b/Commands/World/CmdGoto.cs
@@ -30,7 +30,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
if (message == "") { Help(p); return; }
try
diff --git a/Commands/World/CmdUnflood.cs b/Commands/World/CmdUnflood.cs
index 8a7518707..8e1e69790 100644
--- a/Commands/World/CmdUnflood.cs
+++ b/Commands/World/CmdUnflood.cs
@@ -27,12 +27,9 @@ namespace MCGalaxy.Commands
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override void Use(Player p, string message) {
- if (p == null) {
- Player.SendMessage(p, "This command can only be used in-game."); return;
- }
- if (message == "") {
- Help(p); return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
+ if (message == "") { Help(p); return; }
+
if (message.ToLower() != "all" && Block.Byte(message) == Block.Zero) {
Player.SendMessage(p, "There is no block \"" + message + "\"."); return;
}
diff --git a/Commands/building/CmdAbort.cs b/Commands/building/CmdAbort.cs
index bc1ac2f8c..0b478cb9c 100644
--- a/Commands/building/CmdAbort.cs
+++ b/Commands/building/CmdAbort.cs
@@ -28,28 +28,24 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p != null)
+ if (p == null) { MessageInGameOnly(p); return; }
+ p.ClearBlockchange();
+ p.painting = false;
+ p.BlockAction = 0;
+ p.cmdTimer = false;
+ p.staticCommands = false;
+ p.deleteMode = false;
+ p.ZoneCheck = false;
+ p.modeType = 0;
+ p.aiming = false;
+ p.onTrain = false;
+ p.isFlying = false;
+ try
{
- p.ClearBlockchange();
- p.painting = false;
- p.BlockAction = 0;
- p.cmdTimer = false;
- p.staticCommands = false;
- p.deleteMode = false;
- p.ZoneCheck = false;
- p.modeType = 0;
- p.aiming = false;
- p.onTrain = false;
- p.isFlying = false;
- try
- {
- p.level.blockqueue.RemoveAll(b => b.p == p);
- }
- finally { BlockQueue.resume(); }
- Player.SendMessage(p, "Every toggle or action was aborted.");
- return;
+ p.level.blockqueue.RemoveAll(b => b.p == p);
}
- Player.SendMessage(p, "This command can only be used in-game!");
+ finally { BlockQueue.resume(); }
+ Player.SendMessage(p, "Every toggle or action was aborted.");
}
public override void Help(Player p)
{
diff --git a/Commands/building/CmdBind.cs b/Commands/building/CmdBind.cs
index 570a60c7b..6ab14a221 100644
--- a/Commands/building/CmdBind.cs
+++ b/Commands/building/CmdBind.cs
@@ -29,11 +29,8 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
+
if (message.Split(' ').Length > 2) { Help(p); return; }
message = message.ToLower();
if (message == "clear")
diff --git a/Commands/building/CmdClick.cs b/Commands/building/CmdClick.cs
index f7895662c..965fc72b9 100644
--- a/Commands/building/CmdClick.cs
+++ b/Commands/building/CmdClick.cs
@@ -28,11 +28,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
string[] parameters = message.Split(' ');
ushort[] click = p.lastClick;
diff --git a/Commands/building/CmdCmdBind.cs b/Commands/building/CmdCmdBind.cs
index 9e120ef1d..bd6039886 100644
--- a/Commands/building/CmdCmdBind.cs
+++ b/Commands/building/CmdCmdBind.cs
@@ -29,11 +29,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
string foundcmd, foundmessage = ""; int foundnum = 0;
if (message.IndexOf(' ') == -1)
diff --git a/Commands/building/CmdDraw.cs b/Commands/building/CmdDraw.cs
index 1ba1ecc51..a30e85f8a 100644
--- a/Commands/building/CmdDraw.cs
+++ b/Commands/building/CmdDraw.cs
@@ -28,9 +28,7 @@ namespace MCGalaxy.Commands
public CmdDraw() { }
public override void Use(Player p, string message) {
- if (p == null) {
- Player.SendMessage(p, "This command can only be used in-game!"); return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
if (p.level.permissionbuild > p.group.Permission) {
p.SendMessage("You can not edit this map."); return;
}
diff --git a/Commands/building/CmdMark.cs b/Commands/building/CmdMark.cs
index efce66c63..509d117d5 100644
--- a/Commands/building/CmdMark.cs
+++ b/Commands/building/CmdMark.cs
@@ -28,18 +28,12 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
- else
- {
- int click1 = (ushort)(p.pos[0] / 32);
- int click2 = (ushort)((p.pos[1] / 32) - 1);
- int click3 = (ushort)(p.pos[2] / 32);
- Command.all.Find("click").Use(p, click1 + " " + click2 + " " + click3);
- }
+ if (p == null) { MessageInGameOnly(p); return; }
+
+ int x = (ushort)(p.pos[0] / 32);
+ int y = (ushort)((p.pos[1] / 32) - 1);
+ int z = (ushort)(p.pos[2] / 32);
+ Command.all.Find("click").Use(p, x + " " + y + " " + z);
}
public override void Help(Player p)
{
diff --git a/Commands/other/CmdAgree.cs b/Commands/other/CmdAgree.cs
index c8886719a..016c65c18 100644
--- a/Commands/other/CmdAgree.cs
+++ b/Commands/other/CmdAgree.cs
@@ -32,16 +32,12 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
+ if (p == null) { MessageInGameOnly(p); return; }
if (Server.agreetorulesonentry == false)
{
Player.SendMessage(p, "This command can only be used if agree-to-rules-on-entry is enabled!");
return;
}
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
//If someone is ranked before agreeing to the rules they are locked and cannot use any commands unless demoted back to guest
/*if (p.group.Permission > LevelPermission.Guest)
{
diff --git a/Commands/other/CmdBotAI.cs b/Commands/other/CmdBotAI.cs
index b043870c1..2800d7518 100644
--- a/Commands/other/CmdBotAI.cs
+++ b/Commands/other/CmdBotAI.cs
@@ -30,12 +30,8 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
+ if (p == null) { MessageInGameOnly(p); return; }
if (message.Split(' ').Length < 2) { Help(p); return; }
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
string foundPath = message.Split(' ')[1].ToLower();
if (!Player.ValidName(foundPath)) { Player.SendMessage(p, "Invalid AI name!"); return; }
diff --git a/Commands/other/CmdC4.cs b/Commands/other/CmdC4.cs
index 05a377f4d..427199e71 100644
--- a/Commands/other/CmdC4.cs
+++ b/Commands/other/CmdC4.cs
@@ -26,28 +26,19 @@ namespace MCGalaxy.Commands
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public CmdC4() { }
- public override void Use(Player p, string message)
- {
- if (p != null)
- {
- if (p.level.physics >= 1 && p.level.physics < 5)
- {
- sbyte numb = Level.C4.NextCircuit(p.level);
- Level.C4.C4s c4 = new Level.C4.C4s(numb);
- p.level.C4list.Add(c4);
- p.c4circuitNumber = numb;
- Player.SendMessage(p, "Place any block for c4 and place a " + c.red + "red" + Server.DefaultColor + " block for the detonator!");
- p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
- return;
- }
- else
- {
- Player.SendMessage(p, "To use c4, the physics level must be 1, 2, 3 or 4");
- return;
- }
+ public override void Use(Player p, string message) {
+ if (p == null) { MessageInGameOnly(p); return; }
+
+ if (p.level.physics >= 1 && p.level.physics < 5) {
+ sbyte numb = Level.C4.NextCircuit(p.level);
+ Level.C4.C4s c4 = new Level.C4.C4s(numb);
+ p.level.C4list.Add(c4);
+ p.c4circuitNumber = numb;
+ Player.SendMessage(p, "Place any block for c4 and place a " + c.red + "red" + Server.DefaultColor + " block for the detonator!");
+ p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
+ } else {
+ Player.SendMessage(p, "To use c4, the physics level must be 1, 2, 3 or 4");
}
- Player.SendMessage(p, "This command can only be used in-game!");
- return;
}
public override void Help(Player p)
{
diff --git a/Commands/other/CmdDisagree.cs b/Commands/other/CmdDisagree.cs
index c1f9e13b8..02224f4ce 100644
--- a/Commands/other/CmdDisagree.cs
+++ b/Commands/other/CmdDisagree.cs
@@ -30,6 +30,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
+ if (p == null) { MessageInGameOnly(p); return; }
if (!Server.agreetorulesonentry)
{
Player.SendMessage(p, "This command can only be used if agree-to-rules-on-entry is enabled in the console!");
@@ -40,11 +41,6 @@ namespace MCGalaxy.Commands
Player.SendMessage(p, "Your awesomeness prevents you from using this command");
return;
}
- if (p == null)
- {
- Player.SendMessage(p, "This command can only be used in-game");
- return;
- }
p.Kick("If you don't agree with the rules, consider playing elsewhere.");
}
diff --git a/Commands/other/CmdReport.cs b/Commands/other/CmdReport.cs
index 7069aa476..50a1fa949 100644
--- a/Commands/other/CmdReport.cs
+++ b/Commands/other/CmdReport.cs
@@ -32,16 +32,9 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null)
- {
- Player.SendMessage(p, "This command can not be used in console!");
- return;
- }
- if (message == "")
- {
- Help(p);
- return;
- }
+ if (p == null) { MessageInGameOnly(p); return; }
+ if (message == "") { Help(p); return; }
+
int length = message.Split(' ').Length;
try
{
diff --git a/Commands/other/CmdWarp.cs b/Commands/other/CmdWarp.cs
index 93d8a468b..2a44539c1 100644
--- a/Commands/other/CmdWarp.cs
+++ b/Commands/other/CmdWarp.cs
@@ -28,7 +28,7 @@ namespace MCGalaxy.Commands
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
string[] command = message.ToLower().Split(' ');
string par0 = String.Empty;
string par1 = String.Empty;
diff --git a/Commands/other/CmdWaypoint.cs b/Commands/other/CmdWaypoint.cs
index 1d5d547b6..adedb2eb6 100644
--- a/Commands/other/CmdWaypoint.cs
+++ b/Commands/other/CmdWaypoint.cs
@@ -29,7 +29,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
- if (p == null) { Player.SendMessage(p, "This command can only be used in-game"); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
string[] command = message.ToLower().Split(' ');
string par0 = String.Empty;
string par1 = String.Empty;