AutoApplyMode enum

Пакет: com.hypixel.hytale.server.core.config

Файл: com/hypixel/hytale/server/core/config/UpdateConfig.java

Поля (1)

МодификаторыТипИмя
DISABLED, WHEN_EMPTY, SCHEDULED

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.config;

class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.codecs.EnumCodec;
class="kw">import com.hypixel.hytale.server.core.HytaleServerConfig;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class UpdateConfig {
   class="kw">public class="kw">static class="kw">final int DEFAULT_CHECK_INTERVAL_SECONDS = 3600;
   @Nonnull
   class="kw">public class="kw">static class="kw">final Codec<UpdateConfig> CODEC = BuilderCodec.builder(UpdateConfig.class, UpdateConfig::new)
      .append(new KeyedCodec<>("Enabled", Codec.BOOLEAN), (var0, var1) -> var0.enabled = var1, var0 -> var0.enabled)
      .documentation("Determines whether to enable automatic update checks.")
      .add()
      .<Integer>append(
         new KeyedCodec<>("CheckIntervalSeconds", Codec.INTEGER), (var0, var1) -> var0.checkIntervalSeconds = var1, var0 -> var0.checkIntervalSeconds
      )
      .documentation("The interval, in seconds, between automatic update checks.")
      .add()
      .<Boolean>append(
         new KeyedCodec<>("NotifyPlayersOnAvailable", Codec.BOOLEAN),
         (var0, var1) -> var0.notifyPlayersOnAvailable = var1,
         var0 -> var0.notifyPlayersOnAvailable
      )
      .documentation("Whether to notify players in-game when an update is available.")
      .add()
      .<String>append(new KeyedCodec<>("Patchline", Codec.STRING), (var0, var1) -> var0.patchline = var1, var0 -> var0.patchline)
      .documentation("The patchline to check for updates on.")
      .add()
      .<Boolean>append(
         new KeyedCodec<>("RunBackupBeforeUpdate", Codec.BOOLEAN), (var0, var1) -> var0.runBackupBeforeUpdate = var1, var0 -> var0.runBackupBeforeUpdate
      )
      .documentation("Determines whether to run a backup before applying an update.")
      .add()
      .<Boolean>append(
         new KeyedCodec<>("BackupConfigBeforeUpdate", Codec.BOOLEAN),
         (var0, var1) -> var0.backupConfigBeforeUpdate = var1,
         var0 -> var0.backupConfigBeforeUpdate
      )
      .documentation("Determines whether to backup the server config before applying an update.")
      .add()
      .<UpdateConfig.AutoApplyMode>append(
         new KeyedCodec<>("AutoApplyMode", new EnumCodec<>(UpdateConfig.AutoApplyMode.class)),
         (var0, var1) -> var0.autoApplyMode = var1,
         var0 -> var0.autoApplyMode
      )
      .documentation("The mode for automatically applying updates.")
      .add()
      .<Integer>append(
         new KeyedCodec<>("AutoApplyDelayMinutes", Codec.INTEGER), (var0, var1) -> var0.autoApplyDelayMinutes = var1, var0 -> var0.autoApplyDelayMinutes
      )
      .documentation("The delay in minutes before auto-applying an update while using SCHEDULED mode.")
      .add()
      .build();
   class="kw">private Boolean enabled;
   class="kw">private Integer checkIntervalSeconds;
   class="kw">private Boolean notifyPlayersOnAvailable;
   class="kw">private String patchline;
   class="kw">private Boolean runBackupBeforeUpdate;
   class="kw">private Boolean backupConfigBeforeUpdate;
   class="kw">private UpdateConfig.AutoApplyMode autoApplyMode;
   class="kw">private Integer autoApplyDelayMinutes;
   @Nullable
   class="kw">transient HytaleServerConfig hytaleServerConfig;

   class="kw">public UpdateConfig() {
   }

   class="kw">public UpdateConfig(@Nonnull HytaleServerConfig var1) {
      this.hytaleServerConfig = var1;
   }

   class="kw">public void setHytaleServerConfig(@Nonnull HytaleServerConfig var1) {
      this.hytaleServerConfig = var1;
   }

   class="kw">public boolean isEnabled() {
      class="kw">return this.enabled != null ? this.enabled : true;
   }

   class="kw">public void setEnabled(boolean var1) {
      this.enabled = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   class="kw">public int getCheckIntervalSeconds() {
      class="kw">return this.checkIntervalSeconds != null ? this.checkIntervalSeconds : 3600;
   }

   class="kw">public void setCheckIntervalSeconds(int var1) {
      this.checkIntervalSeconds = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   class="kw">public boolean isNotifyPlayersOnAvailable() {
      class="kw">return this.notifyPlayersOnAvailable != null ? this.notifyPlayersOnAvailable : true;
   }

   class="kw">public void setNotifyPlayersOnAvailable(boolean var1) {
      this.notifyPlayersOnAvailable = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   @Nullable
   class="kw">public String getPatchline() {
      class="kw">return this.patchline;
   }

   class="kw">public void setPatchline(@Nullable String var1) {
      this.patchline = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   class="kw">public boolean isRunBackupBeforeUpdate() {
      class="kw">return this.runBackupBeforeUpdate != null ? this.runBackupBeforeUpdate : true;
   }

   class="kw">public void setRunBackupBeforeUpdate(boolean var1) {
      this.runBackupBeforeUpdate = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   class="kw">public boolean isBackupConfigBeforeUpdate() {
      class="kw">return this.backupConfigBeforeUpdate != null ? this.backupConfigBeforeUpdate : true;
   }

   class="kw">public void setBackupConfigBeforeUpdate(boolean var1) {
      this.backupConfigBeforeUpdate = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   @Nonnull
   class="kw">public UpdateConfig.AutoApplyMode getAutoApplyMode() {
      class="kw">return this.autoApplyMode != null ? this.autoApplyMode : UpdateConfig.AutoApplyMode.DISABLED;
   }

   class="kw">public void setAutoApplyMode(@Nonnull UpdateConfig.AutoApplyMode var1) {
      this.autoApplyMode = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   class="kw">public int getAutoApplyDelayMinutes() {
      class="kw">return this.autoApplyDelayMinutes != null ? this.autoApplyDelayMinutes : 30;
   }

   class="kw">public void setAutoApplyDelayMinutes(int var1) {
      this.autoApplyDelayMinutes = var1;
      if (this.hytaleServerConfig != null) {
         this.hytaleServerConfig.markChanged();
      }
   }

   class="kw">public enum AutoApplyMode {
      DISABLED,
      WHEN_EMPTY,
      SCHEDULED;

      AutoApplyMode() {
      }
   }
}