Protect shared profiles from stale Lobby Builder snapshots

This commit is contained in:
unimatrixgit 2026-12-05 14:28:33 +01:00
commit 8251851bc8

View file

@ -133,6 +133,7 @@ public final class BuilderTransfer implements Listener {
private void restore(Player player, boolean travel) throws IOException {
Path file = snapshot(player);
if (!Files.exists(file)) return;
if (BuilderSharedProfiles.restore(player, file, travel, inBuilder(player.getWorld()), returning)) return;
var state = YamlConfiguration.loadConfiguration(file.toFile());
Location destination = state.getLocation("return");
GameMode mode = GameMode.valueOf(state.getString("mode"));
@ -161,6 +162,7 @@ public final class BuilderTransfer implements Listener {
restore(player, true);
return;
}
if (!BuilderSharedProfiles.allowTransfer(player, snapshot(player))) return;
World world = loadWorld();
if (world == null) {
player.sendMessage("The Arrakis build world is unavailable.");