WarpCommand class
Пакет: com.hypixel.hytale.builtin.teleport.commands.warp
Файл: com/hypixel/hytale/builtin/teleport/commands/warp/WarpCommand.java
extends: AbstractCommandCollection
Поля (8)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Vector3d |
var10 |
|
Rotation3f |
var11 |
|
Warp |
var4 |
|
String |
var5 |
|
World |
var6 |
|
Teleport |
var7 |
|
TransformComponent |
var8 |
|
HeadRotation |
var9 |
Методы (4)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var4 == null) |
|
|
if if(var6 != null && var7 != null) |
abstract |
|
super super("warp", "server.commands.warp.desc") |
static |
void |
tryGovoid tryGo(@Nonnull CommandContext var0, @Nonnull String var1, @Nonnull Ref<EntityStore> var2, @Nonnull Store<EntityStore> var3) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.teleport.commands.warp;
class="kw">import com.hypixel.hytale.builtin.teleport.TeleportPlugin;
class="kw">import com.hypixel.hytale.builtin.teleport.Warp;
class="kw">import com.hypixel.hytale.builtin.teleport.components.TeleportHistory;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
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.AbstractCommandCollection;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.HeadRotation;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.teleport.Teleport;
class="kw">import com.hypixel.hytale.server.core.universe.Universe;
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 it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectSet;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectSets;
class="kw">import java.util.Locale;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">public class WarpCommand class="kw">extends AbstractCommandCollection {
@Nonnull
class="kw">protected class="kw">static class="kw">final Message MESSAGE_COMMANDS_MODIFICATION_CANCELLED = Message.translation("server.commands.teleport.warp.modify.cancelled");
@Nonnull
class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_TELEPORT_WARP_NOT_LOADED = Message.translation("server.commands.teleport.warp.notLoaded");
class="kw">private class="kw">final ObjectSet<String> keywords = new ObjectOpenHashSet();
class="kw">private class="kw">final ObjectSet<String> keywordsView = ObjectSets.unmodifiable(this.keywords);
class="kw">public WarpCommand() {
super("warp", "server.commands.warp.desc");
this.addUsageVariant(new WarpGoVariantCommand());
this.addSubCommand(new WarpGoCommand());
this.addSubCommand(new WarpListCommand());
this.addSubCommand(new WarpRemoveCommand());
this.addSubCommand(new WarpReloadCommand());
this.addSubCommand(new WarpSetCommand(this.keywordsView));
this.keywords.addAll(this.getSubCommands().keySet());
}
class="kw">static void tryGo(@Nonnull CommandContext var0, @Nonnull String var1, @Nonnull Ref<EntityStore> var2, @Nonnull Store<EntityStore> var3) {
if (!TeleportPlugin.get().isWarpsLoaded()) {
var0.sendMessage(MESSAGE_COMMANDS_TELEPORT_WARP_NOT_LOADED);
} else {
Warp var4 = TeleportPlugin.get().getWarps().get(var1.toLowerCase(Locale.ROOT));
if (var4 == null) {
var0.sendMessage(Message.translation("server.commands.teleport.warp.unknownWarp").param("name", var1));
} else {
String var5 = var4.getWorld();
World var6 = Universe.get().getWorld(var5);
Teleport var7 = var4.toTeleport();
if (var6 != null && var7 != null) {
TransformComponent var8 = var3.getComponent(var2, TransformComponent.getComponentType());
assert var8 != null;
HeadRotation var9 = var3.getComponent(var2, HeadRotation.getComponentType());
assert var9 != null;
Vector3d var10 = var8.getPosition();
Rotation3f var11 = var9.getRotation();
var3.ensureAndGetComponent(var2, TeleportHistory.getComponentType())
.append(var6, new Vector3d(var10), new Rotation3f(var11), "Warp '" + var1 + "'");
var3.addComponent(var2, Teleport.getComponentType(), var7);
var0.sendMessage(Message.translation("server.commands.teleport.warp.warpedTo").param("name", var1));
} else {
var0.sendMessage(Message.translation("server.commands.teleport.warp.worldNameForWarpNotFound").param("worldName", var5).param("warp", var1));
}
}
}
}
}