mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-04 16:49:11 +00:00
[FEATURE] Added Serial Ban Avoider for Dreamscape
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package org.parabot.randoms.dreamscape;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.Core;
|
||||
import org.parabot.core.reflect.RefClass;
|
||||
import org.parabot.core.reflect.RefField;
|
||||
import org.parabot.environment.scripts.randoms.Random;
|
||||
|
||||
/**
|
||||
* @author JKetelaar
|
||||
*/
|
||||
public class SerialBanAvoider implements Random {
|
||||
|
||||
private static final String serialAddressField = "SERIAL_ADDRESS";
|
||||
private static final String serialAddressValue = "empty_or_unknown";
|
||||
|
||||
private boolean done;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return !done;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
RefClass client = new RefClass(Context.getInstance().getClient());
|
||||
RefField serial = client.getField(serialAddressField);
|
||||
if (serial != null) {
|
||||
serial.set(serialAddressValue);
|
||||
} else {
|
||||
Core.verbose(String.format("Oh oh... Couldn't find field: %s", serialAddressField));
|
||||
}
|
||||
|
||||
done = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Serial ban avoider";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return "dreamscape";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user