EntityWrappedArg class

Пакет: com.hypixel.hytale.server.core.command.system.arguments.types

Файл: com/hypixel/hytale/server/core/command/system/arguments/types/EntityWrappedArg.java

extends: WrappedArg<UUID>

Поля (6)

МодификаторыТипИмя
World var3
UUID var3
Ref var4
Ref var4
Ref var5
Ref var6

Методы (6)

МодификаторыВозвратСигнатура
abstract throw new GeneralCommandExceptionthrow new GeneralCommandException(MESSAGE_COMMANDS_ERRORS_PLAYER_NOT_IN_WORLD)
if if(var4 != null)
if if(var5 == null)
if if(var6 == null)
if if(var4 == null)
abstract super super(var1)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.system.arguments.types;

class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
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.Argument;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.WrappedArg;
class="kw">import com.hypixel.hytale.server.core.command.system.exceptions.GeneralCommandException;
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">import javax.annotation.Nullable;

class="kw">public class EntityWrappedArg class="kw">extends WrappedArg<UUID> {
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_ERRORS_PLAYER_NOT_IN_WORLD = Message.translation("server.commands.errors.playerNotInWorld");

   class="kw">public EntityWrappedArg(@Nonnull Argument<?, UUID> var1) {
      super(var1);
   }

   @Nullable
   class="kw">public Ref<EntityStore> get(@Nonnull ComponentAccessor<EntityStore> var1, @Nonnull CommandContext var2) {
      World var3 = var1.getExternalData().getWorld();
      Ref var4 = this.getEntityDirectly(var2, var3);
      if (var4 != null) {
         class="kw">return var4;
      } else {
         Ref var5 = var2.isPlayer() ? var2.senderAsPlayerRef() : null;
         if (var5 == null) {
            throw new GeneralCommandException(Message.translation("server.commands.errors.playerOrArg").param("option", "entity"));
         } else if (!var5.isValid()) {
            throw new GeneralCommandException(MESSAGE_COMMANDS_ERRORS_PLAYER_NOT_IN_WORLD);
         } else {
            Ref var6 = TargetUtil.getTargetEntity(var5, var1);
            if (var6 == null) {
               throw new GeneralCommandException(Message.translation("server.commands.errors.no_entity_in_view").param("option", "entity"));
            } else {
               class="kw">return var6;
            }
         }
      }
   }

   @Nullable
   class="kw">public Ref<EntityStore> getEntityDirectly(@Nonnull CommandContext var1, @Nonnull World var2) {
      if (!this.provided(var1)) {
         class="kw">return null;
      } else {
         UUID var3 = this.get(var1);
         Ref var4 = var2.getEntityStore().getRefFromUUID(var3);
         if (var4 == null) {
            throw new GeneralCommandException(Message.translation("server.commands.errors.targetNotFound").param("uuid", var3.toString()));
         } else {
            class="kw">return var4;
         }
      }
   }
}