PrefabPathEditCommand class
Пакет: com.hypixel.hytale.builtin.path.commands
Файл: com/hypixel/hytale/builtin/path/commands/PrefabPathEditCommand.java
extends: AbstractPlayerCommand
Поля (10)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
return |
|
|
return |
|
WorldPathData |
var10 |
|
IPrefabPath |
var11 |
|
Player |
var6 |
|
UUID |
var7 |
|
|
var7 |
|
|
var7 |
|
Ref |
var8 |
|
PatrolPathMarkerEntity |
var9 |
Методы (3)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var9 == null) |
|
|
if if(var11 == null) |
abstract |
|
super super("edit", "server.commands.npcpath.edit.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.path.commands;
class="kw">import com.hypixel.hytale.builtin.buildertools.BuilderToolsPlugin;
class="kw">import com.hypixel.hytale.builtin.path.WorldPathData;
class="kw">import com.hypixel.hytale.builtin.path.entities.PatrolPathMarkerEntity;
class="kw">import com.hypixel.hytale.builtin.path.path.IPrefabPath;
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.OptionalArg;
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.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 com.hypixel.hytale.server.core.util.TargetUtil;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">public class PrefabPathEditCommand class="kw">extends AbstractPlayerCommand {
@Nonnull
class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_NPC_PATH_EDIT_NO_ENTITY_IN_VIEW = Message.translation("server.commands.npcpath.edit.noEntityInView");
@Nonnull
class="kw">private class="kw">final OptionalArg<UUID> pathIdArg = this.withOptionalArg("pathId", "server.commands.npcpath.edit.pathId.desc", ArgTypes.UUID);
class="kw">public PrefabPathEditCommand() {
super("edit", "server.commands.npcpath.edit.desc");
}
@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;
UUID var7;
if (this.pathIdArg.provided(var1)) {
var7 = this.pathIdArg.get(var1);
} else {
Ref var8 = TargetUtil.getTargetEntity(var3, var2);
if (var8 == null || !var8.isValid()) {
class="kw">return;
}
PatrolPathMarkerEntity var9 = var2.getComponent(var3, PatrolPathMarkerEntity.getComponentType());
if (var9 == null) {
var1.sendMessage(MESSAGE_COMMANDS_NPC_PATH_EDIT_NO_ENTITY_IN_VIEW);
class="kw">return;
}
var7 = var9.getPathId();
}
WorldPathData var10 = var2.getResource(WorldPathData.getResourceType());
IPrefabPath var11 = var10.getPrefabPath(0, var7, false);
if (var11 == null) {
var1.sendMessage(Message.translation("server.npc.npcpath.pathMustBeLoaded").param("path", var7.toString()));
} else {
BuilderToolsPlugin.getState(var6, var4).setActivePrefabPath(var7);
var1.sendMessage(Message.translation("server.npc.npcpath.editingPath").param("path", var7.toString()));
}
}
}