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 { private enum SubCommand {
ADD, REMOVE; ADD, REMOVE, NAMES;
} }
/** /**
@ -202,7 +202,15 @@ class CommandPacket implements CommandExecutor {
} }
sendMessageSilently(sender, ChatColor.BLUE + "Fully removed " + count + " listeners."); 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) { } catch (NumberFormatException e) {
sendMessageSilently(sender, ChatColor.RED + "Cannot parse number: " + e.getMessage()); sendMessageSilently(sender, ChatColor.RED + "Cannot parse number: " + e.getMessage());
@ -489,6 +497,8 @@ class CommandPacket implements CommandExecutor {
return SubCommand.ADD; return SubCommand.ADD;
else if ("remove".startsWith(text)) else if ("remove".startsWith(text))
return SubCommand.REMOVE; return SubCommand.REMOVE;
else if ("names".startsWith(text))
return SubCommand.NAMES;
else else
throw new IllegalArgumentException(text + " is not a valid sub command. Must be add or remove."); 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> permission-message: You don't have <permission>
packet: packet:
description: Add or remove a simple packet listener. 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: experiencemod.admin
permission-message: You don't have <permission> permission-message: You don't have <permission>