Skip to content

Commit

Permalink
fixed config screens
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 8, 2023
1 parent e18f886 commit 158ba3e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -91,7 +91,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getClientSideText().asString());
}
MinecraftClient.getInstance().openScreen(this);
Expand All @@ -103,14 +103,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.setMessage(getClientSideText().asString());
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

@Override
Expand All @@ -131,7 +131,7 @@ private TranslatableText getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getHideViaButtonText().asString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -91,7 +91,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getClientSideText().asString());
}
MinecraftClient.getInstance().openScreen(this);
Expand All @@ -103,14 +103,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.setMessage(getClientSideText().asString());
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

@Override
Expand All @@ -131,7 +131,7 @@ private TranslatableText getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getHideViaButtonText().asString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -93,7 +93,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getClientSideText());
}
MinecraftClient.getInstance().openScreen(this);
Expand All @@ -105,14 +105,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.setMessage(getClientSideText());
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

@Override
Expand All @@ -133,7 +133,7 @@ private TranslatableText getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getHideViaButtonText());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -93,7 +93,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getClientSideText());
}
MinecraftClient.getInstance().setScreen(this);
Expand All @@ -105,14 +105,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.setMessage(getClientSideText());
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

@Override
Expand All @@ -133,7 +133,7 @@ private TranslatableText getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getHideViaButtonText());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -93,7 +93,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getClientSideText());
}
MinecraftClient.getInstance().setScreen(this);
Expand All @@ -105,14 +105,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.setMessage(getClientSideText());
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

@Override
Expand All @@ -133,7 +133,7 @@ private TranslatableText getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getHideViaButtonText());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -97,7 +97,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getClientSideText());
}
MinecraftClient.getInstance().setScreen(this);
Expand All @@ -109,14 +109,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.setMessage(getClientSideText());
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

@Override
Expand All @@ -137,7 +137,7 @@ private Text getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getHideViaButtonText());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -97,7 +97,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getClientSideText());
}
MinecraftClient.getInstance().setScreen(this);
Expand All @@ -109,14 +109,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.setMessage(getClientSideText());
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

@Override
Expand All @@ -137,7 +137,7 @@ private Text getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.setMessage(getHideViaButtonText());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void onChangeVersionField(String text) {
int finalNewVersion = newVersion;
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
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) {
Expand All @@ -93,7 +93,7 @@ private void onClickClientSide(ButtonWidget widget) {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
ViaFabric.config.setClientSideVersion(-2); // AUTO
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.message = getClientSideText().asUnformattedString();
}
MinecraftClient.getInstance().setScreen(this);
Expand All @@ -106,14 +106,14 @@ private void onClickClientSide(ButtonWidget widget) {
));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}
widget.message = getClientSideText().asUnformattedString();
}

@Override
public void removed() {
ViaFabric.config.saveConfig();
ViaFabric.config.save();
}

private TranslatableText getClientSideText() {
Expand All @@ -129,7 +129,7 @@ private TranslatableText getHideViaButtonText() {

private void onHideViaButton(ButtonWidget widget) {
ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
ViaFabric.config.saveConfig();
ViaFabric.config.save();
widget.message = getHideViaButtonText().asUnformattedString();
}

Expand Down

0 comments on commit 158ba3e

Please sign in to comment.