GiveNothingCommand class

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

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

extends: NPCWorldCommandBase

Методы (2)

МодификаторыВозвратСигнатура
protected void executeprotected void execute(@Nonnull CommandContext var1, @Nonnull NPCEntity var2, @Nonnull World var3, @Nonnull Store<EntityStore> var4, @Nonnull Ref<EntityStore> var5)
abstract super super("nothing", "server.commands.npc.give.nothing.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.asset.type.item.config.Item;
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.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 com.hypixel.hytale.server.npc.role.RoleUtils;
class="kw">import javax.annotation.Nonnull;

class="kw">public class NPCGiveCommand class="kw">extends NPCWorldCommandBase {
   @Nonnull
   class="kw">private class="kw">final RequiredArg<Item> itemArg = this.withRequiredArg("item", "server.commands.npc.give.item.desc", ArgTypes.ITEM_ASSET);

   class="kw">public NPCGiveCommand() {
      super("give", "server.commands.npc.give.desc");
      this.addSubCommand(new NPCGiveCommand.GiveNothingCommand());
   }

   @Override
   class="kw">protected void execute(
      @Nonnull CommandContext var1, @Nonnull NPCEntity var2, @Nonnull World var3, @Nonnull Store<EntityStore> var4, @Nonnull Ref<EntityStore> var5
   ) {
      Item var6 = this.itemArg.get(var1);
      String var7 = var6.getId();
      if (var6.getArmor() != null) {
         RoleUtils.setArmor(var5, var2, var7, var4);
      } else {
         RoleUtils.setItemInHand(var5, var2, var7, var4);
      }
   }

   class="kw">public class="kw">static class GiveNothingCommand class="kw">extends NPCWorldCommandBase {
      class="kw">public GiveNothingCommand() {
         super("nothing", "server.commands.npc.give.nothing.desc");
      }

      @Override
      class="kw">protected void execute(
         @Nonnull CommandContext var1, @Nonnull NPCEntity var2, @Nonnull World var3, @Nonnull Store<EntityStore> var4, @Nonnull Ref<EntityStore> var5
      ) {
         RoleUtils.setItemInHand(var5, var2, null, var4);
      }
   }
}