InstanceWorldConfig class

Пакет: com.hypixel.hytale.builtin.instances.config

Файл: com/hypixel/hytale/builtin/instances/config/InstanceWorldConfig.java

Методы (7)

МодификаторыВозвратСигнатура
public void setDiscoveryvoid setDiscovery(@Nullable InstanceDiscoveryConfig var1)
public void setDocumentDisplayOnRemovalvoid setDocumentDisplayOnRemoval(@Nullable String var1)
public void setInstanceNamevoid setInstanceName(@Nullable String var1)
public void setRemovalConditionsvoid setRemovalConditions(@Nonnull RemovalCondition... var1)
public void setReturnPointvoid setReturnPoint(@Nullable WorldReturnPoint var1)
public boolean shouldPreventReconnectionboolean shouldPreventReconnection()
public boolean shouldRespawnWhenTargetedboolean shouldRespawnWhenTargeted()

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.instances.removal.RemovalCondition;
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.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.server.core.universe.world.WorldConfig;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class InstanceWorldConfig {
   @Nonnull
   class="kw">public class="kw">static class="kw">final String ID = "Instance";
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<InstanceWorldConfig> CODEC = BuilderCodec.builder(InstanceWorldConfig.class, InstanceWorldConfig::new)
      .append(
         new KeyedCodec<>("RemovalConditions", new ArrayCodec<>(RemovalCondition.CODEC, RemovalCondition[]::new)),
         (var0, var1) -> var0.removalConditions = var1,
         var0 -> var0.removalConditions
      )
      .documentation(
         "The set of conditions that have to be met to remove the world.\n\nIf no conditions are provided (e.g. a empty list) then the world will not be removed automatically"
      )
      .addValidator(Validators.nonNull())
      .add()
      .<WorldReturnPoint>append(new KeyedCodec<>("ReturnPoint", WorldReturnPoint.CODEC), (var0, var1) -> var0.returnPoint = var1, var0 -> var0.returnPoint)
      .documentation("The location to send players to when leaving this world.")
      .add()
      .<Boolean>append(
         new KeyedCodec<>("PreventReconnection", Codec.BOOLEAN), (var0, var1) -> var0.preventReconnection = var1, var0 -> var0.preventReconnection
      )
      .documentation(
         "Whether to prevent reconnecting into this world.\n\nPlayers that reconnect back into the world will forced out of the world to the class="kw">return point (or their own)."
      )
      .add()
      .<InstanceDiscoveryConfig>append(
         new KeyedCodec<>("Discovery", InstanceDiscoveryConfig.CODEC), (var0, var1) -> var0.discovery = var1, var0 -> var0.discovery
      )
      .documentation("Optional discovery configuration for displaying an event title when a player enters this instance for the first time.")
      .add()
      .<Boolean>append(
         new KeyedCodec<>("RespawnWhenTargeted", Codec.BOOLEAN), (var0, var1) -> var0.respawnWhenTargeted = var1, var0 -> var0.respawnWhenTargeted
      )
      .documentation(
         "Whether a class="kw">return point targeting a copy of this instance reuses a live copy, or spawns a fresh one, when the original copy is gone. Requires InstanceKey. Only enable this on instances that restore their own state (or are stateless), because a fresh copy starts from the template."
      )
      .add()
      .<String>append(new KeyedCodec<>("InstanceKey", Codec.STRING), (var0, var1) -> var0.instanceKey = var1, var0 -> var0.instanceKey)
      .documentation(
         "The fixed world key this instance's single copy lives under. Every spawn path converges on this one copy, and returns look it up by this key. Omit for instances that spawn a copy per use."
      )
      .add()
      .<String>append(new KeyedCodec<>("InstanceName", Codec.STRING), (var0, var1) -> var0.instanceName = var1, var0 -> var0.instanceName)
      .documentation("The instance asset this world was spawned from. Set by the spawn flow; not authored.")
      .add()
      .<String>append(
         new KeyedCodec<>("DocumentDisplayOnRemoval", Codec.STRING),
         (var0, var1) -> var0.documentDisplayOnRemoval = var1,
         var0 -> var0.documentDisplayOnRemoval
      )
      .documentation(
         "The UI document to show to the players of this world while it closes. The path is relative to \"HytaleAssets/Common/UI/Custom\". If no document is provided then the world closes immediately."
      )
      .add()
      .build();
   @Nonnull
   class="kw">private RemovalCondition[] removalConditions = RemovalCondition.EMPTY;
   @Nullable
   class="kw">private WorldReturnPoint returnPoint;
   class="kw">private boolean preventReconnection;
   @Nullable
   class="kw">private InstanceDiscoveryConfig discovery;
   class="kw">private boolean respawnWhenTargeted;
   @Nullable
   class="kw">private String instanceKey;
   @Nullable
   class="kw">private String instanceName;
   @Nullable
   class="kw">private String documentDisplayOnRemoval;

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

   @Nullable
   class="kw">public class="kw">static InstanceWorldConfig get(@Nonnull WorldConfig var0) {
      class="kw">return var0.getPluginConfig().get(InstanceWorldConfig.class);
   }

   @Nonnull
   class="kw">public class="kw">static InstanceWorldConfig ensureAndGet(@Nonnull WorldConfig var0) {
      class="kw">return var0.getPluginConfig().computeIfAbsent(InstanceWorldConfig.class, var0x -> new InstanceWorldConfig());
   }

   class="kw">public boolean shouldPreventReconnection() {
      class="kw">return this.preventReconnection;
   }

   @Nonnull
   class="kw">public RemovalCondition[] getRemovalConditions() {
      class="kw">return this.removalConditions;
   }

   class="kw">public void setRemovalConditions(@Nonnull RemovalCondition... var1) {
      this.removalConditions = var1;
   }

   @Nullable
   class="kw">public WorldReturnPoint getReturnPoint() {
      class="kw">return this.returnPoint;
   }

   class="kw">public void setReturnPoint(@Nullable WorldReturnPoint var1) {
      this.returnPoint = var1;
   }

   @Nullable
   class="kw">public InstanceDiscoveryConfig getDiscovery() {
      class="kw">return this.discovery;
   }

   class="kw">public void setDiscovery(@Nullable InstanceDiscoveryConfig var1) {
      this.discovery = var1;
   }

   class="kw">public boolean shouldRespawnWhenTargeted() {
      class="kw">return this.respawnWhenTargeted;
   }

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

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

   class="kw">public void setInstanceName(@Nullable String var1) {
      this.instanceName = var1;
   }

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

   class="kw">public void setDocumentDisplayOnRemoval(@Nullable String var1) {
      this.documentDisplayOnRemoval = var1;
   }
}