update private server stuff to not break all the fucking time (#1865)
update private server stuff to not break all the fucking time
This commit is contained in:
@@ -1795,8 +1795,6 @@ public interface Client extends GameShell
|
||||
*/
|
||||
void removeFriend(String name);
|
||||
|
||||
BigInteger getModulus();
|
||||
|
||||
void setModulus(BigInteger modulus);
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,24 +70,24 @@ public class PrivateServerPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
if (RuneLite.allowPrivateServer)
|
||||
if (!RuneLite.allowPrivateServer)
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
if (!config.modulus().equals(""))
|
||||
{
|
||||
client.setModulus(new BigInteger("83ff79a3e258b99ead1a70e1049883e78e513c4cdec538d8da9483879a9f81689c0c7d146d7b82b52d05cf26132b1cda5930eeef894e4ccf3d41eebc3aabe54598c4ca48eb5a31d736bfeea17875a35558b9e3fcd4aebe2a9cc970312a477771b36e173dc2ece6001ab895c553e2770de40073ea278026f36961c94428d8d7db", 16));
|
||||
client.setModulus(new BigInteger(config.modulus(), 16));
|
||||
}
|
||||
|
||||
addSubscriptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
if (RuneLite.allowPrivateServer)
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
}
|
||||
client.setModulus(null);
|
||||
eventBus.unregister(this);
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
@@ -97,12 +97,19 @@ public class PrivateServerPlugin extends Plugin
|
||||
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("privateserver") && event.getKey().equals("modulus"))
|
||||
if (!event.getGroup().equals("privateserver"))
|
||||
{
|
||||
client.setModulus(new BigInteger(config.modulus(), 16));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getGroup().equals("privateserver") && event.getKey().equals("codebase"))
|
||||
if (event.getKey().equals("modulus"))
|
||||
{
|
||||
if (RuneLite.allowPrivateServer && !config.modulus().equals(""))
|
||||
{
|
||||
client.setModulus(new BigInteger(config.modulus(), 16));
|
||||
}
|
||||
}
|
||||
else if (event.getKey().equals("codebase"))
|
||||
{
|
||||
StringFileUtils.writeStringToFile(RuneLite.RUNELITE_DIR + "/codebase", config.codebase());
|
||||
String message = "Client restart required after codebase change\n";
|
||||
@@ -110,12 +117,4 @@ public class PrivateServerPlugin extends Plugin
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
if (!config.modulus().equals(""))
|
||||
{
|
||||
client.setModulus(new BigInteger(config.modulus(), 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,17 +39,20 @@ public abstract class RSBufferMixin implements RSBuffer
|
||||
@Shadow("client")
|
||||
private static RSClient client;
|
||||
|
||||
@Inject
|
||||
private static BigInteger exponent = new BigInteger("10001", 16);
|
||||
@Shadow("modulus")
|
||||
private static BigInteger modulus;
|
||||
|
||||
@Copy("encryptRsa")
|
||||
public void rs$encryptRsa(BigInteger var1, BigInteger var2)
|
||||
{
|
||||
}
|
||||
abstract void rs$encryptRsa(BigInteger var1, BigInteger var2);
|
||||
|
||||
@Replace("encryptRsa")
|
||||
public void rl$encryptRsa(BigInteger var1, BigInteger var2)
|
||||
public void rl$encryptRsa(BigInteger exp, BigInteger mod)
|
||||
{
|
||||
rs$encryptRsa(exponent, client.getModulus());
|
||||
if (modulus != null)
|
||||
{
|
||||
mod = modulus;
|
||||
}
|
||||
|
||||
rs$encryptRsa(exp, mod);
|
||||
}
|
||||
}
|
||||
@@ -1751,21 +1751,13 @@ public abstract class RSClientMixin implements RSClient
|
||||
}
|
||||
|
||||
@Inject
|
||||
BigInteger modulus = new BigInteger("a8cda33f9c45f0b9d1675c38ec69da6be4143320190060c229bb35ed91677a4447e09e77031e824aed13bfab51ba180bbda7e279a128f3eb016e9b0dd752a948431798626fc36ac10e036d945f2752d0d874c65a86d3e001a17bf9d63d8bc263b07be4ebc613d01781023a07de698e75248b582e682f1751395f61b9ec1bcbb3", 16);
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public BigInteger getModulus()
|
||||
{
|
||||
return modulus;
|
||||
}
|
||||
|
||||
private static BigInteger modulus;
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setModulus(BigInteger modulus)
|
||||
{
|
||||
this.modulus = modulus;
|
||||
RSClientMixin.modulus = modulus;
|
||||
}
|
||||
|
||||
@Copy("forceDisconnect")
|
||||
|
||||
Reference in New Issue
Block a user