UIGalleryCommand class
Пакет: com.hypixel.hytale.server.core.command.commands.utility
Файл: com/hypixel/hytale/server/core/command/commands/utility/UIGalleryCommand.java
extends: AbstractAsyncCommand
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Ref |
var2 |
|
Player |
var2 |
|
Store |
var3 |
|
PlayerRef |
var3 |
|
World |
var4 |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var2 != null && var3 != null) |
abstract |
|
super super("ui-gallery", "server.commands.uigallery.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.commands.utility;
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.AbstractAsyncCommand;
class="kw">import com.hypixel.hytale.server.core.command.system.pages.UIGalleryPage;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
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 java.util.concurrent.CompletableFuture;
class="kw">import javax.annotation.Nonnull;
class="kw">public class UIGalleryCommand class="kw">extends AbstractAsyncCommand {
@Nonnull
class="kw">private class="kw">static class="kw">final Message MESSAGE_PLAYER_NOT_IN_WORLD = Message.translation("server.commands.errors.playerNotInWorld");
class="kw">public UIGalleryCommand() {
super("ui-gallery", "server.commands.uigallery.desc");
this.setPermissionGroups("hytale:WorldEditor");
}
@Nonnull
@Override
class="kw">protected CompletableFuture<Void> executeAsync(@Nonnull CommandContext var1) {
if (!var1.isPlayer()) {
class="kw">return CompletableFuture.completedFuture(null);
} else {
Ref var2 = var1.senderAsPlayerRef();
if (var2 != null && var2.isValid()) {
Store var3 = var2.getStore();
World var4 = var3.getExternalData().getWorld();
class="kw">return CompletableFuture.runAsync(() -> {
Player var2 = var3.getComponent(var2, Player.getComponentType());
PlayerRef var3 = var3.getComponent(var2, PlayerRef.getComponentType());
if (var2 != null && var3 != null) {
var2.getPageManager().openCustomPage(var2, var3, new UIGalleryPage(var3));
}
}, var4);
} else {
var1.sendMessage(MESSAGE_PLAYER_NOT_IN_WORLD);
class="kw">return CompletableFuture.completedFuture(null);
}
}
}
}