Added warning when starting ViaProxy for the first time

This commit is contained in:
Lenni0451 2023-05-28 17:15:37 +02:00
parent 4455f90949
commit e9b3f7605c
2 changed files with 22 additions and 0 deletions

View File

@ -52,6 +52,10 @@ public class UISave extends AbstractSave {
this.values.put(key, value);
}
public String get(final String key) {
return this.values.get(key);
}
public void loadTextField(final String key, final JTextField textField) {
try {
String value = this.values.get(key);

View File

@ -191,6 +191,24 @@ public class GeneralTab extends AUITab {
}
private void start() {
Object selectedItem = this.serverVersion.getSelectedItem();
if (!(selectedItem instanceof VersionEnum)) {
this.frame.showError("Please select a server version!");
return;
}
if (ViaProxy.saveManager.uiSave.get("notice.ban_warning") == null) {
ViaProxy.saveManager.uiSave.put("notice.ban_warning", "true");
ViaProxy.saveManager.save();
this.frame.showWarning("<html>ViaProxy may trigger anti-cheats, due to block, item, movement and other differences between versions. <b>USE AT OWN RISK!</b></html>");
}
if (VersionEnum.bedrockLatest.equals(selectedItem) && ViaProxy.saveManager.uiSave.get("notice.bedrock_warning") == null) {
ViaProxy.saveManager.uiSave.put("notice.bedrock_warning", "true");
ViaProxy.saveManager.save();
this.frame.showWarning("<html>ViaBedrock is currently in very early development and not ready for general use. <b>CONTINUE AT YOUR OWN RISK!</b></html>");
}
this.setComponentsEnabled(false);
this.stateButton.setEnabled(false);
this.stateButton.setText("Starting...");