[BUGFIX] Generating a new mac

They block the login with `empty_mac` so I’m generating a new mac.
This commit is contained in:
Emma Stone
2017-04-22 13:54:37 +01:00
parent 5779b6132e
commit 1b344c98e4
@@ -1,6 +1,7 @@
package org.parabot.randoms.dreamscape;
import org.parabot.core.Context;
import org.parabot.core.network.NetworkInterface;
import org.parabot.environment.randoms.RandomType;
import org.parabot.randoms.utils.Reflection;
@@ -9,9 +10,6 @@ import org.parabot.randoms.utils.Reflection;
*/
public class MacAddressAvoider implements org.parabot.environment.randoms.Random {
private static final String MAC_ADDRESS_FIELD = "MAC_ADDRESS";
private static final String MAC_ADDRESS_VALUE = "empty_mac";
private boolean done;
@Override
@@ -21,7 +19,9 @@ public class MacAddressAvoider implements org.parabot.environment.randoms.Random
@Override
public void execute() {
Reflection.workAroundStaticValues(Context.getInstance().getClient().getClass(), MAC_ADDRESS_FIELD, MAC_ADDRESS_VALUE);
byte[] mac = new byte[6];
new java.util.Random().nextBytes(mac);
Reflection.workAroundStaticValues(Context.getInstance().getClient().getClass(), "MAC_ADDRESS", NetworkInterface.formatMac(mac));
done = true;
}