ObjectiveStartCommand class

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

Файл: com/hypixel/hytale/builtin/adventure/objectives/commands/ObjectiveStartCommand.java

extends: AbstractCommandCollection

Поля (8)

МодификаторыТипИмя
private final RequiredArg<String> objectiveArg
private final RequiredArg<String> objectiveLineArg
String var6
String var6
ObjectiveAsset var7
HashSet var7
HashSet var8
Objective var9

Методы (9)

МодификаторыВозвратСигнатура
public StartObjectiveCommandpublic StartObjectiveCommand()
public StartObjectiveLineCommandpublic StartObjectiveLineCommand()
protected void executeprotected void execute(@Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5)
protected void executeprotected void execute(@Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5)
if if(var7 == null)
if if(var9 != null)
abstract super super("start", "server.commands.objective.start")
abstract super super("objective", "server.commands.objective.start.objective")
abstract super super("line", "server.commands.objective.start.objectiveLine")

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.adventure.objectives.Objective;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.ObjectivePlugin;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.ObjectiveAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.ObjectiveLineAsset;
class="kw">import com.hypixel.hytale.common.util.StringUtil;
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.CommandUtil;
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.AbstractCommandCollection;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;
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.HashSet;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;

class="kw">public class ObjectiveStartCommand class="kw">extends AbstractCommandCollection {
   class="kw">public ObjectiveStartCommand() {
      super("start", "server.commands.objective.start");
      this.addSubCommand(new ObjectiveStartCommand.StartObjectiveCommand());
      this.addSubCommand(new ObjectiveStartCommand.StartObjectiveLineCommand());
   }

   class="kw">public class="kw">static class StartObjectiveCommand class="kw">extends AbstractPlayerCommand {
      @Nonnull
      class="kw">private class="kw">final RequiredArg<String> objectiveArg = this.withRequiredArg(
         "objectiveId", "server.commands.objective.start.objective.arg.objectiveId.desc", ArgTypes.STRING
      );

      class="kw">public StartObjectiveCommand() {
         super("objective", "server.commands.objective.start.objective");
      }

      @Override
      class="kw">protected void execute(
         @Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5
      ) {
         String var6 = this.objectiveArg.get(var1);
         ObjectiveAsset var7 = ObjectiveAsset.getAssetMap().getAsset(var6);
         if (var7 == null) {
            var1.sendMessage(Message.translation("server.commands.objective.objectiveNotFound").param("id", var6));
            var1.sendMessage(
               Message.translation("server.general.failed.didYouMean")
                  .param(
                     "choices",
                     StringUtil.sortByFuzzyDistance(var6, ObjectiveAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT).toString()
                  )
            );
         } else {
            HashSet var8 = new HashSet<>();
            var8.add(var4.getUuid());
            Objective var9 = ObjectivePlugin.get().startObjective(var6, var8, var5.getWorldConfig().getUuid(), null, var2);
            if (var9 != null) {
               var9.checkTaskSetCompletion(var2);
            }
         }
      }
   }

   class="kw">public class="kw">static class StartObjectiveLineCommand class="kw">extends AbstractPlayerCommand {
      @Nonnull
      class="kw">private class="kw">final RequiredArg<String> objectiveLineArg = this.withRequiredArg(
         "objectiveLineId", "server.commands.objective.start.objectiveLine.arg.objectiveLineId.desc", ArgTypes.STRING
      );

      class="kw">public StartObjectiveLineCommand() {
         super("line", "server.commands.objective.start.objectiveLine");
      }

      @Override
      class="kw">protected void execute(
         @Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5
      ) {
         String var6 = this.objectiveLineArg.get(var1);
         if (ObjectiveLineAsset.getAssetMap().getAsset(var6) == null) {
            var1.sendMessage(Message.translation("server.commands.objective.objectiveLineNotFound").param("id", var6));
            var1.sendMessage(
               Message.translation("server.general.failed.didYouMean")
                  .param(
                     "choices",
                     StringUtil.sortByFuzzyDistance(var6, ObjectiveLineAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT).toString()
                  )
            );
         } else {
            HashSet var7 = new HashSet<>();
            var7.add(var4.getUuid());
            ObjectivePlugin.get().startObjectiveLine(var2, var6, var7, var5.getWorldConfig().getUuid(), null);
         }
      }
   }
}