From e3ef369c38abd45736da76f228dac7ca05bd946f Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 9 May 2020 15:35:29 +1000 Subject: [PATCH] Quit/RageQuit/Hacks/CrashServer should not be usable from console/IRC Also fix LeaveServer to do nothing when used by console/IRC, instead of throwing an exception --- MCGalaxy/Commands/other/QuitCmds.cs | 4 ++++ MCGalaxy/Player/Player.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/MCGalaxy/Commands/other/QuitCmds.cs b/MCGalaxy/Commands/other/QuitCmds.cs index 74897298b..0ca7554c3 100644 --- a/MCGalaxy/Commands/other/QuitCmds.cs +++ b/MCGalaxy/Commands/other/QuitCmds.cs @@ -25,6 +25,7 @@ namespace MCGalaxy.Commands.Misc { public override string shortcut { get { return "rq"; } } public override string type { get { return CommandTypes.Other; } } public override bool MessageBlockRestricted { get { return true; } } + public override bool SuperUseable { get { return false; } } public override void Use(Player p, string message, CommandData data) { p.Leave("RAGEQUIT!!"); @@ -40,6 +41,7 @@ namespace MCGalaxy.Commands.Misc { public override string name { get { return "Quit"; } } public override string type { get { return CommandTypes.Other; } } public override bool MessageBlockRestricted { get { return true; } } + public override bool SuperUseable { get { return false; } } public override void Use(Player p, string message, CommandData data) { string msg = message.Length > 0 ? "Left the game: " + message : "Left the game."; @@ -58,6 +60,7 @@ namespace MCGalaxy.Commands.Misc { public override string shortcut { get { return "Crash"; } } public override string type { get { return CommandTypes.Moderation; } } public override bool MessageBlockRestricted { get { return true; } } + public override bool SuperUseable { get { return false; } } public override void Use(Player p, string message, CommandData data) { if (message.Length > 0) { Help(p); return; } @@ -76,6 +79,7 @@ namespace MCGalaxy.Commands.Misc { public override string shortcut { get { return "Hax"; } } public override string type { get { return CommandTypes.Moderation; } } public override bool MessageBlockRestricted { get { return true; } } + public override bool SuperUseable { get { return false; } } public override void Use(Player p, string message, CommandData data) { if (message.Length > 0) { diff --git a/MCGalaxy/Player/Player.cs b/MCGalaxy/Player/Player.cs index 9534cf53c..126c65d3f 100644 --- a/MCGalaxy/Player/Player.cs +++ b/MCGalaxy/Player/Player.cs @@ -213,7 +213,7 @@ namespace MCGalaxy { bool leftServer = false; void LeaveServer(string chatMsg, string discMsg, bool isKick, bool sync = false) { - if (leftServer) return; + if (leftServer || IsSuper) return; leftServer = true; CriticalTasks.Clear(); ZoneIn = null;