add broadway-only option
This commit is contained in:
parent
08acee40cd
commit
1b66efcde0
8 changed files with 59 additions and 48 deletions
|
@ -33,7 +33,7 @@ public class DevStub implements IFMLLoadingPlugin {
|
|||
LoadHandler.data.set("release-branch", false);
|
||||
LoadHandler.data.set("branch", "[dev]");
|
||||
LoadHandler.data.set("username", "root");
|
||||
LoadHandler.data.set("disabledModules", new TCNArray());
|
||||
LoadHandler.data.set("disabled-modules", new TCNArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -343,7 +343,7 @@ public abstract class Feature extends ToggleButton implements SetCommand {
|
|||
}
|
||||
|
||||
public boolean canExist() {
|
||||
if(LoadHandler.data.getArray("disabledModules").contains(toString()))
|
||||
if(LoadHandler.data.getArray("disabled-modules").contains(toString()))
|
||||
return false;
|
||||
for (Class<? extends Feature> feature : required) {
|
||||
if(!Features.willFeatureExist(feature)) {
|
||||
|
|
|
@ -16,8 +16,8 @@ public class Connect extends Feature {
|
|||
|
||||
@Override
|
||||
protected void setup() {
|
||||
if(LoadHandler.data.getString("autoJoin") != null) {
|
||||
onCommand(LoadHandler.data.getString("autoJoin").split(":"));
|
||||
if(LoadHandler.data.getString("auto-join") != null) {
|
||||
onCommand(LoadHandler.data.getString("auto-join").split(":"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
public class MixinMinecraft {
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void onInit(CallbackInfo ci) {
|
||||
if(!Tools.firstNonNull(LoadHandler.data.getBoolean("loadBaseBand"), true))
|
||||
if(!Tools.firstNonNull(LoadHandler.data.getBoolean("load-baseband"), true))
|
||||
return;
|
||||
MixinProxy.minecraftOnInit();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.ArrayList;
|
|||
public class Configuration {
|
||||
|
||||
public static final ArrayList<Updater> updaters = new ArrayList<>();
|
||||
final Registry registry = new Registry(Tools.firstNonNull(LoadHandler.data.getString("configFile"), Setup.get().RegistryFilename));
|
||||
final Registry registry = new Registry(Tools.firstNonNull(LoadHandler.data.getString("config-file"), Setup.get().RegistryFilename));
|
||||
|
||||
private Configuration() throws IOException {
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class Loader implements Util {
|
|||
try {
|
||||
preOptions = JSON.read(new StreamReader(new FileInputStream("baseband_launch.json")).readAllAsString());
|
||||
preOptions.set("ip", null);
|
||||
preOptions.set("broadway-only", false);
|
||||
} catch (Exception e) {
|
||||
preOptions = new TCN();
|
||||
}
|
||||
|
@ -89,40 +90,44 @@ public class Loader implements Util {
|
|||
.label("Start Minecraft:")
|
||||
.option("Run BaseBand now", ClientBoot::finish)
|
||||
.option("Run without BaseBand", x -> {
|
||||
x.data.set("loadBaseBand", false);
|
||||
x.data.set("load-baseband", false);
|
||||
x.finish();
|
||||
})
|
||||
.option("Run in recovery mode", x -> {
|
||||
x.data.set("configFile", "baseband.db.tmp");
|
||||
File file = new File("baseband.db.tmp");
|
||||
file.delete();
|
||||
file.deleteOnExit();
|
||||
x.finish();
|
||||
})
|
||||
.option("Run in read-only mode", x -> {
|
||||
x.data.set("configFile", "baseband.db.tmp");
|
||||
File file = new File("baseband.db.tmp");
|
||||
file.delete();
|
||||
try {
|
||||
Files.copy(Paths.get("baseband.db"), file.toPath());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
file.deleteOnExit();
|
||||
x.finish();
|
||||
})
|
||||
.option("Run in debug mode", x -> {
|
||||
// Broadway-PopBob
|
||||
if(Hasher.sha512hex(JOptionPane.showInputDialog("I need to make sure you have permission to do this.")).equals("4d05926f29c573e2759f96958025a0a0f2ff6873270c3528d0066a9b6e29ab81f0c633890ef148a4b3da51e50e2c1b96cf9710b4a393bcf1261d54417e255a5e")) {
|
||||
x.data.set("ip", "localhost");
|
||||
x.finish();
|
||||
}
|
||||
else {
|
||||
x.currentOption().name = "You are not permitted to do this.";
|
||||
x.currentOption().toLabel();
|
||||
x.focus();
|
||||
}
|
||||
})
|
||||
.option("Run BaseBand (custom)", x -> x.newScreen()
|
||||
.option("Broadway-Only mode", x1 -> x.data.set("broadway-only", true))
|
||||
.option("Run BaseBand normally", ClientBoot::finish)
|
||||
.option("Run in recovery mode", x1 -> {
|
||||
x.data.set("config-file", "baseband.db.tmp");
|
||||
File file = new File("baseband.db.tmp");
|
||||
file.delete();
|
||||
file.deleteOnExit();
|
||||
x.finish();
|
||||
})
|
||||
.option("Run in read-only mode", x1 -> {
|
||||
x.data.set("config-file", "baseband.db.tmp");
|
||||
File file = new File("baseband.db.tmp");
|
||||
file.delete();
|
||||
try {
|
||||
Files.copy(Paths.get("baseband.db"), file.toPath());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
file.deleteOnExit();
|
||||
x.finish();
|
||||
})
|
||||
.option("Run in debug mode", x1 -> {
|
||||
// Broadway-PopBob
|
||||
if(Hasher.sha512hex(JOptionPane.showInputDialog("I need to make sure you have permission to do this.")).equals("4d05926f29c573e2759f96958025a0a0f2ff6873270c3528d0066a9b6e29ab81f0c633890ef148a4b3da51e50e2c1b96cf9710b4a393bcf1261d54417e255a5e")) {
|
||||
x.data.set("ip", "localhost");
|
||||
x.finish();
|
||||
}
|
||||
else {
|
||||
x.currentOption().name = "You are not permitted to do this.";
|
||||
x.currentOption().toLabel();
|
||||
x.focus();
|
||||
}
|
||||
})
|
||||
.option("Back", ClientBoot::back))
|
||||
.option("Redownload", x -> {
|
||||
x.data.set("redownload", true);
|
||||
x.finish();
|
||||
|
@ -151,7 +156,7 @@ public class Loader implements Util {
|
|||
.spacer()
|
||||
.label("Configuration:")
|
||||
.option("Configure BaseBand", x -> {
|
||||
x.data.setIfAbsent("disabledModules", new TCNArray());
|
||||
x.data.setIfAbsent("disabled-modules", new TCNArray());
|
||||
x.newScreen()
|
||||
.option(ClientBootUtil.moduleToggleLabel(x, "Spotify"), ClientBootUtil.moduleToggle("Spotify"))
|
||||
.option(ClientBootUtil.moduleToggleLabel(x, "Baritone"), ClientBootUtil.moduleToggle("Baritone"))
|
||||
|
@ -161,14 +166,14 @@ public class Loader implements Util {
|
|||
String ip = JOptionPane.showInputDialog("Please input the desired server IP:");
|
||||
if(ip != null && ip.isEmpty())
|
||||
ip = null;
|
||||
x1.data.set("autoJoin", ip);
|
||||
x1.data.set("auto-join", ip);
|
||||
x1.focus();
|
||||
})
|
||||
.option("Change config file", x1 -> {
|
||||
String file = JOptionPane.showInputDialog("Please input the desired name:");
|
||||
if(file != null && file.isEmpty())
|
||||
file = null;
|
||||
x1.data.set("configFile", file);
|
||||
x1.data.set("config-file", file);
|
||||
x1.focus();
|
||||
})
|
||||
.option("Back", ClientBoot::back);
|
||||
|
@ -189,7 +194,7 @@ public class Loader implements Util {
|
|||
.option("Exit Minecraft", x -> exit())
|
||||
.show();
|
||||
options.setIfAbsent("ip", "baseband.com.de");
|
||||
options.setIfAbsent("disabledModules", new TCNArray());
|
||||
options.setIfAbsent("disabled-modules", new TCNArray());
|
||||
|
||||
try(Socket client = new Socket(options.getString("ip"), 40000)) {
|
||||
client.setSoTimeout(5000);
|
||||
|
@ -304,6 +309,7 @@ public class Loader implements Util {
|
|||
tcn.set("password", key.decryptString(reader.readLine()));
|
||||
tcn.set("hardware-id", getToken());
|
||||
tcn.set("commit", options.getBoolean("redownload") == Boolean.TRUE ? "REDOWNLOAD!" : GitHash.GIT_HASH);
|
||||
tcn.set("broadway-only", options.getBoolean("broadway-only") == Boolean.TRUE);
|
||||
|
||||
TCN antiDump = new TCN();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ public class ClientBootUtil {
|
|||
|
||||
public static CBCallback moduleToggle(String module) {
|
||||
return x -> {
|
||||
TCNArray disabledModules = x.data.getArray("disabledModules");
|
||||
TCNArray disabledModules = x.data.getArray("disabled-modules");
|
||||
if(disabledModules.contains(module)) {
|
||||
x.currentOption().name = module + " enabled.";
|
||||
disabledModules.remove(module);
|
||||
|
@ -20,6 +20,6 @@ public class ClientBootUtil {
|
|||
}
|
||||
|
||||
public static String moduleToggleLabel(ClientBoot cb, String name) {
|
||||
return cb.data.getArray("disabledModules").contains(name) ? "Enable " + name + " support" : "Disable " + name + " support";
|
||||
return cb.data.getArray("disabled-modules").contains(name) ? "Enable " + name + " support" : "Disable " + name + " support";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,16 +29,21 @@ public class LoaderHandler {
|
|||
sendClasses(Main.classesLoader, key, outputStream);
|
||||
}
|
||||
if(response.o == UserHandler.Response.OK.ordinal()) {
|
||||
String userBranch = response.t.getString("branch");
|
||||
if(userData.getBoolean("broadway-only") == Boolean.TRUE) {
|
||||
userBranch = "release";
|
||||
}
|
||||
|
||||
TCN data = new TCN();
|
||||
data.set("release-branch", "release".equals(response.t.getString("branch")));
|
||||
data.set("branch", response.t.getString("branch"));
|
||||
data.set("release-branch", "release".equals(userBranch));
|
||||
data.set("branch", userBranch);
|
||||
data.set("username", userData.getString("username"));
|
||||
outputStream.writeString(key.encryptString(Tools.mapToString(data.toMap())));
|
||||
|
||||
Map<String, byte[]> classes = null;
|
||||
if("main".equals(response.t.getString("branch")))
|
||||
if("main".equals(userBranch))
|
||||
classes = Main.classesDebug;
|
||||
if("release".equals(response.t.getString("branch")))
|
||||
if("release".equals(userBranch))
|
||||
classes = Main.classes;
|
||||
if(classes != null) {
|
||||
sendClasses(classes, key, outputStream);
|
||||
|
|
Loading…
Add table
Reference in a new issue