Initial Brigadier overriden tab completion

This commit is contained in:
Brady
2019-10-09 21:19:58 -05:00
parent 2b4d6f4aa0
commit 62df244db7
8 changed files with 110 additions and 56 deletions

View File

@@ -146,11 +146,11 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
}
@Override
public void onPreTabComplete(TabCompleteEvent.Pre event) {
public void onPreTabComplete(TabCompleteEvent event) {
if (!settings.prefixControl.value) {
return;
}
String prefix = event.prefix.get();
String prefix = event.prefix;
String commandPrefix = settings.prefix.value;
if (!prefix.startsWith(commandPrefix)) {
return;
@@ -161,7 +161,7 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
if (args.size() == 1) {
stream = stream.map(x -> commandPrefix + x);
}
event.completions.set(stream.toArray(String[]::new));
event.completions = stream.toArray(String[]::new);
}
public Stream<String> tabComplete(String msg) {

View File

@@ -70,15 +70,10 @@ public final class GameEventHandler implements IEventBus, Helper {
}
@Override
public void onPreTabComplete(TabCompleteEvent.Pre event) {
public void onPreTabComplete(TabCompleteEvent event) {
listeners.forEach(l -> l.onPreTabComplete(event));
}
@Override
public void onPostTabComplete(TabCompleteEvent.Post event) {
listeners.forEach(l -> l.onPostTabComplete(event));
}
@Override
public final void onChunkEvent(ChunkEvent event) {
EventState state = event.getState();

View File

@@ -1,10 +0,0 @@
package baritone.utils.accessor;
public interface ITabCompleter {
String getPrefix();
void setPrefix(String prefix);
boolean onGuiChatSetCompletions(String[] newCompl);
}