Archiviert
13
0

Adding the names sub-command.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-03 06:54:31 +01:00
Ursprung 27104c7350
Commit 72bfa3da9b
2 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -47,7 +47,7 @@ class CommandPacket implements CommandExecutor {
}
private enum SubCommand {
ADD, REMOVE;
ADD, REMOVE, NAMES;
}
/**
@ -202,6 +202,14 @@ class CommandPacket implements CommandExecutor {
}
sendMessageSilently(sender, ChatColor.BLUE + "Fully removed " + count + " listeners.");
} else if (subCommand == SubCommand.NAMES) {
// Print the equivalent name of every given ID
for (Range<Integer> range : ranges) {
for (int id : range.asSet(DiscreteDomains.integers())) {
sendMessageSilently(sender, ChatColor.BLUE + "" + id + ": " + Packets.getDeclaredName(id));
}
}
}
} catch (NumberFormatException e) {
@ -489,6 +497,8 @@ class CommandPacket implements CommandExecutor {
return SubCommand.ADD;
else if ("remove".startsWith(text))
return SubCommand.REMOVE;
else if ("names".startsWith(text))
return SubCommand.NAMES;
else
throw new IllegalArgumentException(text + " is not a valid sub command. Must be add or remove.");
}

Datei anzeigen

@ -15,7 +15,7 @@ commands:
permission-message: You don't have <permission>
packet:
description: Add or remove a simple packet listener.
usage: /<command> add|remove client|server [ID start]-[ID stop] [detailed]
usage: /<command> add|remove|names client|server [ID start]-[ID stop] [detailed]
permission: experiencemod.admin
permission-message: You don't have <permission>