Merge pull request #1711 from runelite-extended/antidrag-fix-toggle-antidrag

Antidrag: fix toggle antidrag
This commit is contained in:
Owain van Brakel
2019-10-04 03:46:29 +02:00
committed by GitHub
2 changed files with 25 additions and 25 deletions

View File

@@ -42,8 +42,8 @@ public interface AntiDragConfig extends Config
keyName = "alwaysOn",
name = "Always On",
description = "Makes the anti-drag always active and disables the hotkey toggle",
disabledBy = "keybind || holdkeybind",
hide = "keybind || holdkeybind"
disabledBy = "toggleKeyBind || holdKeyBind",
hide = "toggleKeyBind || holdKeyBind"
)
default boolean alwaysOn()
{
@@ -52,26 +52,26 @@ public interface AntiDragConfig extends Config
@ConfigItem(
position = 1,
keyName = "keybind",
keyName = "toggleKeyBind",
name = "Toggle with Keybind",
description = "Toggle anti drag on and off, rather than always on.",
disabledBy = "alwaysOn || holdkeybind",
hide = "alwaysOn || holdkeybind"
disabledBy = "alwaysOn || holdKeyBind",
hide = "alwaysOn || holdKeyBind"
)
default boolean keybind()
default boolean toggleKeyBind()
{
return false;
}
@ConfigItem(
position = 2,
keyName = "holdkeybind",
keyName = "holdKeyBind",
name = "Hold with Keybind",
description = "Hold anti drag key to turn it on, rather than toggle it on or off.",
disabledBy = "alwaysOn || keybind",
hide = "alwaysOn || keybind"
disabledBy = "alwaysOn || toggleKeyBind",
hide = "alwaysOn || toggleKeyBind"
)
default boolean holdkeybind()
default boolean holdKeyBind()
{
return false;
}
@@ -82,7 +82,7 @@ public interface AntiDragConfig extends Config
description = "The keybind you want to use for antidrag",
position = 3,
hidden = true,
unhide = "keybind || holdkeybind"
unhide = "toggleKeyBind || holdKeyBind"
)
default Keybind key()
{
@@ -106,7 +106,7 @@ public interface AntiDragConfig extends Config
description = "Disable antidrag when losing focus (like alt tabbing)",
position = 5,
hidden = true,
unhide = "keybind || holdkeybind"
unhide = "toggleKeyBind || holdKeyBind"
)
default boolean reqfocus()
{
@@ -119,7 +119,7 @@ public interface AntiDragConfig extends Config
description = "Do you really need a description?",
position = 6,
hidden = true,
unhide = "keybind || holdkeybind"
unhide = "toggleKeyBind || holdKeyBind"
)
default boolean overlay()
{
@@ -132,7 +132,7 @@ public interface AntiDragConfig extends Config
name = "Overlay color",
description = "Change the overlay color, duh",
hidden = true,
unhide = "keybind || holdkeybind",
unhide = "toggleKeyBind || holdKeyBind",
position = 7
)
default Color color()
@@ -146,7 +146,7 @@ public interface AntiDragConfig extends Config
description = "Change cursor when you have anti-drag enabled.",
position = 8,
hidden = true,
unhide = "keybind || holdkeybind"
unhide = "toggleKeyBind || holdKeyBind"
)
default boolean changeCursor()
{

View File

@@ -91,8 +91,8 @@ public class AntiDragPlugin extends Plugin
}
private boolean alwaysOn;
private boolean keybind;
private boolean holdkeybind;
private boolean toggleKeyBind;
private boolean holdKeyBind;
private Keybind key;
private int dragDelay;
private boolean reqfocus;
@@ -109,7 +109,7 @@ public class AntiDragPlugin extends Plugin
addSubscriptions();
updateConfig();
if (this.keybind || this.holdkeybind)
if (this.toggleKeyBind || this.holdKeyBind)
{
keyManager.registerKeyListener(hotkeyListener);
}
@@ -141,9 +141,9 @@ public class AntiDragPlugin extends Plugin
{
updateConfig();
if (event.getKey().equals("keybind"))
if (event.getKey().equals("toggleKeyBind"))
{
if (this.keybind)
if (this.toggleKeyBind)
{
keyManager.registerKeyListener(hotkeyListener);
}
@@ -153,9 +153,9 @@ public class AntiDragPlugin extends Plugin
}
}
if
(event.getKey().equals(("holdkeybind")))
(event.getKey().equals("holdKeyBind"))
{
if (this.holdkeybind)
if (this.holdKeyBind)
{
keyManager.registerKeyListener(hotkeyListener);
}
@@ -184,7 +184,7 @@ public class AntiDragPlugin extends Plugin
switch (event.getGameState())
{
case LOGGED_IN:
if (keybind || holdkeybind)
if (toggleKeyBind || holdKeyBind)
{
keyManager.registerKeyListener(hotkeyListener);
}
@@ -197,8 +197,8 @@ public class AntiDragPlugin extends Plugin
private void updateConfig()
{
this.alwaysOn = config.alwaysOn();
this.keybind = config.keybind();
this.holdkeybind = config.holdkeybind();
this.toggleKeyBind = config.toggleKeyBind();
this.holdKeyBind = config.holdKeyBind();
this.key = config.key();
this.dragDelay = config.dragDelay();
this.reqfocus = config.reqfocus();