Use injection instead of reflection for instance reloader.
This commit is contained in:
@@ -127,6 +127,13 @@ public interface Client extends GameShell
|
|||||||
*/
|
*/
|
||||||
GameState getGameState();
|
GameState getGameState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current game state.
|
||||||
|
*
|
||||||
|
* @param gameState new game state
|
||||||
|
*/
|
||||||
|
void setGameState(int gameState);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current logged in username.
|
* Gets the current logged in username.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.raids;
|
|||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@@ -78,22 +77,9 @@ class RaidsPanel extends PluginPanel
|
|||||||
JPanel scoutFrame = new JPanel();
|
JPanel scoutFrame = new JPanel();
|
||||||
reloadButton.addActionListener((ActionEvent e) ->
|
reloadButton.addActionListener((ActionEvent e) ->
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if ((client.getGameState() == GameState.LOGGED_IN))
|
if ((client.getGameState() == GameState.LOGGED_IN))
|
||||||
{
|
{
|
||||||
try
|
client.setGameState(40);
|
||||||
{
|
|
||||||
//look for client.gameStateChanged(-1); in src files to find
|
|
||||||
Method m = client.getClass().getClassLoader().loadClass("ba").getDeclaredMethod("ec", int.class, byte.class);
|
|
||||||
m.setAccessible(true);
|
|
||||||
m.invoke(null, 40, (byte) 3);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (ReflectiveOperationException f)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
reloadScouter.addActionListener((ActionEvent e) ->
|
reloadScouter.addActionListener((ActionEvent e) ->
|
||||||
|
|||||||
@@ -143,6 +143,9 @@ public interface RSClient extends RSGameShell, Client
|
|||||||
@Import("gameState")
|
@Import("gameState")
|
||||||
int getRSGameState();
|
int getRSGameState();
|
||||||
|
|
||||||
|
@Import("updateGameState")
|
||||||
|
void setGameState(int gameState);
|
||||||
|
|
||||||
@Import("checkClick")
|
@Import("checkClick")
|
||||||
@Override
|
@Override
|
||||||
void setCheckClick(boolean checkClick);
|
void setCheckClick(boolean checkClick);
|
||||||
|
|||||||
Reference in New Issue
Block a user