mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-03 08:39:09 +00:00
[FEATURE] File Ban Random
This commit is contained in:
@@ -2,6 +2,7 @@ package org.parabot.randoms;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.randoms.dreamscape.FileBan;
|
||||
import org.parabot.randoms.elkoy.AntiDetector;
|
||||
import org.parabot.randoms.elkoy.LogoutDisabler;
|
||||
import org.parabot.randoms.elkoy.MouseOnScreen;
|
||||
@@ -36,6 +37,9 @@ public class Core {
|
||||
// LocoPK
|
||||
randoms.add(new MacAddressFix());
|
||||
|
||||
// Dreamscape
|
||||
randoms.add(new FileBan());
|
||||
|
||||
org.parabot.core.Core.verbose("Possible randoms:");
|
||||
for (Random random : randoms) {
|
||||
if (random.getServer().equalsIgnoreCase(server)) {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.parabot.randoms.dreamscape;
|
||||
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author EmmaStone
|
||||
*/
|
||||
public class FileBan implements Random {
|
||||
|
||||
private boolean checked = false;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
if (!checked) {
|
||||
if (doesFileExist()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
File file = new File(System.getProperty("user.home") + "/jagex_rs.txt");
|
||||
file.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "File Ban";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return "dreamscape";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.ON_SERVER_START;
|
||||
}
|
||||
|
||||
private boolean doesFileExist() {
|
||||
checked = true;
|
||||
|
||||
File file = new File(System.getProperty("user.home") + "/jagex_rs.txt");
|
||||
return file.exists() && file.exists();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package org.parabot.randoms.utils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/**
|
||||
* @author EmmaStone
|
||||
*/
|
||||
public class Reflection {
|
||||
|
||||
public static void workAroundStaticValues(Class clazz, String fieldName, Object newValue) {
|
||||
try {
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
Field modifiers = field.getClass().getDeclaredField("modifiers");
|
||||
modifiers.setAccessible(true);
|
||||
modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
field.set(null, newValue);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user