removed fkeyremapping, broken
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
package net.runelite.client.plugins.fkeyremapping;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
@ConfigGroup("fkeyremapping")
|
||||
public interface fKeyRemappingConfig extends Config {
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "F1",
|
||||
name = "F1 Key",
|
||||
description = "The key which will replace F1."
|
||||
)
|
||||
default Keybind f1()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_Q, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "F2",
|
||||
name = "F2 key",
|
||||
description = "The key which will replace F2."
|
||||
)
|
||||
default Keybind f2()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_W, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "F3",
|
||||
name = "F3 key",
|
||||
description = "The key which will replace F3."
|
||||
)
|
||||
default Keybind f3()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_E, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "F4",
|
||||
name = "F4 Key key",
|
||||
description = "The key which will replace F4."
|
||||
)
|
||||
default Keybind f4()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_R, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package net.runelite.client.plugins.fkeyremapping;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.MouseAdapter;
|
||||
|
||||
class fKeyRemappingListener extends MouseAdapter implements KeyListener
|
||||
{
|
||||
@Inject
|
||||
private fKeyRemappingPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private fKeyRemappingConfig config;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
private final Map<Integer, Integer> modified = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !plugin.chatboxFocused())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (config.f1().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F1);
|
||||
e.setKeyCode(KeyEvent.VK_F1);
|
||||
}
|
||||
else if (config.f2().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F2);
|
||||
e.setKeyCode(KeyEvent.VK_F2);
|
||||
}
|
||||
else if (config.f3().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F3);
|
||||
e.setKeyCode(KeyEvent.VK_F3);
|
||||
}
|
||||
else if (config.f4().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F4);
|
||||
e.setKeyCode(KeyEvent.VK_F4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !plugin.chatboxFocused())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
modified.remove(e.getKeyCode());
|
||||
|
||||
if (config.f1().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F1);
|
||||
}
|
||||
else if (config.f2().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F2);
|
||||
}
|
||||
else if (config.f3().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F3);
|
||||
}
|
||||
else if (config.f4().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F4);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package net.runelite.client.plugins.fkeyremapping;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "fKeyRemapping",
|
||||
description = "Used for interface hotkeys",
|
||||
tags = {"hotkey", "remapping"},
|
||||
type = "utility",
|
||||
enabledByDefault = true
|
||||
)
|
||||
public class fKeyRemappingPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@Inject
|
||||
private fKeyRemappingListener inputListener;
|
||||
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
keyManager.registerKeyListener(inputListener);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
|
||||
keyManager.unregisterKeyListener(inputListener);
|
||||
}
|
||||
|
||||
@Provides
|
||||
fKeyRemappingConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(fKeyRemappingConfig.class);
|
||||
}
|
||||
|
||||
boolean chatboxFocused()
|
||||
{
|
||||
Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT);
|
||||
if (chatboxParent == null || chatboxParent.getOnKeyListener() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// the search box on the world map can be focused, and chat input goes there, even
|
||||
// though the chatbox still has its key listener.
|
||||
Widget worldMapSearch = client.getWidget(WidgetInfo.WORLD_MAP_SEARCH);
|
||||
if (worldMapSearch != null && client.getVar(VarClientInt.WORLD_MAP_SEARCH_FOCUSED) == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user