mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 14:00:26 +00:00
Added shared update notices
- Iris joins shared Volmit update checks and reports - The iris.update permission controls update visibility - general.updateNotifications defaults to enabled - Accepted settings changes reconfigure update checks - Shutdown removes the settings listener and closes update checks - Tests cover persisted opt-outs and notifier lifecycle
This commit is contained in:
1 parent
be0cd567ed
commit
d480abad50
7 files changed
+142
No files matched your search
@@ -37,6 +37,7 @@ import art.arcane.iris.world.PendingWorldDeleteQueue;
|
||||
import art.arcane.iris.world.PendingWorldReplacementManager;
|
||||
import art.arcane.iris.world.WorldRefusalReporter;
|
||||
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
||||
import art.arcane.iris.update.IrisUpdateNotifier;
|
||||
import art.arcane.iris.pack.datapack.ServerConfigurator;
|
||||
import art.arcane.iris.pack.datapack.DatapackIngestService;
|
||||
import art.arcane.iris.pack.datapack.DatapackIngestService.StartupValidationOutcome;
|
||||
@@ -215,6 +216,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
|
||||
private final PendingWorldDeleteQueue pendingWorldDeletes = new PendingWorldDeleteQueue(this);
|
||||
private final PendingWorldReplacementManager pendingWorldReplacements = new PendingWorldReplacementManager(this);
|
||||
private BukkitLanguageSwitcher languageSwitcher;
|
||||
private IrisUpdateNotifier updateNotifier;
|
||||
private BukkitDebugDump debugDump;
|
||||
private volatile SettingsHotloadWatch settingsHotloadWatch;
|
||||
private volatile Thread serverLifecycleThread;
|
||||
@@ -637,6 +639,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
|
||||
languageSwitcher = BukkitLanguageSwitcher.register(this, IrisLanguage.selections(),
|
||||
new BukkitLanguageSwitcher.Options("iris", "iris.all",
|
||||
DirectorMiniMenu.Theme.irisGreen(), IrisLanguage.directorResolver(), IrisLanguage.editorOptions()));
|
||||
updateNotifier = new IrisUpdateNotifier(this);
|
||||
PaperLibBootstrap.install();
|
||||
SimdSupport.install();
|
||||
timings.mark("bootstrap");
|
||||
@@ -974,6 +977,10 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
if (updateNotifier != null) {
|
||||
updateNotifier.close();
|
||||
updateNotifier = null;
|
||||
}
|
||||
if (debugDump != null) {
|
||||
debugDump.close();
|
||||
debugDump = null;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package art.arcane.iris.update;
|
||||
|
||||
import art.arcane.iris.configuration.IrisSettings;
|
||||
import art.arcane.volmlib.util.update.BukkitUpdateService;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class IrisUpdateNotifier implements AutoCloseable {
|
||||
private final Consumer<IrisSettings> settingsListener = this::reconfigure;
|
||||
private final BukkitUpdateService updates;
|
||||
private volatile boolean enabled;
|
||||
private boolean closed;
|
||||
|
||||
public IrisUpdateNotifier(Plugin plugin) {
|
||||
enabled = IrisSettings.get().getGeneral().isUpdateNotifications();
|
||||
updates = BukkitUpdateService.register(plugin, new BukkitUpdateService.Options(
|
||||
"VolmitSoftware", "Iris", "iris.update", () -> enabled));
|
||||
IrisSettings.addSettingsListener(settingsListener);
|
||||
reconfigure(IrisSettings.get());
|
||||
}
|
||||
|
||||
private synchronized void reconfigure(IrisSettings settings) {
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
enabled = settings.getGeneral().isUpdateNotifications();
|
||||
updates.reconfigure();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void close() {
|
||||
closed = true;
|
||||
IrisSettings.removeSettingsListener(settingsListener);
|
||||
updates.close();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ authors: [ cyberpwn, NextdoorPsycho, Vatuu ]
|
||||
website: VolmitSoftware.com
|
||||
description: More than a Dimension!
|
||||
permissions:
|
||||
iris.update:
|
||||
description: Allows viewing Iris updates in VolmLib's combined update reports.
|
||||
default: op
|
||||
iris.debugdump:
|
||||
description: Allows creating and optionally uploading diagnostic reports.
|
||||
default: op
|
||||
|
||||
@@ -23,6 +23,9 @@ commands:
|
||||
iris:
|
||||
aliases: [ ir, irs ]
|
||||
permissions:
|
||||
iris.update:
|
||||
description: Allows viewing Iris updates in VolmLib's combined update reports.
|
||||
default: op
|
||||
iris.debugdump:
|
||||
description: Allows creating and optionally uploading diagnostic reports.
|
||||
default: op
|
||||
|
||||
Reference in new issue
Block a user