antidrag: enable in pvp
This feature is enabled in the steam client Co-authored-by: jsuarez5341 <sealsuarez@gmail.com>
This commit is contained in:
@@ -46,7 +46,7 @@ public interface AntiDragConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "onShiftOnly",
|
keyName = "onShiftOnly",
|
||||||
name = "On Shift Only",
|
name = "On Shift Only",
|
||||||
description = "Configures whether to only adjust the delay while holding shift in non-PvP scenarios. Shift is required in PvP regardless of this config setting",
|
description = "Configures whether to only adjust the delay while holding shift.",
|
||||||
position = 2
|
position = 2
|
||||||
)
|
)
|
||||||
default boolean onShiftOnly()
|
default boolean onShiftOnly()
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ import java.awt.event.KeyEvent;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.Varbits;
|
|
||||||
import net.runelite.api.events.FocusChanged;
|
import net.runelite.api.events.FocusChanged;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
@@ -69,7 +67,6 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
|||||||
@Inject
|
@Inject
|
||||||
private KeyManager keyManager;
|
private KeyManager keyManager;
|
||||||
|
|
||||||
private boolean inPvp;
|
|
||||||
private boolean shiftHeld;
|
private boolean shiftHeld;
|
||||||
private boolean ctrlHeld;
|
private boolean ctrlHeld;
|
||||||
|
|
||||||
@@ -86,8 +83,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
|||||||
{
|
{
|
||||||
clientThread.invokeLater(() ->
|
clientThread.invokeLater(() ->
|
||||||
{
|
{
|
||||||
inPvp = client.getVar(Varbits.PVP_SPEC_ORB) == 1;
|
if (!config.onShiftOnly())
|
||||||
if (!config.onShiftOnly() && !inPvp)
|
|
||||||
{
|
{
|
||||||
setDragDelay();
|
setDragDelay();
|
||||||
}
|
}
|
||||||
@@ -113,12 +109,12 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
|||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent e)
|
public void keyPressed(KeyEvent e)
|
||||||
{
|
{
|
||||||
if (e.getKeyCode() == KeyEvent.VK_CONTROL && config.disableOnCtrl() && !(inPvp || config.onShiftOnly()))
|
if (e.getKeyCode() == KeyEvent.VK_CONTROL && config.disableOnCtrl() && !config.onShiftOnly())
|
||||||
{
|
{
|
||||||
resetDragDelay();
|
resetDragDelay();
|
||||||
ctrlHeld = true;
|
ctrlHeld = true;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_SHIFT && (inPvp || config.onShiftOnly()))
|
else if (e.getKeyCode() == KeyEvent.VK_SHIFT && config.onShiftOnly())
|
||||||
{
|
{
|
||||||
setDragDelay();
|
setDragDelay();
|
||||||
shiftHeld = true;
|
shiftHeld = true;
|
||||||
@@ -128,12 +124,12 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
|||||||
@Override
|
@Override
|
||||||
public void keyReleased(KeyEvent e)
|
public void keyReleased(KeyEvent e)
|
||||||
{
|
{
|
||||||
if (e.getKeyCode() == KeyEvent.VK_CONTROL && config.disableOnCtrl() && !(inPvp || config.onShiftOnly()))
|
if (e.getKeyCode() == KeyEvent.VK_CONTROL && config.disableOnCtrl() && !config.onShiftOnly())
|
||||||
{
|
{
|
||||||
setDragDelay();
|
setDragDelay();
|
||||||
ctrlHeld = false;
|
ctrlHeld = false;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_SHIFT && (inPvp || config.onShiftOnly()))
|
else if (e.getKeyCode() == KeyEvent.VK_SHIFT && config.onShiftOnly())
|
||||||
{
|
{
|
||||||
resetDragDelay();
|
resetDragDelay();
|
||||||
shiftHeld = false;
|
shiftHeld = false;
|
||||||
@@ -150,7 +146,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
|||||||
ctrlHeld = false;
|
ctrlHeld = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.onShiftOnly() || inPvp)
|
if (config.onShiftOnly())
|
||||||
{
|
{
|
||||||
shiftHeld = false;
|
shiftHeld = false;
|
||||||
clientThread.invoke(this::resetDragDelay);
|
clientThread.invoke(this::resetDragDelay);
|
||||||
@@ -162,27 +158,6 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onVarbitChanged(VarbitChanged varbitChanged)
|
|
||||||
{
|
|
||||||
boolean currentStatus = client.getVar(Varbits.PVP_SPEC_ORB) == 1;
|
|
||||||
|
|
||||||
if (currentStatus != inPvp)
|
|
||||||
{
|
|
||||||
inPvp = currentStatus;
|
|
||||||
|
|
||||||
if (!inPvp && !config.onShiftOnly())
|
|
||||||
{
|
|
||||||
setDragDelay();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resetDragDelay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFocusChanged(FocusChanged focusChanged)
|
public void onFocusChanged(FocusChanged focusChanged)
|
||||||
{
|
{
|
||||||
@@ -192,7 +167,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
|||||||
ctrlHeld = false;
|
ctrlHeld = false;
|
||||||
clientThread.invoke(this::resetDragDelay);
|
clientThread.invoke(this::resetDragDelay);
|
||||||
}
|
}
|
||||||
else if (!inPvp && !config.onShiftOnly())
|
else if (!config.onShiftOnly())
|
||||||
{
|
{
|
||||||
clientThread.invoke(this::setDragDelay);
|
clientThread.invoke(this::setDragDelay);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user