Skip to content

Commit

Permalink
Quit/RageQuit/Hacks/CrashServer should not be usable from console/IRC
Browse files Browse the repository at this point in the history
Also fix LeaveServer to do nothing when used by console/IRC, instead of throwing an exception
  • Loading branch information
UnknownShadow200 committed May 9, 2020
1 parent 2dee378 commit e3ef369
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions MCGalaxy/Commands/other/QuitCmds.cs
Expand Up @@ -25,6 +25,7 @@ public sealed class CmdRagequit : Command2 {
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!!");
Expand All @@ -40,6 +41,7 @@ public sealed class CmdQuit : Command2 {
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.";
Expand All @@ -58,6 +60,7 @@ public sealed class CmdCrashServer : Command2 {
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; }
Expand All @@ -76,6 +79,7 @@ public sealed class CmdHacks : Command2 {
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) {
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/Player/Player.cs
Expand Up @@ -213,7 +213,7 @@ public partial class Player : Entity, IDisposable {

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;
Expand Down

0 comments on commit e3ef369

Please sign in to comment.