fixed config screens

This commit is contained in:
FlorianMichael 2023-10-08 09:50:46 +02:00
parent e18f886111
commit 158ba3ee93
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
8 changed files with 40 additions and 40 deletions

View File

@ -81,7 +81,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -91,7 +91,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getClientSideText().asString()); widget.setMessage(getClientSideText().asString());
} }
MinecraftClient.getInstance().openScreen(this); MinecraftClient.getInstance().openScreen(this);
@ -103,14 +103,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.setMessage(getClientSideText().asString()); widget.setMessage(getClientSideText().asString());
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
@Override @Override
@ -131,7 +131,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getHideViaButtonText().asString()); widget.setMessage(getHideViaButtonText().asString());
} }

View File

@ -81,7 +81,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -91,7 +91,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getClientSideText().asString()); widget.setMessage(getClientSideText().asString());
} }
MinecraftClient.getInstance().openScreen(this); MinecraftClient.getInstance().openScreen(this);
@ -103,14 +103,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.setMessage(getClientSideText().asString()); widget.setMessage(getClientSideText().asString());
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
@Override @Override
@ -131,7 +131,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getHideViaButtonText().asString()); widget.setMessage(getHideViaButtonText().asString());
} }

View File

@ -83,7 +83,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -93,7 +93,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
MinecraftClient.getInstance().openScreen(this); MinecraftClient.getInstance().openScreen(this);
@ -105,14 +105,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
@Override @Override
@ -133,7 +133,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getHideViaButtonText()); widget.setMessage(getHideViaButtonText());
} }

View File

@ -83,7 +83,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -93,7 +93,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
MinecraftClient.getInstance().setScreen(this); MinecraftClient.getInstance().setScreen(this);
@ -105,14 +105,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
@Override @Override
@ -133,7 +133,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getHideViaButtonText()); widget.setMessage(getHideViaButtonText());
} }

View File

@ -83,7 +83,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -93,7 +93,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
MinecraftClient.getInstance().setScreen(this); MinecraftClient.getInstance().setScreen(this);
@ -105,14 +105,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
@Override @Override
@ -133,7 +133,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getHideViaButtonText()); widget.setMessage(getHideViaButtonText());
} }

View File

@ -87,7 +87,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -97,7 +97,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
MinecraftClient.getInstance().setScreen(this); MinecraftClient.getInstance().setScreen(this);
@ -109,14 +109,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
@Override @Override
@ -137,7 +137,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getHideViaButtonText()); widget.setMessage(getHideViaButtonText());
} }

View File

@ -87,7 +87,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -97,7 +97,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
MinecraftClient.getInstance().setScreen(this); MinecraftClient.getInstance().setScreen(this);
@ -109,14 +109,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.setMessage(getClientSideText()); widget.setMessage(getClientSideText());
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
@Override @Override
@ -137,7 +137,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.setMessage(getHideViaButtonText()); widget.setMessage(getHideViaButtonText());
} }

View File

@ -83,7 +83,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
int finalNewVersion = newVersion; int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null); if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
ViaFabric.config.setClientSideVersion(finalNewVersion); ViaFabric.config.setClientSideVersion(finalNewVersion);
latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::saveConfig, ViaFabric.ASYNC_EXECUTOR); latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
} }
private void onClickClientSide(ButtonWidget widget) { private void onClickClientSide(ButtonWidget widget) {
@ -93,7 +93,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
if (answer) { if (answer) {
ViaFabric.config.setClientSideEnabled(true); ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.message = getClientSideText().asUnformattedString(); widget.message = getClientSideText().asUnformattedString();
} }
MinecraftClient.getInstance().setScreen(this); MinecraftClient.getInstance().setScreen(this);
@ -106,14 +106,14 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
widget.message = getClientSideText().asUnformattedString(); widget.message = getClientSideText().asUnformattedString();
} }
@Override @Override
public void removed() { public void removed() {
ViaFabric.config.saveConfig(); ViaFabric.config.save();
} }
private TranslatableText getClientSideText() { private TranslatableText getClientSideText() {
@ -129,7 +129,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton()); ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig(); ViaFabric.config.save();
widget.message = getHideViaButtonText().asUnformattedString(); widget.message = getHideViaButtonText().asUnformattedString();
} }