PrefabPathUpdatePauseCommand class

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

Файл: com/hypixel/hytale/builtin/path/commands/PrefabPathUpdatePauseCommand.java

extends: AbstractWorldCommand

Поля (8)

МодификаторыТипИмя
Double var4
Ref var5
var5
var5
Ref var6
Ref var7
PatrolPathMarkerEntity var8
Dirty var9

Методы (5)

МодификаторыВозвратСигнатура
if if(var6 == null)
if if(var7 == null)
if if(var8 == null)
if if(var9 != null)
abstract super super("pause", "server.commands.npcpath.update.pause.desc")

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.path.entities.PatrolPathMarkerEntity;
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.arguments.types.EntityWrappedArg;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.AbstractWorldCommand;
class="kw">import com.hypixel.hytale.server.core.command.system.exceptions.GeneralCommandException;
class="kw">import com.hypixel.hytale.server.core.entity.Dirty;
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 com.hypixel.hytale.server.core.util.TargetUtil;
class="kw">import javax.annotation.Nonnull;

class="kw">public class PrefabPathUpdatePauseCommand class="kw">extends AbstractWorldCommand {
   @Nonnull
   class="kw">private class="kw">final EntityWrappedArg entityIdArg = this.withOptionalArg("entityId", "server.commands.npcpath.update.pause.entityId.desc", ArgTypes.ENTITY_ID);
   @Nonnull
   class="kw">private class="kw">final RequiredArg<Double> pauseTimeArg = this.withRequiredArg("pauseTime", "server.commands.npcpath.update.pause.pauseTime.desc", ArgTypes.DOUBLE);

   class="kw">public PrefabPathUpdatePauseCommand() {
      super("pause", "server.commands.npcpath.update.pause.desc");
   }

   @Override
   class="kw">protected void execute(@Nonnull CommandContext var1, @Nonnull World var2, @Nonnull Store<EntityStore> var3) {
      Double var4 = this.pauseTimeArg.get(var1);
      Ref var5;
      if (this.entityIdArg.provided(var1)) {
         var5 = this.entityIdArg.get(var3, var1);
      } else {
         Ref var6 = var1.senderAsPlayerRef();
         if (var6 == null) {
            throw new GeneralCommandException(Message.translation("server.commands.errors.playerOrArg").param("option", "entity"));
         }

         if (!var6.isValid()) {
            throw new GeneralCommandException(Message.translation("server.commands.errors.playerNotInWorld").param("option", "entity"));
         }

         Ref var7 = TargetUtil.getTargetEntity(var6, var3);
         if (var7 == null) {
            throw new GeneralCommandException(Message.translation("server.commands.errors.no_entity_in_view").param("option", "entity"));
         }

         var5 = var7;
      }

      PatrolPathMarkerEntity var8 = var3.getComponent(var5, PatrolPathMarkerEntity.getComponentType());
      if (var8 == null) {
         var1.sendMessage(Message.translation("server.general.entityNotFound").param("id", var5.getIndex()));
      } else {
         var8.setPauseTime(var4);
         Dirty var9 = var3.getComponent(var5, Dirty.getComponentType());
         if (var9 != null) {
            var9.markDirty();
         }
      }
   }
}