Combine various quit-type commands into one class.

This commit is contained in:
UnknownShadow200 2016-06-05 15:36:20 +10:00
parent 1459c88c33
commit ca7902edac
6 changed files with 96 additions and 151 deletions

View File

@ -1,41 +0,0 @@
/*
Copyright 2010 MCLawl (Modified for use with MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
namespace MCGalaxy.Commands {
public sealed class CmdCrashServer : Command {
public override string name { get { return "crashserver"; } }
public override string shortcut { get { return "crash"; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override void Use(Player p, string message) {
if (message != "") { Help(p); return; }
int code = p.random.Next(int.MinValue, int.MaxValue);
string msg = "Server crash! Error code 0x" + Convert.ToString(code, 16).ToUpper();
p.LeaveServer(msg, msg);
}
public override void Help(Player p) {
Player.Message(p, "/crashserver - Crash the server with a generic error");
}
}
}

View File

@ -1,48 +0,0 @@
/*
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Threading;
namespace MCGalaxy.Commands
{
public sealed class CmdHacks : Command
{
public override string name { get { return "hacks"; } }
public override string shortcut { get { return "hax"; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public CmdHacks() { }
public override void Use(Player p, string message)
{
string[] words = message.Split(' ');
if (words.Length >= 1 && message != "")
{
Player.Message(p, "&cIncorrect syntax. Abuse detected.");
Thread.Sleep(3000);
}
const string msg = "Your IP has been backtraced + reported to FBI Cyber Crimes Unit.";
p.LeaveServer(msg, msg);
}
public override void Help(Player p)
{
Player.Message(p, "/hacks - Performs various server hacks. OPERATORS ONLY!!!");
}
}
}

View File

@ -1,22 +0,0 @@
using System;
namespace MCGalaxy.Commands {
public sealed class CmdQuit : Command {
public override string name { get { return "quit"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Other; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public override void Use(Player p, string message) {
string msg = message != "" ? "Left the game: " + message : "Left the game.";
p.LeaveServer(msg, msg);
}
public override void Help(Player p) {
Player.Message(p, "/quit <reason> - Leave the server.");
}
}
}

View File

@ -1,36 +0,0 @@
/*
Copyright 2011 MCForge
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
namespace MCGalaxy.Commands {
public sealed class CmdRagequit : Command {
public override string name { get { return "ragequit"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Other; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override void Use(Player p, string message) {
p.LeaveServer("RAGEQUIT!!", "RAGEQUIT!!");
}
public override void Help(Player p) {
Player.Message(p, "/ragequit - Makes you ragequit");
}
}
}

View File

@ -0,0 +1,95 @@
/*
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
Copyright 2011 MCForge
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Threading;
namespace MCGalaxy.Commands {
public sealed class CmdRagequit : Command {
public override string name { get { return "ragequit"; } }
public override string shortcut { get { return "rq"; } }
public override string type { get { return CommandTypes.Other; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override void Use(Player p, string message) {
p.LeaveServer("RAGEQUIT!!", "RAGEQUIT!!");
}
public override void Help(Player p) {
Player.Message(p, "/ragequit - Makes you ragequit");
}
}
public sealed class CmdQuit : Command {
public override string name { get { return "quit"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Other; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public override void Use(Player p, string message) {
string msg = message != "" ? "Left the game: " + message : "Left the game.";
p.LeaveServer(msg, msg);
}
public override void Help(Player p) {
Player.Message(p, "/quit <reason> - Leave the server.");
}
}
public sealed class CmdCrashServer : Command {
public override string name { get { return "crashserver"; } }
public override string shortcut { get { return "crash"; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override void Use(Player p, string message) {
if (message != "") { Help(p); return; }
int code = p.random.Next(int.MinValue, int.MaxValue);
string msg = "Server crash! Error code 0x" + Convert.ToString(code, 16).ToUpper();
p.LeaveServer(msg, msg);
}
public override void Help(Player p) {
Player.Message(p, "/crashserver - Crash the server with a generic error");
}
}
public sealed class CmdHacks : Command {
public override string name { get { return "hacks"; } }
public override string shortcut { get { return "hax"; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override void Use(Player p, string message) {
if (message != "") {
Player.Message(p, "&cIncorrect syntax. Abuse detected.");
Thread.Sleep(3000);
}
const string msg = "Your IP has been backtraced + reported to FBI Cyber Crimes Unit.";
p.LeaveServer(msg, msg);
}
public override void Help(Player p) {
Player.Message(p, "/hacks - Performs various server hacks. OPERATORS ONLY!!!");
}
}
}

View File

@ -272,11 +272,9 @@
<Compile Include="Commands\Moderation\CmdBlockSet.cs" />
<Compile Include="Commands\Moderation\CmdBlockSpeed.cs" />
<Compile Include="Commands\Moderation\CmdCmdSet.cs" />
<Compile Include="Commands\Moderation\CmdCrashServer.cs" />
<Compile Include="Commands\Moderation\CmdExplode.cs" />
<Compile Include="Commands\Moderation\CmdFollow.cs" />
<Compile Include="Commands\Moderation\CmdFreeze.cs" />
<Compile Include="Commands\Moderation\CmdHacks.cs" />
<Compile Include="Commands\Moderation\CmdHide.cs" />
<Compile Include="Commands\Moderation\CmdHighlight.cs" />
<Compile Include="Commands\Moderation\CmdInfoSwap.cs" />
@ -340,8 +338,6 @@
<Compile Include="Commands\other\CmdMove.cs" />
<Compile Include="Commands\other\CmdNick.cs" />
<Compile Include="Commands\other\CmdPass.cs" />
<Compile Include="Commands\other\CmdQuit.cs" />
<Compile Include="Commands\other\CmdRagequit.cs" />
<Compile Include="Commands\other\CmdRepeat.cs" />
<Compile Include="Commands\other\CmdReport.cs" />
<Compile Include="Commands\other\CmdResetPass.cs" />
@ -365,6 +361,7 @@
<Compile Include="Commands\other\CmdWarp.cs" />
<Compile Include="Commands\other\CmdWaypoint.cs" />
<Compile Include="Commands\other\CmdXJail.cs" />
<Compile Include="Commands\other\QuitCmds.cs" />
<Compile Include="Commands\Scripting\CmdCmdCreate.cs" />
<Compile Include="Commands\Scripting\CmdCmdLoad.cs" />
<Compile Include="Commands\Scripting\CmdCmdUnload.cs" />