Tell the pack's author about kept module updates when they open a studio

A server that only runs a pack logged every module update the pack kept back, along
with a hint to run the update command, for a person who should not run it. The
console now logs only the patches Iris took and packs that need a newer Iris.
/iris std open lists what the pack kept back and how to take it, on Bukkit and
modded alike, so the notice reaches the pack's author.
This commit is contained in:
piexel committed 2026-11-11 13:41:45 +01:00
1 parent 0d18637128
commit 9cc45b41d0
24 files changed
+83 -35

No files matched your search

@@ -123,6 +123,7 @@ public class CommandStudio implements DirectorExecutor {
@Param(defaultValue = "false", description = "Attempt to open Studio before a required registry restart", aliases = "f")
boolean force) {
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_OPENING_STUDIO_PACK_SEED, MessageArgument.untrusted("value", dimension.getName()), MessageArgument.untrusted("seed", seed)));
KeptModuleUpdates.keptAtLoad(dimension.getLoader()).forEach(sender()::sendMessage);
Iris.service(StudioSVC.class).open(sender(), seed, dimension.getLoadKey(), force);
}
@@ -415,14 +415,11 @@ public final class ModdedStudioCommands {
+ "' has no dimensions/" + pack + ".json definition.");
}
ModdedWorkspaceGenerator.writeWorkspace(data, packFolder, true);
server.execute(() -> executeStudioOpen(
source,
server,
owner,
dimensionId,
pack,
seed,
transition));
List<String> keptModuleUpdates = KeptModuleUpdates.keptAtLoad(data);
server.execute(() -> {
keptModuleUpdates.forEach(line -> IrisModdedCommands.ok(source, IrisLogging.clean(line)));
executeStudioOpen(source, server, owner, dimensionId, pack, seed, transition);
});
} catch (Throwable failure) {
transition.completeExceptionally(failure);
}
@@ -50,6 +50,8 @@ public final class IrisMessages {
public static final TextKey PACK_UPDATE_HEADER = text("iris.pack.update.header");
public static final TextKey PACK_UPDATE_WRITTEN = text("iris.pack.update.written");
public static final TextKey PACK_UPDATE_RESTART = text("iris.pack.update.restart");
public static final TextKey PACK_UPDATES_WAITING = text("iris.pack.updates.waiting");
public static final TextKey PACK_UPDATES_HOW_TO_TAKE = text("iris.pack.updates.how_to_take");
public static final TextKey MODDED_HELP_UNKNOWN_SECTION = text("iris.modded.help.unknown_section");
public static final TextKey MODDED_HELP_BACK_HOVER = text("iris.modded.help.back_hover");
public static final TextKey MODDED_HELP_COMMAND_PARAMETER = text("iris.modded.help.command_parameter");
@@ -48,6 +48,33 @@ public final class KeptModuleUpdates {
return lines;
}
/**
* What the pack of {@code data} kept back when its modules loaded, for its author opening a studio: the server's
* console does not say it, so whoever only runs the pack is not told to update it. Empty when nothing was kept or
* the modules fail to load, which opening the studio reports itself.
*/
public static List<String> keptAtLoad(IrisData data) {
PackModuleSet modules = data.getModules();
try {
modules.pack();
} catch (PackModulesException failure) {
return List.of();
}
ModuleUpdateReport report = modules.lastUpdates();
if (report.kept().isEmpty()) {
return List.of();
}
List<String> lines = new ArrayList<>();
lines.add(IrisLanguage.text(IrisMessages.PACK_UPDATES_WAITING, MessageArgument.untrusted("pack", modules.label())));
report.kept().forEach(change -> lines.add(IrisLanguage.text(IrisMessages.STUDIO_MODULES_KEPT,
MessageArgument.untrusted("change", change.describe()))));
if (report.keptOutOfDate()) {
lines.add(IrisLanguage.text(IrisMessages.PACK_UPDATES_HOW_TO_TAKE,
MessageArgument.untrusted("pack", data.getDataFolder().getName())));
}
return lines;
}
/** Like {@link #takeForPack} for a running world, which keeps the modules it loaded until the server restarts. */
public static List<String> takeForWorld(IrisData data) {
return take(data, true);
@@ -40,14 +40,12 @@ import java.util.stream.Collectors;
/**
* Keeps the module jars of one pack folder in step with its {@code modules.json} and with the jars Iris ships
* ({@link PackModuleUpdates}), tells the server's owner what changed and what was kept, and records what the pack loaded
* in {@code modules.lock.json}.
* ({@link PackModuleUpdates}), logs the jars it wrote, and records what the pack loaded in {@code modules.lock.json}. What
* the pack kept back goes to its author when they open a studio ({@link KeptModuleUpdates#keptAtLoad}), not to the log.
*/
final class ManagedPackModules {
private static final String UPDATE_PACK_COMMAND = "/iris std update ";
private static final String UPDATE_WORLD_COMMAND = "/iris pack update";
private static final String UNMANAGED_KEY = "pack-without-modules-manifest:";
private static final String KEPT_KEY = "pack-kept-module-update:";
private static final String NEEDS_NEWER_IRIS_KEY = "pack-needs-newer-iris:";
private final File packFolder;
private final ShippedModules shipped;
@@ -110,25 +108,12 @@ final class ManagedPackModules {
return;
}
report.written().forEach(change -> IrisLogging.info("%s: %s", label(), change.describe()));
report.kept().forEach(change -> warnOncePerStart(change.describe()));
report.needNewerIris().forEach(change -> warnOncePerStart(change.describeNeedForNewerIris()));
if (report.keptOutOfDate()) {
warnOncePerStart(updateAdvice());
}
}
private String updateAdvice() {
if (isWorldCopy()) {
return "run " + UPDATE_WORLD_COMMAND + " in that world to update them. Where a module changed terrain, new chunks"
+ " will not match the ones the world has.";
}
return "run " + UPDATE_PACK_COMMAND + packFolder.getName() + " to update them, then check the pack's settings against"
+ " the new versions.";
}
/** A server loads a world's pack several times while it starts; what the pack kept is the same each time. */
private void warnOncePerStart(String warning) {
IrisLogging.warnOnce(KEPT_KEY + packFolder.getAbsolutePath() + ":" + warning, "%s: %s", label(), warning);
IrisLogging.warnOnce(NEEDS_NEWER_IRIS_KEY + packFolder.getAbsolutePath() + ":" + warning, "%s: %s", label(), warning);
}
private void warnAboutMissingManifest() {
@@ -159,10 +144,6 @@ final class ManagedPackModules {
PackModuleSet.MODULES_FOLDER, missing.size() == 1 ? "it" : "them");
}
private boolean isWorldCopy() {
return worldFolder().isPresent();
}
private Optional<Path> worldFolder() {
return PackUse.worldFolderHolding(packFolder.toPath());
}
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aStarte den Server neu, um die aktualisierten Module zu laden.",
"iris.pack.updates.waiting": "§e{pack} hat Modul-Updates zurückgehalten:",
"iris.pack.updates.how_to_take": "§eFühre /iris std update {pack} aus, um sie zu übernehmen, und prüfe danach die Einstellungen des Packs gegen die neuen Versionen.",
"iris.director.commandstudio.director.list_pack_modules": "Module auflisten, die ein Pack lädt",
"iris.director.commandstudio.param.dimension_list_modules": "Das Pack, dessen Module aufgelistet werden",
"iris.modded.help.entry.command.modules": "Module auflisten, die ein Pack lädt",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aReinicia el servidor para cargar los módulos actualizados.",
"iris.pack.updates.waiting": "§e{pack} retuvo estas actualizaciones de módulos:",
"iris.pack.updates.how_to_take": "§eEjecuta /iris std update {pack} para aplicarlas y luego revisa la configuración del pack frente a las versiones nuevas.",
"iris.director.commandstudio.director.list_pack_modules": "Listar los módulos que carga un pack",
"iris.director.commandstudio.param.dimension_list_modules": "El pack cuyos módulos se listan",
"iris.modded.help.entry.command.modules": "Listar los módulos que carga un pack",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aKäynnistä palvelin uudelleen ladataksesi päivitetyt moduulit.",
"iris.pack.updates.waiting": "§e{pack} jätti nämä moduulipäivitykset asentamatta:",
"iris.pack.updates.how_to_take": "§eSuorita /iris std update {pack} ottaaksesi ne käyttöön ja tarkista sitten paketin asetukset uusia versioita vastaan.",
"iris.director.commandstudio.director.list_pack_modules": "Listaa moduulit, jotka paketti lataa",
"iris.director.commandstudio.param.dimension_list_modules": "Paketti, jonka moduulit listataan",
"iris.modded.help.entry.command.modules": "Listaa moduulit, jotka paketti lataa",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aRedémarrez le serveur pour charger les modules mis à jour.",
"iris.pack.updates.waiting": "§e{pack} a reporté les mises à jour de modules :",
"iris.pack.updates.how_to_take": "§eExécutez /iris std update {pack} pour les appliquer, puis vérifiez les paramètres du pack par rapport aux nouvelles versions.",
"iris.director.commandstudio.director.list_pack_modules": "Lister les modules que charge un pack",
"iris.director.commandstudio.param.dimension_list_modules": "Le pack dont lister les modules",
"iris.modded.help.entry.command.modules": "Lister les modules que charge un pack",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aהפעל מחדש את השרת כדי לטעון את המודולים המעודכנים.",
"iris.pack.updates.waiting": "§eעדכוני מודולים עבור {pack} נדחו:",
"iris.pack.updates.how_to_take": "§eהפעל /iris std update {pack} כדי לקבל אותם, ואז בדוק את הגדרות החבילה מול הגרסאות החדשות.",
"iris.director.commandstudio.director.list_pack_modules": "הצגת המודולים שחבילה טוענת",
"iris.director.commandstudio.param.dimension_list_modules": "החבילה שאת המודולים שלה יש להציג",
"iris.modded.help.entry.command.modules": "הצגת המודולים שחבילה טוענת",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aRiavvia il server per caricare i moduli aggiornati.",
"iris.pack.updates.waiting": "§e{pack} ha trattenuto questi aggiornamenti dei moduli:",
"iris.pack.updates.how_to_take": "§eEsegui /iris std update {pack} per applicarli, poi controlla le impostazioni del pack rispetto alle nuove versioni.",
"iris.director.commandstudio.director.list_pack_modules": "Elenca i moduli caricati da un pack",
"iris.director.commandstudio.param.dimension_list_modules": "Il pack di cui elencare i moduli",
"iris.modded.help.entry.command.modules": "Elenca i moduli caricati da un pack",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§a更新したモジュールを読み込むにはサーバーを再起動してください。",
"iris.pack.updates.waiting": "§e{pack} のモジュール更新を保留しました:",
"iris.pack.updates.how_to_take": "§e/iris std update {pack} を実行して適用し、その後パックの設定を新しいバージョンに照らして確認してください。",
"iris.director.commandstudio.director.list_pack_modules": "パックが読み込むモジュールを一覧表示します",
"iris.director.commandstudio.param.dimension_list_modules": "モジュールを一覧表示するパック",
"iris.modded.help.entry.command.modules": "パックが読み込むモジュールを一覧表示します",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§a업데이트된 모듈을 불러오려면 서버를 재시작하세요.",
"iris.pack.updates.waiting": "§e{pack} 보류된 모듈 업데이트:",
"iris.pack.updates.how_to_take": "§e/iris std update {pack} 명령을 실행해 업데이트를 적용한 뒤, 팩 설정을 새 버전에 맞춰 확인하세요.",
"iris.director.commandstudio.director.list_pack_modules": "팩이 불러오는 모듈을 나열합니다",
"iris.director.commandstudio.param.dimension_list_modules": "모듈을 나열할 팩",
"iris.modded.help.entry.command.modules": "팩이 불러오는 모듈을 나열합니다",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aPaleiskite serverį iš naujo, kad būtų įkelti atnaujinti moduliai.",
"iris.pack.updates.waiting": "§e{pack} sulaikė modulių atnaujinimus:",
"iris.pack.updates.how_to_take": "§eĮvykdykite /iris std update {pack}, kad juos įdiegtumėte, tada patikrinkite pakuotės nustatymus pagal naujas versijas.",
"iris.director.commandstudio.director.list_pack_modules": "Išvardyti modulius, kuriuos įkelia pakuotė",
"iris.director.commandstudio.param.dimension_list_modules": "Pakuotė, kurios modulius išvardyti",
"iris.modded.help.entry.command.modules": "Išvardyti modulius, kuriuos įkelia pakuotė",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aHerstart de server om de bijgewerkte modules te laden.",
"iris.pack.updates.waiting": "§e{pack} heeft moduleupdates teruggehouden:",
"iris.pack.updates.how_to_take": "§eVoer /iris std update {pack} uit om ze over te nemen en controleer daarna de instellingen van het pack tegen de nieuwe versies.",
"iris.director.commandstudio.director.list_pack_modules": "Toon de modules die een pack laadt",
"iris.director.commandstudio.param.dimension_list_modules": "Het pack waarvan de modules getoond worden",
"iris.modded.help.entry.command.modules": "Toon de modules die een pack laadt",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aUruchom serwer ponownie, aby wczytać zaktualizowane moduły.",
"iris.pack.updates.waiting": "§e{pack}: wstrzymano aktualizacje modułów:",
"iris.pack.updates.how_to_take": "§eUruchom /iris std update {pack}, aby je zastosować, a następnie sprawdź ustawienia packa względem nowych wersji.",
"iris.director.commandstudio.director.list_pack_modules": "Wyświetl moduły ładowane przez pack",
"iris.director.commandstudio.param.dimension_list_modules": "Pack, którego moduły wyświetlić",
"iris.modded.help.entry.command.modules": "Wyświetl moduły ładowane przez pack",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aReinicia o servidor para carregar os módulos atualizados.",
"iris.pack.updates.waiting": "§e{pack} reteve as atualizações dos módulos:",
"iris.pack.updates.how_to_take": "§eExecuta /iris std update {pack} para as aplicar e depois verifica as definições do pack face às novas versões.",
"iris.director.commandstudio.director.list_pack_modules": "Listar os módulos que um pack carrega",
"iris.director.commandstudio.param.dimension_list_modules": "O pack cujos módulos listar",
"iris.modded.help.entry.command.modules": "Listar os módulos que um pack carrega",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aПерезапустите сервер, чтобы загрузить обновлённые модули.",
"iris.pack.updates.waiting": "§e{pack}: отложены обновления модулей:",
"iris.pack.updates.how_to_take": "§eВыполните /iris std update {pack}, чтобы их установить, затем проверьте настройки пака по новым версиям.",
"iris.director.commandstudio.director.list_pack_modules": "Показать модули, которые загружает пак",
"iris.director.commandstudio.param.dimension_list_modules": "Пак, модули которого показать",
"iris.modded.help.entry.command.modules": "Показать модули, которые загружает пак",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aGüncellenen modülleri yüklemek için sunucuyu yeniden başlatın.",
"iris.pack.updates.waiting": "§e{pack} şu modül güncellemelerini geri tuttu:",
"iris.pack.updates.how_to_take": "§eBunları almak için /iris std update {pack} komutunu çalıştırın, ardından paketin ayarlarını yeni sürümlere göre kontrol edin.",
"iris.director.commandstudio.director.list_pack_modules": "Bir paketin yüklediği modülleri listele",
"iris.director.commandstudio.param.dimension_list_modules": "Modülleri listelenecek paket",
"iris.modded.help.entry.command.modules": "Bir paketin yüklediği modülleri listele",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aKhởi động lại máy chủ để tải các mô-đun đã cập nhật.",
"iris.pack.updates.waiting": "§e{pack} đã giữ lại các bản cập nhật mô-đun:",
"iris.pack.updates.how_to_take": "§eChạy /iris std update {pack} để áp dụng chúng, sau đó kiểm tra cài đặt của gói theo các phiên bản mới.",
"iris.director.commandstudio.director.list_pack_modules": "Liệt kê các mô-đun mà một gói tải",
"iris.director.commandstudio.param.dimension_list_modules": "Gói cần liệt kê mô-đun",
"iris.modded.help.entry.command.modules": "Liệt kê các mô-đun mà một gói tải",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§a重启服务器以加载更新后的模块。",
"iris.pack.updates.waiting": "§e{pack} 未自动安装以下模块更新:",
"iris.pack.updates.how_to_take": "§e运行 /iris std update {pack} 来应用这些更新,然后对照新版本检查该包的设置。",
"iris.director.commandstudio.director.list_pack_modules": "列出包加载的模块",
"iris.director.commandstudio.param.dimension_list_modules": "要列出模块的包",
"iris.modded.help.entry.command.modules": "列出包加载的模块",
@@ -44,6 +44,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§a重新啟動伺服器以載入更新後的模組。",
"iris.pack.updates.waiting": "§e{pack} 未自動安裝以下模組更新:",
"iris.pack.updates.how_to_take": "§e執行 /iris std update {pack} 來套用這些更新,然後對照新版本檢查該包的設定。",
"iris.director.commandstudio.director.list_pack_modules": "列出包載入的模組",
"iris.director.commandstudio.param.dimension_list_modules": "要列出模組的包",
"iris.modded.help.entry.command.modules": "列出包載入的模組",
@@ -21,6 +21,8 @@
"iris.pack.update.header": "§a{pack}:",
"iris.pack.update.written": "§f {change}",
"iris.pack.update.restart": "§aRestart the server to load the updated modules.",
"iris.pack.updates.waiting": "§e{pack} kept module updates back:",
"iris.pack.updates.how_to_take": "§eRun /iris std update {pack} to take them, then check the pack's settings against the new versions.",
"iris.command.reload.success": "Hotloaded settings and locale {locale}.",
"iris.command.reload.failed": "Settings were reloaded, but locale {locale} was rejected; continuing with {activeLocale}.",
"iris.modded.help.unknown_section": "Unknown Iris help section: {section}",
+8 -4
View File
@@ -230,14 +230,18 @@ A module's version is `major.minor.patch` with one fixed meaning:
- **patch** rises for fixes that leave the output and the settings alone.
Before a pack loads, Iris compares its jars with the ones it ships. Only a patch is taken without asking: Iris replaces
the jar and logs one line per module. A module with a new minor or major version stays as it is and Iris warns once per
server start that it is out of date, naming the version it ships:
the jar and logs one line per module. A module with a new minor or major version stays as it is. The console says
nothing about it, because whoever only runs the pack should not update it. `/iris std open` tells the pack's author
instead, naming the version Iris ships:
```
Pack overworld: iris:terrain 1.0.0 is out of date, 2.0.0 is available
Pack overworld: run /iris std update overworld to update them, then check the pack's settings against the new versions.
Pack overworld kept module updates back:
iris:terrain 1.0.0 is out of date, 2.0.0 is available
Run /iris std update overworld to take them, then check the pack's settings against the new versions.
```
`/iris std modules <pack>` lists the same kept updates after the pack's modules.
`/iris std update <pack>` takes every update for a pack folder, so its author can bring the settings in line with the
new versions. A studio world of the pack hotloads the new jars. `/iris pack update` does the same for the world the
sender is in, or `world=<name>`; where a module changed terrain, the world's new chunks will not match the ones it has.