RateLimitConfig class

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

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

Поля (1)

МодификаторыТипИмя
final int DEFAULT_PACKETS_PER_SECOND

Методы (10)

МодификаторыВозвратСигнатура
public int getBurstCapacityint getBurstCapacity()
public int getPacketsPerSecondint getPacketsPerSecond()
if if(this.hytaleServerConfig != null)
if if(this.hytaleServerConfig != null)
if if(this.hytaleServerConfig != null)
public boolean isEnabledboolean isEnabled()
public void setBurstCapacityvoid setBurstCapacity(int var1)
public void setEnabledvoid setEnabled(boolean var1)
public void setHytaleServerConfigvoid setHytaleServerConfig(@Nonnull HytaleServerConfig var1)
public void setPacketsPerSecondvoid setPacketsPerSecond(int var1)

Исходный код

Показать/скрыть
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.server.core.HytaleServerConfig;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class RateLimitConfig {
   class="kw">public class="kw">static class="kw">final int DEFAULT_PACKETS_PER_SECOND = 2000;
   class="kw">public class="kw">static class="kw">final int DEFAULT_BURST_CAPACITY = 500;
   @Nonnull
   class="kw">public class="kw">static class="kw">final Codec<RateLimitConfig> CODEC = BuilderCodec.builder(RateLimitConfig.class, RateLimitConfig::new)
      .append(new KeyedCodec<>("Enabled", Codec.BOOLEAN), (var0, var1) -> var0.enabled = var1, var0 -> var0.enabled)
      .documentation("Determines whether packet rate limiting is enabled.")
      .add()
      .<Integer>append(new KeyedCodec<>("PacketsPerSecond", Codec.INTEGER), (var0, var1) -> var0.packetsPerSecond = var1, var0 -> var0.packetsPerSecond)
      .documentation("The number of packets allowed per second.")
      .add()
      .<Integer>append(new KeyedCodec<>("BurstCapacity", Codec.INTEGER), (var0, var1) -> var0.burstCapacity = var1, var0 -> var0.burstCapacity)
      .documentation("The number of packets that can be sent in a burst before rate limiting is applied.")
      .add()
      .build();
   class="kw">private Boolean enabled;
   class="kw">private Integer packetsPerSecond;
   class="kw">private Integer burstCapacity;
   @Nullable
   class="kw">transient HytaleServerConfig hytaleServerConfig;

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

   class="kw">public RateLimitConfig(@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 getPacketsPerSecond() {
      class="kw">return this.packetsPerSecond != null ? this.packetsPerSecond : 2000;
   }

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

   class="kw">public int getBurstCapacity() {
      class="kw">return this.burstCapacity != null ? this.burstCapacity : 500;
   }

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