PrefabPathMergeCommand class

Пакет: com.hypixel.hytale.builtin.path.commands

Файл: com/hypixel/hytale/builtin/path/commands/PrefabPathMergeCommand.java

extends: AbstractPlayerCommand

Поля (7)

МодификаторыТипИмя
final Message MESSAGE_COMMANDS_NPC_PATH_MERGE_NO_ACTIVE_PATH
IPrefabPath var10
IPrefabPath var11
Player var6
UUID var7
UUID var8
WorldPathData var9

Методы (3)

МодификаторыВозвратСигнатура
abstract throw new GeneralCommandExceptionthrow new GeneralCommandException(MESSAGE_COMMANDS_NPC_PATH_MERGE_NO_ACTIVE_PATH)
if if(var7 == null)
abstract super super("merge", "server.commands.npcpath.merge.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.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.RequiredArg;
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.command.system.exceptions.GeneralCommandException;
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.UUID;
class="kw">import javax.annotation.Nonnull;

class="kw">public class PrefabPathMergeCommand class="kw">extends AbstractPlayerCommand {
   class="kw">public class="kw">static class="kw">final Message MESSAGE_COMMANDS_NPC_PATH_MERGE_NO_ACTIVE_PATH = Message.translation("server.commands.npcpath.merge.noActivePath");
   @Nonnull
   class="kw">private class="kw">final RequiredArg<UUID> targetPathIdArg = this.withRequiredArg("pathName", "server.commands.npcpath.merge.pathName.desc", ArgTypes.UUID);

   class="kw">public PrefabPathMergeCommand() {
      super("merge", "server.commands.npcpath.merge.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 = BuilderToolsPlugin.getState(var6, var4).getActivePrefabPath();
      if (var7 == null) {
         throw new GeneralCommandException(MESSAGE_COMMANDS_NPC_PATH_MERGE_NO_ACTIVE_PATH);
      }

      UUID var8 = this.targetPathIdArg.get(var1);
      WorldPathData var9 = var2.getResource(WorldPathData.getResourceType());
      IPrefabPath var10 = var9.getPrefabPath(0, var7, false);
      if (var10 != null && var10.isFullyLoaded()) {
         IPrefabPath var11 = var9.getPrefabPath(0, var8, false);
         if (var11 != null && var11.isFullyLoaded()) {
            var11.mergeInto(var10, var11.getWorldGenId(), var2);
            var9.removePrefabPath(0, var8);
            var4.sendMessage(
               Message.translation("server.npc.npcpath.pathMergedInto").param("targetPathName", var8.toString()).param("activePathName", var7.toString())
            );
         } else {
            var4.sendMessage(Message.translation("server.npc.npcpath.pathMustBeLoaded").param("path", var8.toString()));
         }
      } else {
         var4.sendMessage(Message.translation("server.npc.npcpath.pathMustBeLoaded").param("path", var7.toString()));
      }
   }
}