InventoryItemCommand class
Пакет: com.hypixel.hytale.server.core.command.commands.player.inventory
Файл: com/hypixel/hytale/server/core/command/commands/player/inventory/InventoryItemCommand.java
extends: AbstractPlayerCommand
Поля (6)
| Модификаторы | Тип | Имя |
|---|---|---|
|
ItemStackItemContainer |
var10 |
|
Player |
var11 |
|
InventoryComponent.Hotbar |
var6 |
|
ItemContainer |
var7 |
|
byte |
var8 |
|
ItemStack |
var9 |
Методы (3)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var6 != null) |
|
|
if if(var11 != null) |
abstract |
|
super super("item", "server.commands.inventoryitem.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.protocol.packets.interface_.Page;
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.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.entity.entities.player.windows.ContainerWindow;
class="kw">import com.hypixel.hytale.server.core.inventory.InventoryComponent;
class="kw">import com.hypixel.hytale.server.core.inventory.ItemStack;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemStackItemContainer;
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 InventoryItemCommand class="kw">extends AbstractPlayerCommand {
@Nonnull
class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_INVENTORY_ITEM_NO_ITEM_IN_HAND = Message.translation("server.commands.inventory.item.noItemInHand");
@Nonnull
class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_INVENTORY_ITEM_NO_CONTAINER_ON_ITEM = Message.translation("server.commands.inventory.item.noContainerOnItem");
class="kw">public InventoryItemCommand() {
super("item", "server.commands.inventoryitem.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.Hotbar var6 = var2.getComponent(var3, InventoryComponent.Hotbar.getComponentType());
if (var6 != null) {
ItemContainer var7 = var6.getInventory();
byte var8 = var6.getActiveSlot();
ItemStack var9 = var6.getActiveItem();
if (ItemStack.isEmpty(var9)) {
var1.sendMessage(MESSAGE_COMMANDS_INVENTORY_ITEM_NO_ITEM_IN_HAND);
} else {
ItemStackItemContainer var10 = ItemStackItemContainer.getContainer(var7, var8);
if (var10 != null && var10.getCapacity() != 0) {
Player var11 = var2.getComponent(var3, Player.getComponentType());
if (var11 != null) {
var11.getPageManager().setPageWithWindows(var3, var2, Page.Bench, true, new ContainerWindow(var10));
}
} else {
var1.sendMessage(MESSAGE_COMMANDS_INVENTORY_ITEM_NO_CONTAINER_ON_ITEM);
}
}
}
}
}