TriggerVolumeGroupSnapshot class

Пакет: com.hypixel.hytale.builtin.triggervolumes.snapshot

Файл: com/hypixel/hytale/builtin/triggervolumes/snapshot/TriggerVolumeGroupSnapshot.java

implements: SelectionSnapshot<TriggerVolumeGroupSnapshot>

Поля (8)

МодификаторыТипИмя
CREATE, DELETE
yield null
GroupEntry var10
TriggerVolumeGroupSnapshot var11
yield var11
TriggerVolumesPlugin var5
TriggerVolumeManager var6
GroupEntry var7

Методы (7)

МодификаторыВозвратСигнатура
SnapshotType SnapshotType()
for for(String var9 : this.memberVolumeIds)
if if(var6 == null)
if if(var10 == null)
abstract yield ofCreateyield ofCreate(var7)
public TriggerVolumeGroupSnapshot restoreTriggerVolumeGroupSnapshot restore(@Nonnull Ref<EntityStore> var1, PlayerRef var2, World var3, ComponentAccessor<EntityStore> var4)
return switchreturn switch(this.type)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.triggervolumes.snapshot;

class="kw">import com.hypixel.hytale.builtin.buildertools.snapshot.SelectionSnapshot;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.EntityTargetType;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.TriggerVolumesPlugin;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.effect.TriggerCondition;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.effect.TriggerEffect;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.ConditionTiming;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.GroupEntry;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.RejectionDelayMode;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.TriggerVolumeManager;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
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.EnumSet;
class="kw">import java.util.List;
class="kw">import java.util.Map;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;

class="kw">public class TriggerVolumeGroupSnapshot class="kw">implements SelectionSnapshot<TriggerVolumeGroupSnapshot> {
   @Nonnull
   class="kw">private class="kw">final TriggerVolumeGroupSnapshot.SnapshotType type;
   @Nonnull
   class="kw">private class="kw">final String groupId;
   @Nonnull
   class="kw">private class="kw">final String worldName;
   @Nonnull
   class="kw">private class="kw">final Vector3d origin;
   @Nonnull
   class="kw">private class="kw">final List<TriggerCondition> conditions;
   @Nonnull
   class="kw">private class="kw">final List<TriggerEffect> effects;
   @Nonnull
   class="kw">private class="kw">final List<TriggerEffect> rejectionEffects;
   @Nonnull
   class="kw">private class="kw">final ConditionTiming conditionTiming;
   @Nonnull
   class="kw">private class="kw">final RejectionDelayMode rejectionDelayMode;
   @Nonnull
   class="kw">private class="kw">final Set<EntityTargetType> targetTypes;
   class="kw">private class="kw">final boolean enabled;
   class="kw">private class="kw">final boolean rotateEffectsOnPaste;
   class="kw">private class="kw">final int color;
   @Nonnull
   class="kw">private class="kw">final Map<String, String> rawTags;
   @Nonnull
   class="kw">private class="kw">final List<String> memberVolumeIds;

   class="kw">private TriggerVolumeGroupSnapshot(@Nonnull TriggerVolumeGroupSnapshot.SnapshotType var1, @Nonnull GroupEntry var2) {
      this.type = var1;
      this.groupId = var2.getId();
      this.worldName = var2.getWorldName();
      this.origin = new Vector3d(var2.getOrigin());
      this.conditions = TriggerCondition.deepCopyList(var2.getConditions());
      this.effects = TriggerEffect.deepCopyList(var2.getEffects());
      this.rejectionEffects = TriggerEffect.deepCopyList(var2.getRejectionEffects());
      this.conditionTiming = var2.getConditionTiming();
      this.rejectionDelayMode = var2.getRejectionDelayMode();
      this.targetTypes = EnumSet.copyOf(var2.getTargetTypes());
      this.enabled = var2.isEnabled();
      this.rotateEffectsOnPaste = var2.isRotateEffectsOnPaste();
      this.color = var2.getColor();
      this.rawTags = var2.getRawTags();
      this.memberVolumeIds = List.copyOf(var2.getMemberVolumeIds());
   }

   @Nonnull
   class="kw">public class="kw">static TriggerVolumeGroupSnapshot ofCreate(@Nonnull GroupEntry var0) {
      class="kw">return new TriggerVolumeGroupSnapshot(TriggerVolumeGroupSnapshot.SnapshotType.CREATE, var0);
   }

   @Nonnull
   class="kw">public class="kw">static TriggerVolumeGroupSnapshot ofDelete(@Nonnull GroupEntry var0) {
      class="kw">return new TriggerVolumeGroupSnapshot(TriggerVolumeGroupSnapshot.SnapshotType.DELETE, var0);
   }

   class="kw">public TriggerVolumeGroupSnapshot restore(@Nonnull Ref<EntityStore> var1, PlayerRef var2, World var3, ComponentAccessor<EntityStore> var4) {
      TriggerVolumesPlugin var5 = TriggerVolumesPlugin.get();
      TriggerVolumeManager var6 = var3.getEntityStore().getStore().getResource(var5.getManagerResourceType());
      if (var6 == null) {
         class="kw">return null;
      }

      class="kw">return class="kw">switch (this.type) {
         case CREATE -> {
            GroupEntry var10 = var6.getGroup(this.groupId);
            if (var10 == null) {
               yield null;
            } else {
               TriggerVolumeGroupSnapshot var11 = ofDelete(var10);
               var6.unregisterGroup(this.groupId);
               var6.notifyViewers();
               yield var11;
            }
         }
         case DELETE -> {
            GroupEntry var7 = new GroupEntry(
               this.groupId,
               this.worldName,
               new Vector3d(this.origin),
               TriggerEffect.deepCopyList(this.effects),
               EnumSet.copyOf(this.targetTypes),
               this.enabled,
               this.color
            );
            var7.getConditions().addAll(TriggerCondition.deepCopyList(this.conditions));
            var7.getRejectionEffects().addAll(TriggerEffect.deepCopyList(this.rejectionEffects));
            var7.setConditionTiming(this.conditionTiming);
            var7.setRejectionDelayMode(this.rejectionDelayMode);
            var7.setRotateEffectsOnPaste(this.rotateEffectsOnPaste);
            var7.setTags(this.rawTags);

            for (String var9 : this.memberVolumeIds) {
               var7.addMember(var9);
            }

            var6.registerGroup(this.groupId, var7);
            var6.notifyViewers();
            yield ofCreate(var7);
         }
      };
   }

   class="kw">private enum SnapshotType {
      CREATE,
      DELETE;

      SnapshotType() {
      }
   }
}