WorldConfig class

Пакет: com.hypixel.hytale.server.core.asset.type.gameplay

Файл: com/hypixel/hytale/server/core/asset/type/gameplay/WorldConfig.java

Методы (8)

МодификаторыВозвратСигнатура
public float getBlockPlacementFragilityTimerfloat getBlockPlacementFragilityTimer()
public int getDaytimeDurationSecondsint getDaytimeDurationSeconds()
public int getNighttimeDurationSecondsint getNighttimeDurationSeconds()
public SleepConfig getSleepConfigSleepConfig getSleepConfig()
public int getTotalMoonPhasesint getTotalMoonPhases()
public boolean isBlockBreakingAllowedboolean isBlockBreakingAllowed()
public boolean isBlockGatheringAllowedboolean isBlockGatheringAllowed()
public boolean isBlockPlacementAllowedboolean isBlockPlacementAllowed()

Исходный код

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

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.server.core.asset.type.gameplay.sleep.SleepConfig;
class="kw">import javax.annotation.Nonnull;

class="kw">public class WorldConfig {
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<WorldConfig> CODEC = BuilderCodec.builder(WorldConfig.class, WorldConfig::new)
      .append(new KeyedCodec<>("AllowBlockBreaking", Codec.BOOLEAN), (var0, var1) -> var0.allowBlockBreaking = var1, var0 -> var0.allowBlockBreaking)
      .add()
      .append(new KeyedCodec<>("AllowBlockGathering", Codec.BOOLEAN), (var0, var1) -> var0.allowBlockGathering = var1, var0 -> var0.allowBlockGathering)
      .add()
      .append(new KeyedCodec<>("AllowBlockPlacement", Codec.BOOLEAN), (var0, var1) -> var0.allowBlockPlacement = var1, var0 -> var0.allowBlockPlacement)
      .add()
      .<Double>append(
         new KeyedCodec<>("BlockPlacementFragilityTimer", Codec.DOUBLE),
         (var0, var1) -> var0.blockPlacementFragilityTimer = var1.floatValue(),
         var0 -> (double)var0.blockPlacementFragilityTimer
      )
      .documentation("The timer, in seconds, that blocks have after placement during which they are fragile and can be broken instantly")
      .add()
      .<Integer>append(
         new KeyedCodec<>("DaytimeDurationSeconds", Codec.INTEGER), (var0, var1) -> var0.daytimeDurationSeconds = var1, var0 -> var0.daytimeDurationSeconds
      )
      .documentation("The number of real-world seconds it takes for the day to pass (from sunrise to sunset)")
      .add()
      .<Integer>append(
         new KeyedCodec<>("NighttimeDurationSeconds", Codec.INTEGER),
         (var0, var1) -> var0.nighttimeDurationSeconds = var1,
         var0 -> var0.nighttimeDurationSeconds
      )
      .documentation("The number of real-world seconds it takes for the night to pass (from sunset to sunrise)")
      .add()
      .append(new KeyedCodec<>("TotalMoonPhases", Codec.INTEGER), (var0, var1) -> var0.totalMoonPhases = var1, var0 -> var0.totalMoonPhases)
      .add()
      .<SleepConfig>append(new KeyedCodec<>("Sleep", SleepConfig.CODEC), (var0, var1) -> var0.sleepConfig = var1, var0 -> var0.sleepConfig)
      .documentation("Configurations related to sleeping in this world (in beds)")
      .add()
      .build();
   class="kw">public class="kw">static class="kw">final int DEFAULT_TOTAL_DAY_DURATION_SECONDS = 2880;
   class="kw">public class="kw">static class="kw">final int DEFAULT_DAYTIME_DURATION_SECONDS = 1728;
   class="kw">public class="kw">static class="kw">final int DEFAULT_NIGHTTIME_DURATION_SECONDS = 1151;
   class="kw">protected boolean allowBlockBreaking = true;
   class="kw">protected boolean allowBlockGathering = true;
   class="kw">protected boolean allowBlockPlacement = true;
   class="kw">protected int daytimeDurationSeconds = 1728;
   class="kw">protected int nighttimeDurationSeconds = 1151;
   class="kw">private int totalMoonPhases = 5;
   class="kw">protected float blockPlacementFragilityTimer;
   class="kw">private SleepConfig sleepConfig = SleepConfig.DEFAULT;

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

   class="kw">public boolean isBlockBreakingAllowed() {
      class="kw">return this.allowBlockBreaking;
   }

   class="kw">public boolean isBlockGatheringAllowed() {
      class="kw">return this.allowBlockGathering;
   }

   class="kw">public boolean isBlockPlacementAllowed() {
      class="kw">return this.allowBlockPlacement;
   }

   class="kw">public int getDaytimeDurationSeconds() {
      class="kw">return this.daytimeDurationSeconds;
   }

   class="kw">public int getNighttimeDurationSeconds() {
      class="kw">return this.nighttimeDurationSeconds;
   }

   class="kw">public int getTotalMoonPhases() {
      class="kw">return this.totalMoonPhases;
   }

   class="kw">public float getBlockPlacementFragilityTimer() {
      class="kw">return this.blockPlacementFragilityTimer;
   }

   class="kw">public SleepConfig getSleepConfig() {
      class="kw">return this.sleepConfig;
   }
}