Make commands that are designed to only be used in-game show 'can only be used in game' when called from IRC.

This commit is contained in:
UnknownShadow200 2016-06-10 23:22:37 +10:00
parent b2e59bd7cd
commit 9ba03f3bd4
30 changed files with 31 additions and 33 deletions

View File

@ -26,7 +26,7 @@ namespace MCGalaxy.Commands.CPE {
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } } public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message == "") { Help(p); return; } if (message == "") { Help(p); return; }
float dist; float dist;

View File

@ -38,7 +38,7 @@ namespace MCGalaxy.Commands {
} }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
string[] parts = message.ToLower().Split(' '); string[] parts = message.ToLower().Split(' ');
if (parts.Length == 0) { if (parts.Length == 0) {

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands {
public override CommandEnable Enabled { get { return CommandEnable.Economy; } } public override CommandEnable Enabled { get { return CommandEnable.Economy; } }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
string[] parts = message.Split(' '); string[] parts = message.Split(' ');
foreach (Item item in Economy.Items) foreach (Item item in Economy.Items)

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands {
public override CommandEnable Enabled { get { return CommandEnable.Zombie | CommandEnable.Lava; } } public override CommandEnable Enabled { get { return CommandEnable.Zombie | CommandEnable.Lava; } }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (!p.EnoughMoney(10)) { if (!p.EnoughMoney(10)) {
Player.Message(p, "You need &f10 " + Server.moneys + " %Sto enter the lottery."); return; Player.Message(p, "You need &f10 " + Server.moneys + " %Sto enter the lottery."); return;
} }

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands {
public CmdHuman() { } public CmdHuman() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (p.Game.PledgeSurvive) { if (p.Game.PledgeSurvive) {
Player.Message(p, "You cannot un-pledge that you will be infected."); return; Player.Message(p, "You cannot un-pledge that you will be infected."); return;
} }

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands {
public CmdReferee() { } public CmdReferee() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (p.Game.Referee) { if (p.Game.Referee) {
Player.SendChatFrom(p, p.ColoredName + " %Sis no longer a referee", false); Player.SendChatFrom(p, p.ColoredName + " %Sis no longer a referee", false);

View File

@ -31,10 +31,8 @@ namespace MCGalaxy.Commands
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } } public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public CmdAbout() { } public CmdAbout() { }
public override void Use(Player p, string message) public override void Use(Player p, string message) {
{ if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (p == null) { MessageInGameOnly(p); return; }
Player.Message(p, "Break/build a block to display information."); Player.Message(p, "Break/build a block to display information.");
p.ClearBlockchange(); p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(AboutBlockchange); p.Blockchange += new Player.BlockchangeEventHandler(AboutBlockchange);

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands {
public CmdAfk() { } public CmdAfk() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message == "list") { if (message == "list") {
Player[] players = PlayerInfo.Online.Items; Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) { foreach (Player pl in players) {

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) public override void Use(Player p, string message)
{ {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (!p.canBuild) if (!p.canBuild)
{ {
Player.Message(p, "You're currently being &4possessed%S!"); Player.Message(p, "You're currently being &4possessed%S!");

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Commands
public CmdHide() { } public CmdHide() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message == "check") { if (message == "check") {
string state = p.hidden ? "" : "not "; string state = p.hidden ? "" : "not ";
Player.Message(p, "You are " + state + "currently hidden!"); return; Player.Message(p, "You are " + state + "currently hidden!"); return;

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
long seconds; long seconds;
bool FoundUser = false; bool FoundUser = false;
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message == "") message = p.name + " 300"; if (message == "") message = p.name + " 300";
string[] args = message.Split(' '); string[] args = message.Split(' ');
string name = args[0]; string name = args[0];

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) public override void Use(Player p, string message)
{ {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message != "") { Help(p); return; } if (message != "") { Help(p); return; }
List<string> getpatrol = (from pl in PlayerInfo.players where (int) pl.@group.Permission <= CommandOtherPerms.GetPerm(this) select pl.name).ToList(); List<string> getpatrol = (from pl in PlayerInfo.players where (int) pl.@group.Permission <= CommandOtherPerms.GetPerm(this) select pl.name).ToList();

View File

@ -28,7 +28,7 @@ namespace MCGalaxy.Commands {
public CmdPossess() { } public CmdPossess() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
string[] args = message.Split(' '); string[] args = message.Split(' ');
if (args.Length > 2) { Help(p); return; } if (args.Length > 2) { Help(p); return; }

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
CatchPos cpos = default(CatchPos); CatchPos cpos = default(CatchPos);
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message == "") { Player.Message(p, "You need to provide a player name."); return; } if (message == "") { Player.Message(p, "You need to provide a player name."); return; }
string[] parts = message.Split(' '); string[] parts = message.Split(' ');

View File

@ -96,7 +96,7 @@ namespace MCGalaxy.Commands {
} }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
CmdReveal.ReloadMap(p, p, false); CmdReveal.ReloadMap(p, p, false);
} }

View File

@ -25,7 +25,7 @@ namespace MCGalaxy.Commands.Building {
public CmdAbort() { } public CmdAbort() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
p.ClearBlockchange(); p.ClearBlockchange();
p.painting = false; p.painting = false;
p.cmdTimer = false; p.cmdTimer = false;

View File

@ -25,7 +25,7 @@ namespace MCGalaxy.Commands.Building {
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (message == "") { Help(p); return; } if (message == "") { Help(p); return; }
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
string[] args = message.ToLower().Split(' '); string[] args = message.ToLower().Split(' ');
if (args.Length > 2) { Help(p); return; } if (args.Length > 2) { Help(p); return; }

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands.Building {
} }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message == "") { if (message == "") {
Player.Message(p, "Your current brush is: " + p.BrushName); return; Player.Message(p, "Your current brush is: " + p.BrushName); return;
} }

View File

@ -28,7 +28,7 @@ namespace MCGalaxy.Commands {
static char[] trimChars = { ' ' }; static char[] trimChars = { ' ' };
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message == "") { if (message == "") {
bool foundBind = false; bool foundBind = false;

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands.Building {
} }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
// convert player pos to block coords // convert player pos to block coords
Vec3U16 P = Vec3U16.ClampPos(p.pos[0], (ushort)(p.pos[1] - 32), p.pos[2], p.level); Vec3U16 P = Vec3U16.ClampPos(p.pos[0], (ushort)(p.pos[1] - 32), p.pos[2], p.level);
P.X /= 32; P.Y /= 32; P.Z /= 32; P.X /= 32; P.Y /= 32; P.Z /= 32;

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands.Building {
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (message == "") { Help(p); return; } if (message == "") { Help(p); return; }
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
string replaceCmd = ReplaceNot ? "replacenot" : "replace"; string replaceCmd = ReplaceNot ? "replacenot" : "replace";
if (!p.group.CanExecute(replaceCmd) || !p.group.CanExecute("brush")) { if (!p.group.CanExecute(replaceCmd) || !p.group.CanExecute("brush")) {
Player.Message(p, "You cannot use /brush and/or /" + replaceCmd + Player.Message(p, "You cannot use /brush and/or /" + replaceCmd +

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Building {
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
ushort distance = 0, interval = 0; ushort distance = 0, interval = 0;
if (message == "") { Help(p); return; } if (message == "") { Help(p); return; }
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
string[] parts = message.Split(' '); string[] parts = message.Split(' ');
if (!ushort.TryParse(parts[0], out distance)) { if (!ushort.TryParse(parts[0], out distance)) {

View File

@ -28,7 +28,7 @@ namespace MCGalaxy.Commands.Building {
static char[] trimChars = {' '}; static char[] trimChars = {' '};
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
int mode = TreeDrawOp.T_Tree; int mode = TreeDrawOp.T_Tree;
string[] parts = message.Split(trimChars, 2); string[] parts = message.Split(trimChars, 2);
string brushMsg = parts.Length >= 2 ? parts[1] : ""; string brushMsg = parts.Length >= 2 ? parts[1] : "";

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Building {
static char[] trimChars = { ' ' }; static char[] trimChars = { ' ' };
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (!p.group.CanExecute("write")) { if (!p.group.CanExecute("write")) {
Player.Message(p, "You must be able to use /write to use /writetext."); return; Player.Message(p, "You must be able to use /write to use /writetext."); return;
} }

View File

@ -25,7 +25,7 @@ namespace MCGalaxy.Commands.Building {
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } } public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
message = message.ToLower(); message = message.ToLower();
string[] parts = message.Split(' '); string[] parts = message.Split(' ');
CatchPos cpos = default(CatchPos); CatchPos cpos = default(CatchPos);

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) public override void Use(Player p, string message)
{ {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (Server.agreetorulesonentry == false) if (Server.agreetorulesonentry == false)
{ {
Player.Message(p, "This command can only be used if agree-to-rules-on-entry is enabled!"); Player.Message(p, "This command can only be used if agree-to-rules-on-entry is enabled!");

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands
public CmdC4() { } public CmdC4() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (p.level.physics >= 1 && p.level.physics < 5) { if (p.level.physics >= 1 && p.level.physics < 5) {
sbyte numb = C4Physics.NextCircuit(p.level); sbyte numb = C4Physics.NextCircuit(p.level);

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands
public CmdChain() { } public CmdChain() { }
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (p.level.permissionbuild > p.group.Permission) { if (p.level.permissionbuild > p.group.Permission) {
Player.Message(p, "You cannot build on this map!"); return; Player.Message(p, "You cannot build on this map!"); return;
} }

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) public override void Use(Player p, string message)
{ {
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (!Server.agreetorulesonentry) if (!Server.agreetorulesonentry)
{ {
Player.Message(p, "This command can only be used if agree-to-rules-on-entry is enabled in the console!"); Player.Message(p, "This command can only be used if agree-to-rules-on-entry is enabled in the console!");

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) public override void Use(Player p, string message)
{ {
if (message == "") { Help(p); return; } if (message == "") { Help(p); return; }
if (p == null) { MessageInGameOnly(p); return; } if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message.ToLower() == "all") if (message.ToLower() == "all")
{ {
Player[] players = PlayerInfo.Online.Items; Player[] players = PlayerInfo.Online.Items;