NPCThawCommand class

Пакет: com.hypixel.hytale.server.npc.commands

Файл: com/hypixel/hytale/server/npc/commands/NPCThawCommand.java

extends: AbstractWorldCommand

Поля (3)

МодификаторыТипИмя
Pair var4
Ref var5
NPCEntity var6

Методы (2)

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

Исходный код

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

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.FlagArg;
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.entity.Frozen;
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.npc.entities.NPCEntity;
class="kw">import it.unimi.dsi.fastutil.Pair;
class="kw">import javax.annotation.Nonnull;

class="kw">public class NPCThawCommand class="kw">extends AbstractWorldCommand {
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_NPC_THAW_ALL = Message.translation("server.commands.npc.thaw.all");
   @Nonnull
   class="kw">private class="kw">final FlagArg allArg = this.withFlagArg("all", "server.commands.npc.thaw.arg.all");
   @Nonnull
   class="kw">private class="kw">final EntityWrappedArg entityArg = this.withOptionalArg("entity", "server.commands.entity.entity.desc", ArgTypes.ENTITY_ID);

   class="kw">public NPCThawCommand() {
      super("thaw", "server.commands.npc.thaw.desc");
      this.addAliases("unfreeze");
   }

   @Override
   class="kw">protected void execute(@Nonnull CommandContext var1, @Nonnull World var2, @Nonnull Store<EntityStore> var3) {
      if (this.allArg.get(var1)) {
         var3.forEachEntityParallel(
            NPCEntity.getComponentType(), (var0, var1x, var2x) -> var2x.tryRemoveComponent(var1x.getReferenceTo(var0), Frozen.getComponentType())
         );
         var1.sendMessage(MESSAGE_COMMANDS_NPC_THAW_ALL);
      } else {
         Pair var4 = NPCCommandUtils.getTargetNpc(var1, this.entityArg, var3);
         if (var4 != null) {
            Ref var5 = (Ref<EntityStore>)var4.first();
            NPCEntity var6 = (NPCEntity)var4.second();
            var3.tryRemoveComponent(var5, Frozen.getComponentType());
            var1.sendMessage(Message.translation("server.commands.npc.thaw.npc").param("role", var6.getRoleName()));
         }
      }
   }
}