fixes
This commit is contained in:
1 parent
83aea53e57
commit
aa4f6b6ddc
842 files changed
+47284
-91563
No files matched your search
@@ -18,8 +18,8 @@ import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Local (offline) backend of the Configs page. Every config is one JSON file in {@code <gameDir>/prestige/configs/}:
|
||||
* the card metadata plus the client's own snapshot ({@code ConfigManager.a()}), which is applied again with
|
||||
* {@code ConfigManager.a(String)}. "Public configs" lists the configs saved with Public visibility, "Personal configs"
|
||||
* the card metadata plus the client's own snapshot ({@code ConfigManager.saveToJson()}), which is applied again with
|
||||
* {@code ConfigManager.loadFromJson(String)}. "Public configs" lists the configs saved with Public visibility, "Personal configs"
|
||||
* lists all of them; Create saves the current module/HUD state, Update overwrites it, Delete removes the file.
|
||||
*/
|
||||
public final class LocalConfigs {
|
||||
@@ -36,7 +36,7 @@ public final class LocalConfigs {
|
||||
List<String> tags = new ArrayList<>();
|
||||
int visibility; // 0 personal, 1 public
|
||||
int downloads;
|
||||
JsonObject data; // snapshot produced by ConfigManager.a()
|
||||
JsonObject data; // snapshot produced by ConfigManager.saveToJson()
|
||||
}
|
||||
|
||||
private static boolean ready;
|
||||
@@ -151,8 +151,8 @@ public final class LocalConfigs {
|
||||
// ------------------------------------------------------------------ actions
|
||||
|
||||
private static String snapshot() {
|
||||
if (Prestige.e == null) return null;
|
||||
try { return Prestige.e.a(); } catch (Throwable t) { System.out.println("[prestige-ui] snapshot: " + t); return null; }
|
||||
if (Prestige.configManager == null) return null;
|
||||
try { return Prestige.configManager.saveToJson(); } catch (Throwable t) { System.out.println("[prestige-ui] snapshot: " + t); return null; }
|
||||
}
|
||||
|
||||
static void create() {
|
||||
@@ -190,10 +190,10 @@ public final class LocalConfigs {
|
||||
static void download(ConfigsPage.Cfg c) {
|
||||
Entry e = find(c);
|
||||
if (e == null || e.data == null) { WidgetsPage.toast("Config is empty"); return; }
|
||||
if (Prestige.e == null) { WidgetsPage.toast("Client is not ready"); return; }
|
||||
if (Prestige.configManager == null) { WidgetsPage.toast("Client is not ready"); return; }
|
||||
try {
|
||||
Prestige.e.a(e.data.toString());
|
||||
String report = Prestige.e.b();
|
||||
Prestige.configManager.loadFromJson(e.data.toString());
|
||||
String report = Prestige.configManager.consumeLoadReport();
|
||||
e.downloads++;
|
||||
c.downloads = e.downloads;
|
||||
write(e);
|
||||
|
||||
Reference in new issue
Block a user