HotbarSwitchCommand class
Пакет: com.hypixel.hytale.builtin.buildertools.commands
Файл: com/hypixel/hytale/builtin/buildertools/commands/HotbarSwitchCommand.java
extends: AbstractPlayerCommand
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Player |
var6 |
|
HotbarManager |
var7 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
|
super super("hotbar", "server.commands.hotbar.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.buildertools.commands;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
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.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.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.entity.entities.player.HotbarManager;
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 HotbarSwitchCommand class="kw">extends AbstractPlayerCommand {
@Nonnull
class="kw">private class="kw">final RequiredArg<Integer> hotbarSlotArg = this.withRequiredArg("hotbarSlot", "server.commands.hotbar.hotbarSlot.desc", ArgTypes.INTEGER)
.addValidator(Validators.range(0, 9));
@Nonnull
class="kw">private class="kw">final FlagArg saveInsteadOfLoadArg = this.withFlagArg("save", "server.commands.hotbar.save.desc");
class="kw">public HotbarSwitchCommand() {
super("hotbar", "server.commands.hotbar.desc");
this.setPermissionGroups("hytale:WorldEditor");
}
@Override
class="kw">protected void execute(
@Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5
) {
Player var6 = var2.getComponent(var3, Player.getComponentType());
assert var6 != null;
HotbarManager var7 = var6.getHotbarManager();
if (this.saveInsteadOfLoadArg.get(var1)) {
var7.saveHotbar(var3, this.hotbarSlotArg.get(var1).shortValue(), var2);
} else {
var7.loadHotbar(var3, this.hotbarSlotArg.get(var1).shortValue(), var2);
}
}
}