mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 14:17:29 -04:00
Core: /search blocks and /blocks now use lowest rank colour
This commit is contained in:
parent
9c655dab19
commit
06707b1ee3
@ -39,25 +39,19 @@ namespace MCGalaxy.Commands
|
||||
|
||||
if (args[0] == "" || args[0].CaselessEq("basic")) {
|
||||
Player.Message(p, "Basic blocks: ");
|
||||
MultiPageOutput.Output(p, BasicBlocks(), (name, i) => name,
|
||||
MultiPageOutput.Output(p, BasicBlocks(), FormatBlockName,
|
||||
"blocks basic", "blocks", modifier, false);
|
||||
} else if (args[0].CaselessEq("all") || args[0].CaselessEq("complex")) {
|
||||
Player.Message(p, "Complex blocks: ");
|
||||
MultiPageOutput.Output(p, ComplexBlocks(), (name, i) => name,
|
||||
MultiPageOutput.Output(p, ComplexBlocks(), FormatBlockName,
|
||||
"blocks complex", "blocks", modifier, false);
|
||||
} else if (Block.Byte(args[0]) != Block.Invalid) {
|
||||
OutputBlockData(p, args[0]);
|
||||
} else if (Group.Find(args[0]) != null) {
|
||||
Group grp = Group.Find(args[0]);
|
||||
List<string> blocks = RankBlocks(grp.Permission);
|
||||
|
||||
if (blocks.Count == 0) {
|
||||
Player.Message(p, "{0} %Scannot modify any blocks.", grp.ColoredName);
|
||||
} else {
|
||||
Player.Message(p, "Blocks which {0} %Scan place: ", grp.ColoredName);
|
||||
MultiPageOutput.Output(p, blocks, (name, i) => name,
|
||||
"blocks " + args[0], "blocks", modifier, false);
|
||||
}
|
||||
Player.Message(p, "Blocks which {0} %Scan place: ", grp.ColoredName);
|
||||
MultiPageOutput.Output(p, RankBlocks(grp.Permission), FormatBlockName,
|
||||
"blocks " + args[0], "blocks", modifier, false);
|
||||
} else if (args.Length > 1) {
|
||||
Help(p);
|
||||
} else {
|
||||
@ -92,6 +86,13 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
|
||||
|
||||
internal static string FormatBlockName(string block, int i) {
|
||||
Block.Blocks perms = Block.BlockList[Block.Byte(block)];
|
||||
Group grp = Group.findPerm(perms.lowestRank);
|
||||
string col = grp == null ? "&f" : grp.color;
|
||||
return col + block;
|
||||
}
|
||||
|
||||
static void OutputBlockData(Player p, string block) {
|
||||
byte b = Block.Byte(block);
|
||||
if (b >= Block.CpeCount) {
|
||||
|
@ -61,12 +61,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
OutputList(p, keyword, "search blocks", "blocks",
|
||||
modifier, blocks, FormatBlockName);
|
||||
}
|
||||
|
||||
static string FormatBlockName(string block, int i) {
|
||||
string prefix = (i & 1) == 0 ? "&2" : "&9";
|
||||
return prefix + block;
|
||||
modifier, blocks, CmdBlocks.FormatBlockName);
|
||||
}
|
||||
|
||||
static void SearchCommands(Player p, string keyword, string modifier) {
|
||||
|
@ -164,7 +164,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
Player.Message(p, "%H e.g. to temprank for 90 minutes, [timespan] would be %S1h30m");
|
||||
Player.Message(p, "%T/temprank [player] info");
|
||||
Player.Message(p, "%HLists information about the temp rank for the given player.");
|
||||
Player.Message(p, "%T/temprank <player> delete %H- Removes player's temp rank.");
|
||||
Player.Message(p, "%T/temprank [player] delete %H- Removes player's temp rank.");
|
||||
Player.Message(p, "%T/temprank list %H- Lists all current temp ranks.");
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,10 @@
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace MCGalaxy {
|
||||
public static class Utils {
|
||||
|
Loading…
x
Reference in New Issue
Block a user