Implement /topfive and /topten as aliases in /top, instead of separate commands.

This commit is contained in:
UnknownShadow200 2016-06-17 09:48:41 +10:00
parent 58148c5da2
commit 831142961d
9 changed files with 28 additions and 68 deletions

View File

@ -19,19 +19,20 @@ using System;
using System.Data;
using MCGalaxy.SQL;
namespace MCGalaxy.Commands {
namespace MCGalaxy.Commands {
public sealed class CmdTop : Command {
public override string name { get { return "top"; } }
public override string shortcut { get { return "top"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Information; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public CmdTop() { }
public override void Use(Player p, string message)
{
public override CommandAlias[] Aliases {
get { return new [] { new CommandAlias("topten", null, "10"), new CommandAlias("topfive", null, "5") }; }
}
public override void Use(Player p, string message) {
string[] args;
if (message == "" || (args = message.Split(' ')).Length < 2) {
Help(p); return;
@ -119,58 +120,16 @@ namespace MCGalaxy.Commands {
}
public override void Help(Player p) {
Player.Message(p, "%2/top [#] [number] - Prints a particular top list with number of entries");
SendRecognisedTypes(p);
}
internal static void SendRecognisedTypes(Player p) {
Player.Message(p, "1) Most logins 2) Most deaths");
Player.Message(p, "3) Money 4) First Players");
Player.Message(p, "5) Recent Players 6) Blocks Modified");
Player.Message(p, "7) Most kicks");
Player.Message(p, "%T/top [stat] [number of players to show]");
Player.Message(p, "%HPrints a list of players who have the " +
"most/top of a particular stat. Available stats:");
Player.Message(p, "1) Most logins, 2) Most deaths, 3) Money");
Player.Message(p, "4) First joined, 5) Recently joined");
Player.Message(p, "6) Blocks Modified, 7) Most kicks");
if (!Server.zombie.Running) return;
Player.Message(p, "8) Most infected 9) Most rounds survived");
Player.Message(p, "10) Max infected 11) Max rounds survived");
}
}
public sealed class CmdTopFive : Command {
public override string name { get { return "topfive"; } }
public override string shortcut { get { return "5"; } }
public override string type { get { return CommandTypes.Information; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public CmdTopFive() { }
public override void Use(Player p, string message) {
if (message == "") { Help(p); return; }
Command.all.Find("top").Use(p, message + " 5 ");
}
public override void Help(Player p) {
Player.Message(p, "%2/topfive [#] - Prints a particular top five list");
CmdTop.SendRecognisedTypes(p);
}
}
public sealed class CmdTopTen : Command {
public override string name { get { return "topten"; } }
public override string shortcut { get { return "10"; } }
public override string type { get { return CommandTypes.Information; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public CmdTopTen() { }
public override void Use(Player p, string message) {
if (message == "") { Help(p); return; }
Command.all.Find("top").Use(p, message + " 10 ");
}
public override void Help(Player p) {
Player.Message(p, "%2/topten [#] - Prints a particular top ten list");
CmdTop.SendRecognisedTypes(p);
Player.Message(p, "8) Most infected, 9) Most rounds survived");
Player.Message(p, "10) Max infected, 11) Max rounds survived");
}
}
}

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Commands {
MessageTooHighRank(p, "teleport", true); return;
}
Player.Message(p, "Attempting to teleport " + source.name + " to " + target.name + ".");
Command.all.Find("tp").Use(source, target.name);
Command.all.Find("tp").Use(source, target.name);
}
public override void Help(Player p) {

View File

@ -73,7 +73,7 @@ namespace MCGalaxy.Commands {
}
public override void Help(Player p) {
Player.Message(p, "%T/unban <player> [reason]"");
Player.Message(p, "%T/unban <player> [reason]");
Player.Message(p, "%HUnbans a player. This includes temporary bans.");
}
}

View File

@ -45,7 +45,8 @@ namespace MCGalaxy.Commands.Building {
}
public override void Help(Player p) {
Player.Message(p, "%T/abort %H- Cancels an action.");
Player.Message(p, "%T/abort");
Player.Message(p, "%HCancels an action.");
}
}
}

View File

@ -65,7 +65,8 @@ namespace MCGalaxy.Commands.Building {
struct CatchPos { public byte type, extType, newType, newExtType; public ushort x, y, z; }
public override void Help(Player p) {
Player.Message(p, "/outline [type] [type2] - Outlines [type] with [type2]");
Player.Message(p, "%T/outline [type] [type2]");
Player.Message(p, "%HOutlines [type] with [type2]");
}
}
}

View File

@ -99,8 +99,9 @@ namespace MCGalaxy.Commands.Building {
}
public override void Help(Player p) {
Player.Message(p, "/write [message] - Writes [message] in blocks");
Player.Message(p, "Note that this command has been deprecated by /writetext.");
Player.Message(p, "%T/write [message]");
Player.Message(p, "%HWrites [message] in blocks");
Player.Message(p, "%HNote that this command has been deprecated by /writetext.");
}
}
}

View File

@ -31,11 +31,9 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
Command CmdFly = Command.all.Find("fly");
if (p.level.ctfmode)
{
if (p.level.ctfmode) {
Player.Message(p, "You can not fly while playing CTF, that is cheating!");
if (p.isFlying) CmdFly.Use(p, String.Empty);
p.isFlying = false;
return;
}
p.isFlying = !p.isFlying;

View File

@ -188,6 +188,7 @@
<Compile Include="Commands\CommandList.cs" />
<Compile Include="Commands\CommandOtherPerms.cs" />
<Compile Include="Commands\CPE\CmdCustomColors.cs" />
<Compile Include="Commands\CPE\CmdEnvironment.cs" />
<Compile Include="Commands\CPE\CmdModel.cs" />
<Compile Include="Commands\CPE\CmdReachDistance.cs" />
<Compile Include="Commands\CPE\CmdSkin.cs" />
@ -370,7 +371,6 @@
<Compile Include="Commands\World\CmdBlockDB.cs" />
<Compile Include="Commands\World\CmdCopyLVL.cs" />
<Compile Include="Commands\World\CmdDeleteLvl.cs" />
<Compile Include="Commands\World\CmdEnvironment.cs" />
<Compile Include="Commands\World\CmdFixGrass.cs" />
<Compile Include="Commands\World\CmdGoto.cs" />
<Compile Include="Commands\World\CmdImport.cs" />