NPCCommandUtils class
Пакет: com.hypixel.hytale.server.npc.commands
Файл: com/hypixel/hytale/server/npc/commands/NPCCommandUtils.java
Поля (7)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Ref |
var3 |
|
|
var3 |
|
|
var3 |
|
Ref |
var4 |
|
UUIDComponent |
var5 |
|
UUID |
var6 |
|
NPCEntity |
var7 |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var3 == null) |
|
|
if if(var7 == null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.commands;
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.types.EntityWrappedArg;
class="kw">import com.hypixel.hytale.server.core.entity.UUIDComponent;
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 com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import it.unimi.dsi.fastutil.Pair;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class NPCCommandUtils {
class="kw">public NPCCommandUtils() {
}
@Nullable
class="kw">public class="kw">static Pair<Ref<EntityStore>, NPCEntity> getTargetNpc(@Nonnull CommandContext var0, @Nonnull EntityWrappedArg var1, @Nonnull Store<EntityStore> var2) {
Ref var3;
if (var1.provided(var0)) {
var3 = var1.get(var2, var0);
} else {
if (!var0.isPlayer()) {
var0.sendMessage(Message.translation("server.commands.errors.playerOrArg").param("option", "entity"));
class="kw">return null;
}
Ref var4 = var0.senderAsPlayerRef();
if (var4 == null || !var4.isValid()) {
var0.sendMessage(Message.translation("server.commands.errors.playerOrArg").param("option", "entity"));
class="kw">return null;
}
var3 = TargetUtil.getTargetEntity(var4, var2);
if (var3 == null) {
var0.sendMessage(Message.translation("server.commands.errors.no_entity_in_view").param("option", "entity"));
class="kw">return null;
}
}
if (var3 != null && var3.isValid()) {
NPCEntity var7 = var2.getComponent(var3, NPCEntity.getComponentType());
if (var7 == null) {
UUIDComponent var5 = var2.getComponent(var3, UUIDComponent.getComponentType());
assert var5 != null;
UUID var6 = var5.getUuid();
var0.sendMessage(Message.translation("server.commands.errors.not_npc").param("uuid", var6.toString()));
class="kw">return null;
} else {
class="kw">return Pair.of(var3, var7);
}
} else {
class="kw">return null;
}
}
}