ItemStateCommand class
Пакет: com.hypixel.hytale.server.core.command.commands.player.inventory
Файл: com/hypixel/hytale/server/core/command/commands/player/inventory/ItemStateCommand.java
extends: AbstractPlayerCommand
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
|
String |
var10 |
|
InventoryComponent.Hotbar |
var6 |
|
byte |
var7 |
|
ItemContainer |
var8 |
|
ItemStack |
var9 |
Методы (4)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var6 != null) |
|
|
if if(var7 == -1) |
|
|
if if(var9 == null) |
abstract |
|
super super("itemstate", "server.commands.itemstate.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.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.basecommands.AbstractPlayerCommand;
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.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 ItemStateCommand class="kw">extends AbstractPlayerCommand {
@Nonnull
class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_ITEMSTATE_NO_ITEM = Message.translation("server.commands.itemstate.noItem");
@Nonnull
class="kw">private class="kw">final RequiredArg<String> stateArg = this.withRequiredArg("state", "server.commands.itemstate.state.desc", ArgTypes.STRING);
class="kw">public ItemStateCommand() {
super("itemstate", "server.commands.itemstate.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) {
byte var7 = var6.getActiveSlot();
if (var7 == -1) {
var1.sendMessage(MESSAGE_COMMANDS_ITEMSTATE_NO_ITEM);
} else {
ItemContainer var8 = var6.getInventory();
ItemStack var9 = var8.getItemStack(var7);
if (var9 == null) {
var1.sendMessage(MESSAGE_COMMANDS_ITEMSTATE_NO_ITEM);
} else {
String var10 = this.stateArg.get(var1);
var8.setItemStackForSlot(var7, var9.withState(var10));
}
}
}
}
}