mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
Remove /repeat as a separate command, just keep /.
This commit is contained in:
parent
07fc31d061
commit
24d11b7189
@ -1,44 +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.Misc {
|
||||
public sealed class CmdRepeat : Command {
|
||||
public override string name { get { return "repeat"; } }
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (p.lastCMD == "") { Player.Message(p, "No commands used yet."); return; }
|
||||
|
||||
Player.Message(p, "Repeating &b/" + p.lastCMD);
|
||||
int argsIndex = p.lastCMD.IndexOf(' ');
|
||||
string cmdName = argsIndex == -1 ? p.lastCMD : p.lastCMD.Substring(0, argsIndex);
|
||||
string cmdMsg = argsIndex == -1 ? "" : p.lastCMD.Substring(argsIndex + 1);
|
||||
|
||||
Command cmd = Command.all.Find(cmdName);
|
||||
if (cmd == null) { Player.Message(p, "Unknown command \"" + cmdName + "\"."); }
|
||||
if (p != null && !p.group.CanExecute(cmd)) { cmd.MessageCannotUse(p); return; }
|
||||
cmd.Use(p, cmdMsg);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/repeat");
|
||||
Player.Message(p, "%HRepeats the last used command");
|
||||
}
|
||||
}
|
||||
}
|
@ -340,7 +340,6 @@
|
||||
<Compile Include="Commands\other\CmdHackRank.cs" />
|
||||
<Compile Include="Commands\other\CmdInvincible.cs" />
|
||||
<Compile Include="Commands\other\CmdKill.cs" />
|
||||
<Compile Include="Commands\other\CmdRepeat.cs" />
|
||||
<Compile Include="Commands\other\CmdRide.cs" />
|
||||
<Compile Include="Commands\other\CmdSendCmd.cs" />
|
||||
<Compile Include="Commands\other\CmdSummon.cs" />
|
||||
|
@ -165,14 +165,14 @@ namespace MCGalaxy {
|
||||
/// <remarks> Adds to the BlockDB. Also turns block below to grass/dirt depending on light. </remarks>
|
||||
/// <returns> Return code from DoBlockchange </returns>
|
||||
public int ChangeBlock(ushort x, ushort y, ushort z, ExtBlock block) {
|
||||
ExtBlock old = level.GetExtBlock(x, y, z);
|
||||
ExtBlock old = level.GetExtBlock(x, y, z);
|
||||
int type = level.DoBlockchange(this, x, y, z, block);
|
||||
if (type == 0) return type; // no change performed
|
||||
if (type == 2) Player.GlobalBlockchange(level, x, y, z, block); // different visually
|
||||
|
||||
ushort flags = BlockDBFlags.ManualPlace;
|
||||
if (painting && Replacable(old.BlockID)) flags = BlockDBFlags.Painted;
|
||||
level.BlockDB.Cache.Add(this, x, y, z, flags, old, block);
|
||||
level.BlockDB.Cache.Add(this, x, y, z, flags, old, block);
|
||||
|
||||
bool autoGrass = level.GrassGrow && (level.physics == 0 || level.physics == 5);
|
||||
if (!autoGrass) return type;
|
||||
@ -214,8 +214,8 @@ namespace MCGalaxy {
|
||||
|
||||
int PacketSize(byte[] buffer) {
|
||||
switch (buffer[0]) {
|
||||
case (byte)'G': return -2; //For wom
|
||||
case Opcode.Handshake: return 131;
|
||||
case (byte)'G': return -2; //For wom
|
||||
case Opcode.Handshake: return 131;
|
||||
case Opcode.SetBlockClient:
|
||||
if (!loggedIn) goto default;
|
||||
return 9;
|
||||
@ -242,7 +242,7 @@ namespace MCGalaxy {
|
||||
|
||||
void HandlePacket(byte[] buffer) {
|
||||
switch (buffer[0]) {
|
||||
case Opcode.Ping: break;
|
||||
case Opcode.Ping: break;
|
||||
case Opcode.Handshake:
|
||||
HandleLogin(buffer); break;
|
||||
case Opcode.SetBlockClient:
|
||||
@ -626,22 +626,29 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
bool DoCommand(string text) {
|
||||
// Typing / will act as /repeat
|
||||
// Typing / repeats last command executed
|
||||
if (text == "/") {
|
||||
HandleCommand("repeat", ""); return true;
|
||||
if (lastCMD == "") {
|
||||
Player.Message(this, "Cannot repeat command: You haven't used any commands yet.");
|
||||
return true;
|
||||
}
|
||||
text = lastCMD;
|
||||
Player.Message(this, "Repeating %T/" + lastCMD);
|
||||
} else if (text[0] == '/' || text[0] == '!') {
|
||||
text = text.Remove(0, 1);
|
||||
int sep = text.IndexOf(' ');
|
||||
if (sep == -1) {
|
||||
HandleCommand(text.ToLower(), "");
|
||||
} else {
|
||||
string cmd = text.Substring(0, sep).ToLower();
|
||||
string msg = text.Substring(sep + 1);
|
||||
HandleCommand(cmd, msg);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
int sep = text.IndexOf(' ');
|
||||
if (sep == -1) {
|
||||
HandleCommand(text.ToLower(), "");
|
||||
} else {
|
||||
string cmd = text.Substring(0, sep).ToLower();
|
||||
string msg = text.Substring(sep + 1);
|
||||
HandleCommand(cmd, msg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
string HandleJoker(string text) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user