ConcurrencyCommand class

Пакет: com.hypixel.hytale.builtin.hytalegenerator.commands

Файл: com/hypixel/hytale/builtin/hytalegenerator/commands/ConcurrencyCommand.java

extends: AbstractAsyncPlayerCommand

Поля (7)

МодификаторыТипИмя
HytaleGenerator.Concurrency var5
HytaleGenerator var6
HytaleGenerator.Concurrency var6
int var7
int var7
int var8
int var9

Методы (2)

МодификаторыВозвратСигнатура
if if(var6 == null)
abstract super super("concurrency", "server.commands.worldgen2.concurrency.desc")

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.hytalegenerator.plugin.HytaleGenerator;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.AbstractAsyncPlayerCommand;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.concurrent.CompletableFuture;
class="kw">import javax.annotation.Nonnull;

class="kw">public class ConcurrencyCommand class="kw">extends AbstractAsyncPlayerCommand {
   @Nonnull
   class="kw">private class="kw">final RequiredArg<Integer> lowArg = this.withRequiredArg("low", "server.commands.worldgen2.concurrency.low.desc", ArgTypes.INTEGER);
   class="kw">private class="kw">final RequiredArg<Integer> normalArg = this.withRequiredArg("normal", "server.commands.worldgen2.concurrency.normal.desc", ArgTypes.INTEGER);
   class="kw">private class="kw">final RequiredArg<Integer> highArg = this.withRequiredArg("high", "server.commands.worldgen2.concurrency.high.desc", ArgTypes.INTEGER);

   class="kw">public ConcurrencyCommand() {
      super("concurrency", "server.commands.worldgen2.concurrency.desc");
   }

   @Nonnull
   @Override
   class="kw">protected CompletableFuture<Void> executeAsync(
      @Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5
   ) {
      HytaleGenerator var6 = HytaleGenerator.get();
      if (var6 == null) {
         class="kw">return CompletableFuture.completedFuture(null);
      }

      int var7 = Math.max(var1.get(this.lowArg), 0);
      int var8 = Math.max(var1.get(this.normalArg), 0);
      int var9 = Math.max(var1.get(this.highArg), 0);
      class="kw">return CompletableFuture.runAsync(
         () -> {
            HytaleGenerator.Concurrency var5 = var6.getConcurrency();
            var6.overrideConcurrency(new HytaleGenerator.Concurrency(var7, var8, var9));
            HytaleGenerator.Concurrency var6 = var6.getConcurrency();
            int var7 = Runtime.getRuntime().availableProcessors();
            var4.sendMessage(
               Message.translation("server.commands.worldgen2.concurrency.confirmation")
                  .param("low", var6.low())
                  .param("normal", var6.normal())
                  .param("high", var6.high())
                  .param("available", var7)
            );
         }
      );
   }
}