CrashRecoveryConfig class
Пакет: com.hypixel.hytale.server.core.config
Файл: com/hypixel/hytale/server/core/config/CrashRecoveryConfig.java
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
DEFAULT_MAX_ATTEMPTS |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
int |
getMaxAttemptsint getMaxAttempts() |
public |
int |
getRetryDelaySecondsint getRetryDelaySeconds() |
Исходный код
Показать/скрыть
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.codec.validation.Validators;
class="kw">import com.hypixel.hytale.server.core.universe.world.WorldCrashRecovery;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class CrashRecoveryConfig {
class="kw">public class="kw">static class="kw">final int DEFAULT_MAX_ATTEMPTS = 3;
class="kw">public class="kw">static class="kw">final int DEFAULT_RETRY_DELAY_SECONDS = 5;
class="kw">public class="kw">static class="kw">final WorldCrashRecovery DEFAULT_FALLBACK = WorldCrashRecovery.Shutdown;
class="kw">public class="kw">static class="kw">final int MAX_ATTEMPTS_LIMIT = 100;
class="kw">public class="kw">static class="kw">final int RETRY_DELAY_SECONDS_LIMIT = 3600;
@Nonnull
class="kw">public class="kw">static class="kw">final Codec<CrashRecoveryConfig> CODEC = BuilderCodec.builder(CrashRecoveryConfig.class, CrashRecoveryConfig::new)
.append(new KeyedCodec<>("Mode", new EnumCodec<>(WorldCrashRecovery.class)), (var0, var1) -> var0.mode = var1, var0 -> var0.mode)
.documentation(
"The action taken when the world crashes. One of None, Reload or Shutdown. If unset, the class="kw">default world uses the singleplayer or dedicated class="kw">default. Any other world with this block reloads."
)
.add()
.<Integer>append(new KeyedCodec<>("MaxAttempts", Codec.INTEGER), (var0, var1) -> var0.maxAttempts = var1, var0 -> var0.maxAttempts)
.addValidator(Validators.range(1, 100))
.documentation("The number of reload attempts before the fallback runs. Reload only.")
.add()
.<Integer>append(new KeyedCodec<>("RetryDelaySeconds", Codec.INTEGER), (var0, var1) -> var0.retryDelaySeconds = var1, var0 -> var0.retryDelaySeconds)
.addValidator(Validators.range(1, 3600))
.documentation("The delay in seconds before a reload attempt. Reload only.")
.add()
.<WorldCrashRecovery>append(
new KeyedCodec<>("Fallback", new EnumCodec<>(WorldCrashRecovery.class)), (var0, var1) -> var0.fallback = var1, var0 -> var0.fallback
)
.addValidator(Validators.notEqual(WorldCrashRecovery.Reload))
.documentation("The action after the reload attempts run out. One of None or Shutdown. Reload only.")
.add()
.build();
@Nullable
class="kw">private WorldCrashRecovery mode;
@Nullable
class="kw">private Integer maxAttempts;
@Nullable
class="kw">private Integer retryDelaySeconds;
@Nullable
class="kw">private WorldCrashRecovery fallback;
class="kw">public CrashRecoveryConfig() {
}
@Nullable
class="kw">public WorldCrashRecovery getMode() {
class="kw">return this.mode;
}
class="kw">public int getMaxAttempts() {
class="kw">return this.maxAttempts != null ? this.maxAttempts : 3;
}
class="kw">public int getRetryDelaySeconds() {
class="kw">return this.retryDelaySeconds != null ? this.retryDelaySeconds : 5;
}
@Nonnull
class="kw">public WorldCrashRecovery getFallback() {
class="kw">return this.fallback != null ? this.fallback : DEFAULT_FALLBACK;
}
}