package net.knarcraft.minigames.arena.dropper; import net.knarcraft.minigames.MiniGames; import net.knarcraft.minigames.arena.ArenaGroup; import net.knarcraft.minigames.container.SerializableUUID; import net.knarcraft.minigames.util.SerializableConverter; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; /** * A sorted group of arenas that must be completed in sequence */ public class DropperArenaGroup extends ArenaGroup { /** * Instantiates a new dropper arena group * * @param groupName

The name of this group

*/ public DropperArenaGroup(@NotNull String groupName) { super(groupName, MiniGames.getInstance().getDropperArenaHandler()); } /** * Instantiates a new dropper arena group * * @param groupId

The unique id of this group

* @param groupName

The name of this group

* @param arenas

The arenas in this group

*/ private DropperArenaGroup(@NotNull UUID groupId, @NotNull String groupName, @NotNull List arenas) { super(groupId, groupName, arenas, MiniGames.getInstance().getDropperArenaHandler()); } /** * Deserializes the given data * * @param data

The data to deserialize

* @return

The deserialized arena group

*/ @SuppressWarnings({"unused", "unchecked"}) public static @NotNull DropperArenaGroup deserialize(@NotNull Map data) { UUID id = ((SerializableUUID) data.get("groupId")).getRawValue(); String name = (String) data.get("groupName"); List serializableArenas = (List) data.get("arenas"); List arenas = new ArrayList<>(); SerializableConverter.getRawValue(new ArrayList<>(serializableArenas), arenas); return new DropperArenaGroup(id, name, arenas); } }