Added ability to disable Meteor's API
This commit is contained in:
41
src/main/java/cloudburst/rejects/utils/RejectsConfig.java
Normal file
41
src/main/java/cloudburst/rejects/utils/RejectsConfig.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package cloudburst.rejects.utils;
|
||||
|
||||
import meteordevelopment.meteorclient.systems.System;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
|
||||
public class RejectsConfig extends System<RejectsConfig> {
|
||||
private static final RejectsConfig rejectsConfig = new RejectsConfig();
|
||||
|
||||
public enum HttpAllowed {
|
||||
Everything,
|
||||
NotMeteorApi,
|
||||
NotMeteorPing,
|
||||
Nothing
|
||||
}
|
||||
|
||||
public HttpAllowed httpAllowed = HttpAllowed.Everything;
|
||||
|
||||
public RejectsConfig() {
|
||||
super("rejects-config");
|
||||
init();
|
||||
load(MeteorClient.FOLDER);
|
||||
}
|
||||
|
||||
public static RejectsConfig get() {
|
||||
return rejectsConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound toTag() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString("httpAllowed", httpAllowed.toString());
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RejectsConfig fromTag(NbtCompound tag) {
|
||||
httpAllowed = HttpAllowed.valueOf(tag.getString("httpAllowed"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package cloudburst.rejects.utils;
|
||||
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@@ -7,6 +9,10 @@ public class RejectsUtils {
|
||||
public static int CPS = 0;
|
||||
|
||||
public static void init() {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
RejectsConfig.get().save(MeteorClient.FOLDER);
|
||||
}));
|
||||
|
||||
new Timer().scheduleAtFixedRate(newTimerTaskFromLambda(() -> CPS = 0), 0, 1000);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user