Only cancel tab events when needed in commands module

This commit is contained in:
rafern 2021-08-19 19:52:56 +01:00
parent 305ecdf915
commit e8d5924a23
No known key found for this signature in database
GPG Key ID: FE8BE3E64992D5CF
1 changed files with 4 additions and 4 deletions

View File

@ -69,10 +69,6 @@ public final class CommandsModule extends Module {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.player != null) {
if (mc.currentScreen instanceof GuiChat) {
if (event.getKeyCode() == 15) { // tab
event.setCanceled(true);
}
final int prefixLength = this.prefix.getValue().length();
String input = ((GuiChat) mc.currentScreen).inputField.getText();
@ -81,6 +77,10 @@ public final class CommandsModule extends Module {
}
if (input.startsWith(this.prefix.getValue())) {
if (event.getKeyCode() == 15) { // tab
event.setCanceled(true);
}
if (input.length() > prefixLength) {
input = input.substring(prefixLength);
}