Merge pull request #1711 from runelite-extended/antidrag-fix-toggle-antidrag
Antidrag: fix toggle antidrag
This commit is contained in:
@@ -42,8 +42,8 @@ public interface AntiDragConfig extends Config
|
|||||||
keyName = "alwaysOn",
|
keyName = "alwaysOn",
|
||||||
name = "Always On",
|
name = "Always On",
|
||||||
description = "Makes the anti-drag always active and disables the hotkey toggle",
|
description = "Makes the anti-drag always active and disables the hotkey toggle",
|
||||||
disabledBy = "keybind || holdkeybind",
|
disabledBy = "toggleKeyBind || holdKeyBind",
|
||||||
hide = "keybind || holdkeybind"
|
hide = "toggleKeyBind || holdKeyBind"
|
||||||
)
|
)
|
||||||
default boolean alwaysOn()
|
default boolean alwaysOn()
|
||||||
{
|
{
|
||||||
@@ -52,26 +52,26 @@ public interface AntiDragConfig extends Config
|
|||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 1,
|
position = 1,
|
||||||
keyName = "keybind",
|
keyName = "toggleKeyBind",
|
||||||
name = "Toggle with Keybind",
|
name = "Toggle with Keybind",
|
||||||
description = "Toggle anti drag on and off, rather than always on.",
|
description = "Toggle anti drag on and off, rather than always on.",
|
||||||
disabledBy = "alwaysOn || holdkeybind",
|
disabledBy = "alwaysOn || holdKeyBind",
|
||||||
hide = "alwaysOn || holdkeybind"
|
hide = "alwaysOn || holdKeyBind"
|
||||||
)
|
)
|
||||||
default boolean keybind()
|
default boolean toggleKeyBind()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 2,
|
position = 2,
|
||||||
keyName = "holdkeybind",
|
keyName = "holdKeyBind",
|
||||||
name = "Hold with Keybind",
|
name = "Hold with Keybind",
|
||||||
description = "Hold anti drag key to turn it on, rather than toggle it on or off.",
|
description = "Hold anti drag key to turn it on, rather than toggle it on or off.",
|
||||||
disabledBy = "alwaysOn || keybind",
|
disabledBy = "alwaysOn || toggleKeyBind",
|
||||||
hide = "alwaysOn || keybind"
|
hide = "alwaysOn || toggleKeyBind"
|
||||||
)
|
)
|
||||||
default boolean holdkeybind()
|
default boolean holdKeyBind()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ public interface AntiDragConfig extends Config
|
|||||||
description = "The keybind you want to use for antidrag",
|
description = "The keybind you want to use for antidrag",
|
||||||
position = 3,
|
position = 3,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "keybind || holdkeybind"
|
unhide = "toggleKeyBind || holdKeyBind"
|
||||||
)
|
)
|
||||||
default Keybind key()
|
default Keybind key()
|
||||||
{
|
{
|
||||||
@@ -106,7 +106,7 @@ public interface AntiDragConfig extends Config
|
|||||||
description = "Disable antidrag when losing focus (like alt tabbing)",
|
description = "Disable antidrag when losing focus (like alt tabbing)",
|
||||||
position = 5,
|
position = 5,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "keybind || holdkeybind"
|
unhide = "toggleKeyBind || holdKeyBind"
|
||||||
)
|
)
|
||||||
default boolean reqfocus()
|
default boolean reqfocus()
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ public interface AntiDragConfig extends Config
|
|||||||
description = "Do you really need a description?",
|
description = "Do you really need a description?",
|
||||||
position = 6,
|
position = 6,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "keybind || holdkeybind"
|
unhide = "toggleKeyBind || holdKeyBind"
|
||||||
)
|
)
|
||||||
default boolean overlay()
|
default boolean overlay()
|
||||||
{
|
{
|
||||||
@@ -132,7 +132,7 @@ public interface AntiDragConfig extends Config
|
|||||||
name = "Overlay color",
|
name = "Overlay color",
|
||||||
description = "Change the overlay color, duh",
|
description = "Change the overlay color, duh",
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "keybind || holdkeybind",
|
unhide = "toggleKeyBind || holdKeyBind",
|
||||||
position = 7
|
position = 7
|
||||||
)
|
)
|
||||||
default Color color()
|
default Color color()
|
||||||
@@ -146,7 +146,7 @@ public interface AntiDragConfig extends Config
|
|||||||
description = "Change cursor when you have anti-drag enabled.",
|
description = "Change cursor when you have anti-drag enabled.",
|
||||||
position = 8,
|
position = 8,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "keybind || holdkeybind"
|
unhide = "toggleKeyBind || holdKeyBind"
|
||||||
)
|
)
|
||||||
default boolean changeCursor()
|
default boolean changeCursor()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ public class AntiDragPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean alwaysOn;
|
private boolean alwaysOn;
|
||||||
private boolean keybind;
|
private boolean toggleKeyBind;
|
||||||
private boolean holdkeybind;
|
private boolean holdKeyBind;
|
||||||
private Keybind key;
|
private Keybind key;
|
||||||
private int dragDelay;
|
private int dragDelay;
|
||||||
private boolean reqfocus;
|
private boolean reqfocus;
|
||||||
@@ -109,7 +109,7 @@ public class AntiDragPlugin extends Plugin
|
|||||||
addSubscriptions();
|
addSubscriptions();
|
||||||
updateConfig();
|
updateConfig();
|
||||||
|
|
||||||
if (this.keybind || this.holdkeybind)
|
if (this.toggleKeyBind || this.holdKeyBind)
|
||||||
{
|
{
|
||||||
keyManager.registerKeyListener(hotkeyListener);
|
keyManager.registerKeyListener(hotkeyListener);
|
||||||
}
|
}
|
||||||
@@ -141,9 +141,9 @@ public class AntiDragPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
updateConfig();
|
updateConfig();
|
||||||
|
|
||||||
if (event.getKey().equals("keybind"))
|
if (event.getKey().equals("toggleKeyBind"))
|
||||||
{
|
{
|
||||||
if (this.keybind)
|
if (this.toggleKeyBind)
|
||||||
{
|
{
|
||||||
keyManager.registerKeyListener(hotkeyListener);
|
keyManager.registerKeyListener(hotkeyListener);
|
||||||
}
|
}
|
||||||
@@ -153,9 +153,9 @@ public class AntiDragPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if
|
if
|
||||||
(event.getKey().equals(("holdkeybind")))
|
(event.getKey().equals("holdKeyBind"))
|
||||||
{
|
{
|
||||||
if (this.holdkeybind)
|
if (this.holdKeyBind)
|
||||||
{
|
{
|
||||||
keyManager.registerKeyListener(hotkeyListener);
|
keyManager.registerKeyListener(hotkeyListener);
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ public class AntiDragPlugin extends Plugin
|
|||||||
switch (event.getGameState())
|
switch (event.getGameState())
|
||||||
{
|
{
|
||||||
case LOGGED_IN:
|
case LOGGED_IN:
|
||||||
if (keybind || holdkeybind)
|
if (toggleKeyBind || holdKeyBind)
|
||||||
{
|
{
|
||||||
keyManager.registerKeyListener(hotkeyListener);
|
keyManager.registerKeyListener(hotkeyListener);
|
||||||
}
|
}
|
||||||
@@ -197,8 +197,8 @@ public class AntiDragPlugin extends Plugin
|
|||||||
private void updateConfig()
|
private void updateConfig()
|
||||||
{
|
{
|
||||||
this.alwaysOn = config.alwaysOn();
|
this.alwaysOn = config.alwaysOn();
|
||||||
this.keybind = config.keybind();
|
this.toggleKeyBind = config.toggleKeyBind();
|
||||||
this.holdkeybind = config.holdkeybind();
|
this.holdKeyBind = config.holdKeyBind();
|
||||||
this.key = config.key();
|
this.key = config.key();
|
||||||
this.dragDelay = config.dragDelay();
|
this.dragDelay = config.dragDelay();
|
||||||
this.reqfocus = config.reqfocus();
|
this.reqfocus = config.reqfocus();
|
||||||
|
|||||||
Reference in New Issue
Block a user