antidrag: fix onShiftOnly not being respected when opening the bank

This commit is contained in:
Hydrox6
2020-04-17 12:07:30 +01:00
committed by Adam
parent e0f046980a
commit 87185bffa1

View File

@@ -70,6 +70,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
private KeyManager keyManager; private KeyManager keyManager;
private boolean inPvp; private boolean inPvp;
private boolean held;
@Provides @Provides
AntiDragConfig getConfig(ConfigManager configManager) AntiDragConfig getConfig(ConfigManager configManager)
@@ -114,6 +115,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
if (e.getKeyCode() == KeyEvent.VK_SHIFT && config.onShiftOnly()) if (e.getKeyCode() == KeyEvent.VK_SHIFT && config.onShiftOnly())
{ {
setDragDelay(); setDragDelay();
held = true;
} }
} }
@@ -123,6 +125,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
if (e.getKeyCode() == KeyEvent.VK_SHIFT && config.onShiftOnly()) if (e.getKeyCode() == KeyEvent.VK_SHIFT && config.onShiftOnly())
{ {
resetDragDelay(); resetDragDelay();
held = false;
} }
} }
@@ -133,6 +136,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
{ {
if (config.onShiftOnly() || inPvp) if (config.onShiftOnly() || inPvp)
{ {
held = false;
clientThread.invoke(this::resetDragDelay); clientThread.invoke(this::resetDragDelay);
} }
else else
@@ -168,6 +172,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
{ {
if (!focusChanged.isFocused()) if (!focusChanged.isFocused())
{ {
held = false;
clientThread.invoke(this::resetDragDelay); clientThread.invoke(this::resetDragDelay);
} }
else if (!inPvp && !config.onShiftOnly()) else if (!inPvp && !config.onShiftOnly())
@@ -179,7 +184,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
@Subscribe @Subscribe
public void onWidgetLoaded(WidgetLoaded widgetLoaded) public void onWidgetLoaded(WidgetLoaded widgetLoaded)
{ {
if (widgetLoaded.getGroupId() == WidgetID.BANK_GROUP_ID) if (widgetLoaded.getGroupId() == WidgetID.BANK_GROUP_ID && (!config.onShiftOnly() || held))
{ {
setBankDragDelay(config.dragDelay()); setBankDragDelay(config.dragDelay());
} }