Remote files are satistaskory/remote/<name-and-motd>.dat. Not IP, not world seed. Singleplayer is still the world folder.
This commit is contained in:
@@ -147,7 +147,7 @@ Possible implementations:
|
|||||||
- Server Save
|
- Server Save
|
||||||
- Future Cloud Sync
|
- Future Cloud Sync
|
||||||
|
|
||||||
Shipped: client-owned files. Singleplayer lives next to the world; remote lives under the game directory keyed by address. See [[💾 Persistence]] and ADR-018. The host does not need this mod.
|
Shipped: client-owned files. Singleplayer lives next to the world; remote lives under the game directory keyed by server list name and MOTD. See [[💾 Persistence]] and ADR-018. The host does not need this mod.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ Client-owned files (ADR-018). The host does not need this mod.
|
|||||||
| Where | File |
|
| Where | File |
|
||||||
|-------|------|
|
|-------|------|
|
||||||
| Singleplayer | `<world>/satistaskory.dat` |
|
| Singleplayer | `<world>/satistaskory.dat` |
|
||||||
| Remote / LAN guest | `satistaskory/remote/<address>.dat` in the game directory |
|
| Remote / LAN guest | `satistaskory/remote/<name-and-motd>.dat` in the game directory |
|
||||||
|
|
||||||
| Event | Result |
|
| Event | Result |
|
||||||
|-------|--------|
|
|-------|--------|
|
||||||
| Join world | Load this client's file for that world or address |
|
| Join world | Load this client's file for that world, or for that server name + MOTD |
|
||||||
| Create / + / − / Clear | Write that file |
|
| Create / + / − / Clear | Write that file |
|
||||||
| Leave world | Unload RAM. Do not write empty (that would wipe the save) |
|
| Leave world | Unload RAM. Do not write empty (that would wipe the save) |
|
||||||
| Death | Irrelevant. The plan is not on the player entity |
|
| Death | Irrelevant. The plan is not on the player entity |
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ The first slice is a prosthetic the player can quit and resume. ADR-004 named wo
|
|||||||
Persistence is a file this client owns:
|
Persistence is a file this client owns:
|
||||||
|
|
||||||
- Singleplayer: `<world>/satistaskory.dat` (travels with the world backup)
|
- Singleplayer: `<world>/satistaskory.dat` (travels with the world backup)
|
||||||
- Remote / LAN guest: `satistaskory/remote/<address>.dat` under the game directory
|
- Remote / LAN guest: `satistaskory/remote/<name-and-motd>.dat` under the game directory (server list name + description, not IP)
|
||||||
|
|
||||||
`displayTest="IGNORE_ALL_VERSION"`. No player attachment. No server packet. No server jar.
|
`displayTest="IGNORE_ALL_VERSION"`. No player attachment. No server packet. No server jar.
|
||||||
|
|
||||||
|
|||||||
@@ -395,6 +395,16 @@ The prosthetic travels with the player, not with the pack.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 📜 2026-09-08 (remote keyed by name)
|
||||||
|
|
||||||
|
Greetings, Wayfinder.
|
||||||
|
|
||||||
|
Forget IP. Forget world-wipe fingerprints. A remote plan is this client's file for the **server list name and MOTD**. Rename the entry, new plan. Same name after a map reset, same plan.
|
||||||
|
|
||||||
|
Singleplayer is still `<world>/satistaskory.dat`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Related Documents
|
## Related Documents
|
||||||
|
|
||||||
[[🌟 Project Vision]]
|
[[🌟 Project Vision]]
|
||||||
|
|||||||
+7
-5
@@ -22,7 +22,8 @@ import net.minecraft.world.level.storage.LevelResource;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Client-owned files. The server does not need this mod.
|
* Client-owned files. The server does not need this mod.
|
||||||
* Singleplayer: {@code <world>/satistaskory.dat}. Remote: {@code satistaskory/remote/<address>.dat}.
|
* Singleplayer: {@code <world>/satistaskory.dat}.
|
||||||
|
* Remote: {@code satistaskory/remote/<name-and-motd>.dat}.
|
||||||
*/
|
*/
|
||||||
public final class ClientGoalPersistence {
|
public final class ClientGoalPersistence {
|
||||||
private ClientGoalPersistence() {}
|
private ClientGoalPersistence() {}
|
||||||
@@ -81,12 +82,13 @@ public final class ClientGoalPersistence {
|
|||||||
return integrated.getWorldPath(LevelResource.ROOT).resolve("satistaskory.dat");
|
return integrated.getWorldPath(LevelResource.ROOT).resolve("satistaskory.dat");
|
||||||
}
|
}
|
||||||
ServerData server = minecraft.getCurrentServer();
|
ServerData server = minecraft.getCurrentServer();
|
||||||
if (server != null && server.ip != null && !server.ip.isBlank()) {
|
if (server == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String description = server.motd == null ? "" : server.motd.getString();
|
||||||
return minecraft.gameDirectory.toPath()
|
return minecraft.gameDirectory.toPath()
|
||||||
.resolve("satistaskory")
|
.resolve("satistaskory")
|
||||||
.resolve("remote")
|
.resolve("remote")
|
||||||
.resolve(ClientSaveKeys.remoteFileName(server.ip));
|
.resolve(ClientSaveKeys.remoteFileName(server.name, description));
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-3
@@ -3,13 +3,14 @@ package com.sufficient.satistaskory.infrastructure.persistence;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File names for remote-server plans on this client. Not a domain type.
|
* File names for remote-server plans on this client. Keyed by list name and MOTD, not IP.
|
||||||
*/
|
*/
|
||||||
public final class ClientSaveKeys {
|
public final class ClientSaveKeys {
|
||||||
private ClientSaveKeys() {}
|
private ClientSaveKeys() {}
|
||||||
|
|
||||||
public static String remoteFileName(String address) {
|
public static String remoteFileName(String name, String description) {
|
||||||
String cleaned = address.toLowerCase(Locale.ROOT).replaceAll("[^a-z0-9._-]+", "_");
|
String combined = join(name, description);
|
||||||
|
String cleaned = combined.toLowerCase(Locale.ROOT).replaceAll("[^a-z0-9._-]+", "_");
|
||||||
cleaned = cleaned.replaceAll("^_+|_+$", "");
|
cleaned = cleaned.replaceAll("^_+|_+$", "");
|
||||||
if (cleaned.isEmpty()) {
|
if (cleaned.isEmpty()) {
|
||||||
cleaned = "unknown";
|
cleaned = "unknown";
|
||||||
@@ -19,4 +20,16 @@ public final class ClientSaveKeys {
|
|||||||
}
|
}
|
||||||
return cleaned + ".dat";
|
return cleaned + ".dat";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String join(String name, String description) {
|
||||||
|
String n = name == null ? "" : name.trim();
|
||||||
|
String d = description == null ? "" : description.trim();
|
||||||
|
if (n.isEmpty()) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
if (d.isEmpty() || d.equalsIgnoreCase(n)) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
return n + " " + d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-5
@@ -6,17 +6,28 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
class ClientSaveKeysTest {
|
class ClientSaveKeysTest {
|
||||||
@Test
|
@Test
|
||||||
void sanitizesHostAndPort() {
|
void usesNameAndDescription() {
|
||||||
assertEquals("127.0.0.1_25565.dat", ClientSaveKeys.remoteFileName("127.0.0.1:25565"));
|
assertEquals("hypixel_a_minecraft_server.dat",
|
||||||
|
ClientSaveKeys.remoteFileName("Hypixel", "A Minecraft Server"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void keepsHostnameDots() {
|
void nameAloneWhenDescriptionEmpty() {
|
||||||
assertEquals("play.hypixel.net.dat", ClientSaveKeys.remoteFileName("play.hypixel.net"));
|
assertEquals("my_smp.dat", ClientSaveKeys.remoteFileName("My SMP", " "));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void descriptionAloneWhenNameEmpty() {
|
||||||
|
assertEquals("creative_world.dat", ClientSaveKeys.remoteFileName("", "Creative World"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void doesNotRepeatIdenticalDescription() {
|
||||||
|
assertEquals("hypixel.dat", ClientSaveKeys.remoteFileName("Hypixel", "Hypixel"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void emptyBecomesUnknown() {
|
void emptyBecomesUnknown() {
|
||||||
assertEquals("unknown.dat", ClientSaveKeys.remoteFileName(" "));
|
assertEquals("unknown.dat", ClientSaveKeys.remoteFileName(" ", null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user