Now with less use of Command.All.Find()

This commit is contained in:
UnknownShadow200 2016-06-20 10:49:52 +10:00
parent 1eee2dda2c
commit b098e32481
7 changed files with 16 additions and 23 deletions

View File

@ -73,7 +73,7 @@ namespace MCGalaxy.Commands
} else if (cmd == "SPAWN") {
Command.all.Find("setspawn").Use(p, "");
} else if (cmd == "PRESET") {
Command.all.Find("env").Use(p, "l preset " + arg);
Command.all.Find("env").Use(p, "preset " + arg);
} else if (cmd == "ENV") {
HandleEnvCommand(p, arg, arg2);
} else if (cmd == "MAP") {

View File

@ -18,9 +18,7 @@
using System;
namespace MCGalaxy.Commands {
public class CmdNotes : Command {
public override string name { get { return "notes"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Moderation; } }
@ -74,8 +72,7 @@ namespace MCGalaxy.Commands {
}
}
public class CmdMyNotes : Command {
public sealed class CmdMyNotes : CmdNotes {
public override string name { get { return "mynotes"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Other; } }
@ -83,8 +80,8 @@ namespace MCGalaxy.Commands {
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); }
Command.all.Find("notes").Use(p, p.name);
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
base.Use(p, p.name);
}
public override void Help(Player p) {

View File

@ -34,16 +34,15 @@ namespace MCGalaxy.Commands
Player.Message(p, "There is no block \"" + message + "\"."); return;
}
int phys = p.level.physics;
Command.all.Find("physics").Use(p, "0");
CmdPhysics.SetPhysics(p.level, 0);
Command cmd = Command.all.Find("replaceall");
string args = message.CaselessEq("all") ?
"lavafall waterfall lava_fast active_lava active_water " +
"active_hot_lava active_cold_water fast_hot_lava magma geyser air" :
message + " air";
cmd.Use(p, args);
"active_hot_lava active_cold_water fast_hot_lava magma geyser" : message;
cmd.Use(p, args + " air");
Command.all.Find("physics").Use(p, phys.ToString());
CmdPhysics.SetPhysics(p.level, phys);
Player.GlobalMessage("Unflooded!");
}

View File

@ -20,7 +20,7 @@ using MCGalaxy.Drawing.Brushes;
using MCGalaxy.Drawing.Ops;
namespace MCGalaxy.Commands.Building {
public sealed class CmdWriteText : Command {
public class CmdWriteText : Command {
public override string name { get { return "writetext"; } }
public override string shortcut { get { return "wrt"; } }
public override string type { get { return CommandTypes.Building; } }
@ -86,16 +86,13 @@ namespace MCGalaxy.Commands.Building {
}
}
public sealed class CmdWrite : Command {
public sealed class CmdWrite : CmdWriteText {
public override string name { get { return "write"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Building; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override void Use(Player p, string message) {
Command.all.Find("writetext").Use(p, "1 1 " + message);
if (message == "") { Help(p); return; }
base.Use(p, "1 1 " + message);
}
public override void Help(Player p) {

View File

@ -888,7 +888,7 @@ namespace MCGalaxy.Gui
}
else
{
Command.all.Find("Impersonate").Use(null, prpertiesofplyer.name + " " + ImpersonateORSendCmdTxt.Text);
Command.all.Find("impersonate").Use(null, prpertiesofplyer.name + " " + ImpersonateORSendCmdTxt.Text);
PlayersTextBox.AppendTextAndScroll("Sent Message '" + ImpersonateORSendCmdTxt.Text + "' as player");
}
ImpersonateORSendCmdTxt.Text = "";

View File

@ -192,6 +192,7 @@
<Compile Include="Commands\CPE\CmdModel.cs" />
<Compile Include="Commands\CPE\CmdReachDistance.cs" />
<Compile Include="Commands\CPE\CmdSkin.cs" />
<Compile Include="Commands\CPE\CmdTexture.cs" />
<Compile Include="Commands\CPE\CustomBlockCommand.cs" />
<Compile Include="Commands\Economy\CmdAward.cs" />
<Compile Include="Commands\Economy\CmdAwardMod.cs" />
@ -388,7 +389,6 @@
<Compile Include="Commands\World\CmdReveal.cs" />
<Compile Include="Commands\World\CmdSave.cs" />
<Compile Include="Commands\World\CmdSetspawn.cs" />
<Compile Include="Commands\World\CmdTexture.cs" />
<Compile Include="Commands\World\CmdUnflood.cs" />
<Compile Include="Commands\World\CmdUnload.cs" />
<Compile Include="Commands\World\PermissionCmd.cs" />