Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The command class itself, where "commandArgs" are the arguments provided for the command
- CommandBase commandClass = this.getCommandClass(commandArgs[0]);
- // The target index in the command's syntax (indicating where the selector is)
- int targetIndex = commandClass.getTargetIndex();
- if (getsMultipleTargets(commandArgs[targetIndex])) {
- // Process the selector using the target index to locate it in the arguments provided
- List<Entity> entities = this.processSelector(commandArgs[targetIndex]);
- // Cycle through each entity...
- for (Entity entity : entities) {
- // Replace the selector with a UUID
- commandArgs[targetIndex] = entity.getUUID();
- // Execute command
- commandClass.process(commandArgs);
- }
- } else {
- // Execute command without any changes, meaning the selector is not processed and is at the whim of the command class
- commandClass.process(commandArgs);
- }
Add Comment
Please, Sign In to add comment