InventoryClearCommand class

Пакет: com.hypixel.hytale.server.core.command.commands.player.inventory

Файл: com/hypixel/hytale/server/core/command/commands/player/inventory/InventoryClearCommand.java

extends: AbstractPlayerCommand

Поля (1)

МодификаторыТипИмя
InventoryComponent.Tool var6

Методы (2)

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

Исходный код

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

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.basecommands.AbstractPlayerCommand;
class="kw">import com.hypixel.hytale.server.core.inventory.InventoryComponent;
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 javax.annotation.Nonnull;

class="kw">public class InventoryClearCommand class="kw">extends AbstractPlayerCommand {
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_CLEARINV_SUCCESS = Message.translation("server.commands.clearinv.success");

   class="kw">public InventoryClearCommand() {
      super("clear", "server.commands.inventoryclear.desc");
      this.setPermissionGroups("hytale:Builder");
   }

   @Override
   class="kw">protected void execute(
      @Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5
   ) {
      InventoryComponent.getCombined(var2, var3, InventoryComponent.EVERYTHING).clear();
      InventoryComponent.Tool var6 = var2.getComponent(var3, InventoryComponent.Tool.getComponentType());
      if (var6 != null) {
         var6.getInventory().clear();
      }

      var1.sendMessage(MESSAGE_COMMANDS_CLEARINV_SUCCESS);
   }
}