mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-12-26 11:08:12 +01:00
Adding the names sub-command.
This commit is contained in:
parent
27104c7350
commit
72bfa3da9b
@ -47,7 +47,7 @@ class CommandPacket implements CommandExecutor {
|
||||
}
|
||||
|
||||
private enum SubCommand {
|
||||
ADD, REMOVE;
|
||||
ADD, REMOVE, NAMES;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,7 +202,15 @@ 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) {
|
||||
sendMessageSilently(sender, ChatColor.RED + "Cannot parse number: " + e.getMessage());
|
||||
@ -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.");
|
||||
}
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user