Quote:
Originally Posted by Pault
That is an interesting way of doing it. But I still stand by my annoyance with CommandGroups. They are extremely limited in what they can do, and that is a result of the way they are designed. Sure there are some clever workarounds like that which can make it do things it normally cant, but the fact that you need to be that clever just to make any sort of decision live is a huge flaw. There are plenty of other ways they could have been designed to avoid these problems. Over the summer I decided to code my own version, and my way of working around these problems was simply to put the execution of the CommandGroup on a separate thread, that way the method could be run live and actually iterate through the code in real time instead of just throwing a bunch of commands in a queue.
Right now the code is has a couple of bugs in certain edge cases, but I hope to release it publicly soon.
|
This is kind of getting off topic, but my solution to this problem is to use Double/Boolean/WhateverSuppliers for the parameters, rather than passing the actual values. Since we are using Java 8, I just pass a lambda or method reference into the constructor. This adds a little complexity to the command code, but gains a lot of flexibility. For example, it makes it possible to update a parameter while the command is running.