command completion
This commit is contained in:
parent
4a3828e310
commit
e88958e2f4
16 changed files with 66 additions and 51 deletions
|
@ -1,5 +1,6 @@
|
|||
package game.command;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -71,17 +72,15 @@ public class EntityListParser extends EntityParser {
|
|||
return entity == null ? null : Lists.newArrayList(entity);
|
||||
}
|
||||
|
||||
public String[] getCompletions(CommandEnvironment env) {
|
||||
Entity target = env.getExecutor().getPointedEntity();
|
||||
List<String> comp = target == null || (this.livingOnly && !(target instanceof EntityLiving)) ? Lists.newArrayList() : Lists.newArrayList("#" + target.getId());
|
||||
comp.addAll(env.getServer().getAllUsernames());
|
||||
public Collection<String> getCompletions(CommandEnvironment env) {
|
||||
Collection<String> comp = super.getCompletions(env);
|
||||
comp.add("*");
|
||||
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
|
||||
if(!this.livingOnly || EntityLiving.class.isAssignableFrom(clazz))
|
||||
comp.add(EntityRegistry.getEntityString(clazz));
|
||||
}
|
||||
comp.add("**");
|
||||
return comp.toArray(new String[comp.size()]);
|
||||
return comp;
|
||||
}
|
||||
|
||||
public Class<?> getTypeClass() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue