diff --git a/src/main/java/com/minecrafttas/tasmod/events/EventPlaybackClient.java b/src/main/java/com/minecrafttas/tasmod/events/EventPlaybackClient.java
index 45013823..bc476933 100644
--- a/src/main/java/com/minecrafttas/tasmod/events/EventPlaybackClient.java
+++ b/src/main/java/com/minecrafttas/tasmod/events/EventPlaybackClient.java
@@ -82,6 +82,6 @@ public interface EventRecordClear extends EventBase {
/**
* Fired when a recording is cleared
*/
- public void onClear();
+ public void onRecordingClear();
}
}
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommand.java b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommand.java
index 6d081494..510473e7 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommand.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommand.java
@@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
import com.dselent.bigarraylist.BigArrayList;
@@ -13,6 +12,7 @@
import com.minecrafttas.mctcommon.registry.Registerable;
import com.minecrafttas.tasmod.TASmodClient;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
+import com.minecrafttas.tasmod.playback.tasfile.flavor.SerialiserFlavorBase;
public class PlaybackFileCommand {
@@ -54,10 +54,32 @@ public String toString() {
return String.format("$%s(%s);", name, String.join(", ", args));
}
+ /**
+ *
Abstract class for a FileCommandExtension.
+ *
Allows for creating custom FileCommands that can be stored within the TASfile
+ * to trigger custom behaviour when a playback is reaching that point
+
+ * @author Scribble
+ */
public static abstract class PlaybackFileCommandExtension implements Registerable {
-
+ /**
+ * The temporary directory of the {@link #fileCommandStorage}
+ */
protected final Path tempDir;
+ /**
+ * The list where all filecommands for this extension are stored
+ */
+ protected BigArrayList inlineFileCommandStorage;
+
+ /**
+ * The list where all filecommands for this extension are stored
+ */
+ protected BigArrayList endlineFileCommandStorage;
+
+ /**
+ * Creates a new extension with the default {@link #tempDir}
+ */
public PlaybackFileCommandExtension() {
this((Path) null);
}
@@ -75,6 +97,8 @@ public PlaybackFileCommandExtension(String tempFolderName) {
public PlaybackFileCommandExtension(Path tempDirectory) {
if (tempDirectory == null) {
tempDir = null;
+ inlineFileCommandStorage = new BigArrayList<>();
+ endlineFileCommandStorage = new BigArrayList<>();
return;
}
@@ -84,6 +108,8 @@ public PlaybackFileCommandExtension(Path tempDirectory) {
} catch (IOException e) {
e.printStackTrace();
}
+ inlineFileCommandStorage = new BigArrayList<>(tempDir.toString());
+ endlineFileCommandStorage = new BigArrayList<>(tempDir.toString());
}
protected boolean enabled = false;
@@ -97,6 +123,14 @@ public void onDisable() {
};
public void onClear() {
+ try {
+ inlineFileCommandStorage.clearMemory();
+ endlineFileCommandStorage.clearMemory();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ inlineFileCommandStorage = new BigArrayList<>();
+ endlineFileCommandStorage = new BigArrayList<>();
};
public void onRecord(long tick, InputContainer inputContainer) {
@@ -105,18 +139,50 @@ public void onRecord(long tick, InputContainer inputContainer) {
public void onPlayback(long tick, InputContainer inputContainer) {
};
- public PlaybackFileCommandContainer onSerialiseInlineComment(long tick, InputContainer inputContainer) {
- return null;
+ public SortedFileCommandContainer onSerialiseInlineComment(long tick, InputContainer inputContainer) {
+ SortedFileCommandContainer out = new SortedFileCommandContainer();
+ if (tick >= inlineFileCommandStorage.size())
+ return out;
+
+ SortedFileCommandContainer currentTick = inlineFileCommandStorage.get(tick);
+ if (currentTick == null)
+ return out;
+
+ for (String name : getFileCommandNames()) {
+ if (currentTick.get(name) != null)
+ out.putAll(currentTick.split(name));
+ }
+ return out;
}
- public PlaybackFileCommandContainer onSerialiseEndlineComment(long currentTick, InputContainer inputContainer) {
- return null;
+ public SortedFileCommandContainer onSerialiseEndlineComment(long tick, InputContainer inputContainer) {
+ SortedFileCommandContainer out = new SortedFileCommandContainer();
+ if (tick >= endlineFileCommandStorage.size())
+ return out;
+
+ SortedFileCommandContainer currentTick = endlineFileCommandStorage.get(tick);
+ if (currentTick == null)
+ return out;
+
+ for (String name : getFileCommandNames()) {
+ if (currentTick.get(name) != null)
+ out.putAll(currentTick.split(name));
+ }
+ return out;
}
- public void onDeserialiseInlineComment(long tick, InputContainer container, PlaybackFileCommandContainer fileCommandContainer) {
+ public void onDeserialiseInlineComment(long tick, InputContainer container, SortedFileCommandContainer fileCommandContainer) {
+ if (fileCommandContainer == null)
+ return;
+
+ inlineFileCommandStorage.add(fileCommandContainer);
}
- public void onDeserialiseEndlineComment(long tick, InputContainer container, PlaybackFileCommandContainer fileCommandContainer) {
+ public void onDeserialiseEndlineComment(long tick, InputContainer container, SortedFileCommandContainer fileCommandContainer) {
+ if (fileCommandContainer == null)
+ return;
+
+ endlineFileCommandStorage.add(fileCommandContainer);
}
public boolean isEnabled() {
@@ -137,43 +203,176 @@ public String toString() {
}
}
- public static class PlaybackFileCommandContainer extends LinkedHashMap {
+ /**
+ * List of FileCommands in one comment.
+ *
This class is the same as ArrayList<PlaybackFileCommand>
+ *
In a comment, you can have multiple file commands, hence a list is needed to store them all.
+ *
Example
+ *
+ * // $desyncMonitor(13, 0, 1, 1, 1, 1); $hud(true);
+ *
+ * This would translate into an ArrayList like
+ *
+ * [$desyncMonitor(13, 0, 1, 1, 1, 1);, $hud(true);]
+ *
+ *
+ * Used in {@link UnsortedFileCommandContainer} for serialisation and deserialisation
+ *
Although this class is the same as {@link FileCommandsInTickList}, their use case differs slightly,
+ * hence I created 2 classes for the sake of clarity.
+ *
+ * @author Scribble
+ */
+ public static class FileCommandsInCommentList extends ArrayList {
+ }
- public PlaybackFileCommandContainer() {
- }
+ /**
+ * An ArrayList for storing {@link FileCommandsInCommentList} sorted by order of appearence in the {@link InputContainer}
+ *
This stands in contrast to the {@link SortedFileCommandContainer}, which can be obtained by calling {@link UnsortedFileCommandContainer#sort() sort()}
+ *
This is technically a 2 dimensional List for storing file commands for multiple comments, where {@link FileCommandsInCommentList} is one row of file commands
+ *
Used in {@link SerialiserFlavorBase} as this format makes it easier to deal with serialisation and deserialisation
+ *
Example
+ *
+ * // $desyncMonitor(13, 0, 1, 1, 1, 1); $hud(true);
+ * // $desyncMonitor(16, 3, 1, 1, 1, 1); $hud(false);
+ * // $label(Test); $hud(false);
+ *
+ * This would translate into an ArrayList like
+ *
+ * [
+ * [$desyncMonitor(13, 0, 1, 1, 1, 1);, $hud(true);] <- One {@link FileCommandsInCommentList}
+ * [$desyncMonitor(16, 3, 1, 1, 1, 1);, $hud(false);]
+ * [$label(Test);, $hud(false);]
+ * ]
+ *
+ * @author Scribble
+ * @see SortedFileCommandContainer
+ */
+ public static class UnsortedFileCommandContainer extends ArrayList {
- public PlaybackFileCommandContainer(List> list) {
- for (List lists : list) {
- if (lists != null) {
- for (PlaybackFileCommand command : lists) {
- this.put(command.getName(), new PlaybackFileCommandLine());
+ /**
+ * Sorts this array list by the file command names
+ * @return A {@link SortedFileCommandContainer}
+ */
+ public SortedFileCommandContainer sort() {
+ SortedFileCommandContainer out = new SortedFileCommandContainer();
+
+ /*
+ * Fill the HashMap in SortedFileCommandContainer with empty FileCommandsInCommentList
+ * for each different FileCommand name found in this UnsortedFileCommandContainer.
+ */
+ for (FileCommandsInCommentList unsortedFileCommandsList : this) {
+ if (unsortedFileCommandsList != null) {
+ for (PlaybackFileCommand command : unsortedFileCommandsList) {
+ out.put(command.getName(), new FileCommandsInTickList());
}
}
}
- for (List lists : list) {
- for (Map.Entry entry : this.entrySet()) {
- String key = entry.getKey();
- List val = entry.getValue();
+ /**
+ * Add the FileCommands to the previously created FileCommandsInCommentLists
+ */
+ for (FileCommandsInCommentList unsortedFileCommandsList : this) {
+ /*
+ * If the file command is not present in the comment, we have to add
+ * null to the sortedFileCommandsList.
+ *
+ * To do that, we iterate through all entries in the HashMap
+ */
+ for (Map.Entry entry : out.entrySet()) {
+
+ String sortedKey = entry.getKey();
+ FileCommandsInTickList sortedFileCommandsList = entry.getValue();
boolean valuePresent = false;
- if (lists != null) {
- for (PlaybackFileCommand command : lists) {
- if (key.equals(command.getName())) {
+ if (unsortedFileCommandsList != null) {
+ /**
+ * Iterates through all filecommands in a comment
+ * and adds it to the sorted list if found
+ */
+ for (PlaybackFileCommand command : unsortedFileCommandsList) {
+ if (sortedKey.equals(command.getName())) {
valuePresent = true;
- val.add(command);
+ sortedFileCommandsList.add(command);
}
}
}
+ /**
+ * If the value is not found,
+ * add null to indicate that the
+ * file command is missing from this comment
+ */
if (!valuePresent) {
- val.add(null);
+ sortedFileCommandsList.add(null);
}
}
}
+ return out;
}
+ }
+
+ /**
+ * List of FileCommands in one tick.
+ *
This class is the same as ArrayList<PlaybackFileCommand>
+ *
In a tick, you can have multiple file commands for each subtick, hence a list is needed to store them all.
+ *
Used in {@link PlaybackFileCommandExtension PlaybackFileCommandExtensions} as this format makes it easier to deal with processing FileCommands during playback or recording
+ *
Example
+ *
+ * // $desyncMonitor(13, 0, 1, 1, 1, 1);
+ * // $desyncMonitor(13, 0, 1, 2, 1, 1);
+ * // $desyncMonitor(13, 0, 1, 10, 1, 1);
+ *
+ * This would translate into an ArrayList like
+ *
+ * [$desyncMonitor(13, 0, 1, 1, 1, 1);, $desyncMonitor(13, 0, 1, 2, 1, 1);, $desyncMonitor(13, 0, 1, 10, 1, 1);]
+ *
+ *
+ * Used in {@link SortedFileCommandContainer} for processing file commands, either playing back or recording
+ *
Although this class is the same as {@link FileCommandsInCommentList}, their use case differs slightly,
+ * hence I created 2 classes for the sake of clarity.
+ *
+ * @author Scribble
+ */
+ public static class FileCommandsInTickList extends ArrayList {
+ }
+ /**
+ * A LinkedHashMap for storing {@link FileCommandsInCommentList} sorted by the name of the FileCommand name.
+ *
The key represents the FileCommand name, while the elements are the {@link FileCommandsInTickList}
+ *
This stands in contrast to the {@link UnsortedFileCommandContainer}, which can be obtained by calling {@link SortedFileCommandContainer#unsort() unsort()}
+ *
Example
+ *
+ * // $desyncMonitor(13, 0, 1, 1, 1, 1); $hud(true);
+ * // $desyncMonitor(16, 3, 1, 1, 1, 1); $hud(false);
+ * // $label(Test); $hud(false);
+ *
+ * This would translate into a LinkedHashMap like
+ *
+ * {
+ * "desyncMonitor":
+ * [$desyncMonitor(13, 0, 1, 1, 1, 1);, $desyncMonitor(16, 3, 1, 1, 1, 1);, null],
+ *
+ * "hud":
+ * [$hud(true);, $hud(false), $hud(false)], <- One {@link FileCommandsInTickList}
+ *
+ * "label":
+ * [null, null, $label(Test)]
+ * }
+ * While null being the subticks that have no file commands of that type
+ *
+ *
Additionally, these entries can be {@link SortedFileCommandContainer#split(Iterable) split} into multiple containers.
+ *
+ * @author Scribble
+ */
+ public static class SortedFileCommandContainer extends LinkedHashMap {
+
+ /**
+ * Adds a new {@link PlaybackFileCommand} to the specified key.
+ *
Creates a new {@link FileCommandsInTickList} if it's not already present
+ * @param key The key for the list to add
+ * @param fileCommand The {@link PlaybackFileCommand} to add to the list
+ */
public void add(String key, PlaybackFileCommand fileCommand) {
- PlaybackFileCommandLine toAdd = getOrDefault(key, new PlaybackFileCommandLine());
+ FileCommandsInTickList toAdd = getOrDefault(key, new FileCommandsInTickList());
if (toAdd.isEmpty()) {
put(key, toAdd);
}
@@ -181,39 +380,54 @@ public void add(String key, PlaybackFileCommand fileCommand) {
toAdd.add(fileCommand);
}
- public PlaybackFileCommandContainer split(String... keys) {
+ /**
+ *
Creates a new {@link SortedFileCommandContainer} with only the keys present
+ * @param keys The keys to split into
+ * @return A new {@link SortedFileCommandContainer} with only the keys present
+ */
+ public SortedFileCommandContainer split(String... keys) {
return split(Arrays.asList(keys));
}
- public PlaybackFileCommandContainer split(Iterable keys) {
- PlaybackFileCommandContainer out = new PlaybackFileCommandContainer();
+ /**
+ * Creates a new {@link SortedFileCommandContainer} with only the keys present
+ * @param keys The keys to split into
+ * @return A new {@link SortedFileCommandContainer} with only the keys present
+ */
+ public SortedFileCommandContainer split(Iterable keys) {
+ SortedFileCommandContainer out = new SortedFileCommandContainer();
for (String key : keys) {
- out.put(key, this.get(key));
+ if (this.containsKey(key))
+ out.put(key, this.get(key));
}
return out;
}
- public List> valuesBySubtick() {
- List> out = new ArrayList<>();
+ /**
+ * Sorts this HashMap by order of appeareance and merges filecommands into one line
+ * @return An {@link UnsortedFileCommandContainer}
+ */
+ public UnsortedFileCommandContainer unsort() {
+ UnsortedFileCommandContainer out = new UnsortedFileCommandContainer();
int biggestSize = 0;
- for (PlaybackFileCommandLine list : values()) {
+ for (FileCommandsInTickList list : values()) {
if (list.size() > biggestSize) {
biggestSize = list.size();
}
}
for (int i = 0; i < biggestSize; i++) {
- List commandListForOneLine = new ArrayList<>();
- for (PlaybackFileCommandLine list : values()) {
+ FileCommandsInCommentList unsortedFileCommandsList = new FileCommandsInCommentList();
+ for (FileCommandsInTickList list : values()) {
if (i < list.size()) {
- PlaybackFileCommand fc = list.get(i);
- commandListForOneLine.add(fc);
+ PlaybackFileCommand fileCommand = list.get(i);
+ unsortedFileCommandsList.add(fileCommand);
} else {
- commandListForOneLine.add(null);
+ unsortedFileCommandsList.add(null);
}
}
- out.add(commandListForOneLine);
+ out.add(unsortedFileCommandsList);
}
return out;
@@ -221,11 +435,13 @@ public List> valuesBySubtick() {
@Override
public boolean equals(Object o) {
- if (o instanceof PlaybackFileCommandContainer) {
- PlaybackFileCommandContainer other = (PlaybackFileCommandContainer) o;
- for (java.util.Map.Entry entry : other.entrySet()) {
+ if (o instanceof SortedFileCommandContainer) {
+ SortedFileCommandContainer other = (SortedFileCommandContainer) o;
+ if (this.size() != other.size())
+ return false;
+ for (java.util.Map.Entry entry : other.entrySet()) {
String key = entry.getKey();
- PlaybackFileCommandLine val = entry.getValue();
+ FileCommandsInTickList val = entry.getValue();
if (!this.containsKey(key) && !this.get(key).equals(val))
return false;
@@ -235,8 +451,4 @@ public boolean equals(Object o) {
return super.equals(o);
}
}
-
- public static class PlaybackFileCommandLine extends ArrayList {
-
- }
}
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommandsRegistry.java b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommandsRegistry.java
index 42737cf6..5432f25d 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommandsRegistry.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/PlaybackFileCommandsRegistry.java
@@ -9,8 +9,9 @@
import com.minecrafttas.mctcommon.registry.AbstractRegistry;
import com.minecrafttas.tasmod.events.EventPlaybackClient;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.SortedFileCommandContainer;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.UnsortedFileCommandContainer;
import com.minecrafttas.tasmod.registries.TASmodConfig;
public class PlaybackFileCommandsRegistry extends AbstractRegistry implements EventPlaybackClient.EventRecordTick, EventPlaybackClient.EventPlaybackTick, EventPlaybackClient.EventRecordClear {
@@ -110,48 +111,52 @@ public void onPlaybackTick(long index, InputContainer container) {
});
}
- public PlaybackFileCommandContainer handleOnSerialiseInline(long currentTick, InputContainer container) {
- PlaybackFileCommandContainer out = new PlaybackFileCommandContainer();
+ public UnsortedFileCommandContainer handleOnSerialiseInline(long currentTick, InputContainer container) {
+ SortedFileCommandContainer out = new SortedFileCommandContainer();
for (PlaybackFileCommandExtension extension : enabledExtensions) {
- PlaybackFileCommandContainer extensionContainer = extension.onSerialiseInlineComment(currentTick, container);
+ SortedFileCommandContainer extensionContainer = extension.onSerialiseInlineComment(currentTick, container);
if (extensionContainer != null) {
out.putAll(extensionContainer);
}
}
- return out;
+ return out.unsort();
}
- public PlaybackFileCommandContainer handleOnSerialiseEndline(long currentTick, InputContainer container) {
- PlaybackFileCommandContainer out = new PlaybackFileCommandContainer();
+ public UnsortedFileCommandContainer handleOnSerialiseEndline(long currentTick, InputContainer container) {
+ SortedFileCommandContainer out = new SortedFileCommandContainer();
for (PlaybackFileCommandExtension extension : enabledExtensions) {
- PlaybackFileCommandContainer extensionContainer = extension.onSerialiseEndlineComment(currentTick, container);
+ SortedFileCommandContainer extensionContainer = extension.onSerialiseEndlineComment(currentTick, container);
if (extensionContainer != null) {
out.putAll(extensionContainer);
}
}
- return out;
+ return out.unsort();
}
- public void handleOnDeserialiseInline(long currentTick, InputContainer deserialisedContainer, List> inlineFileCommands) {
- PlaybackFileCommandContainer fileCommandContainer = new PlaybackFileCommandContainer(inlineFileCommands);
+ public void handleOnDeserialiseInline(long currentTick, InputContainer deserialisedContainer, UnsortedFileCommandContainer unsortedInlineFileCommands) {
+ SortedFileCommandContainer fileCommandContainer = unsortedInlineFileCommands.sort();
for (PlaybackFileCommandExtension extension : enabledExtensions) {
String[] fileCommandNames = extension.getFileCommandNames();
extension.onDeserialiseInlineComment(currentTick, deserialisedContainer, fileCommandContainer.split(fileCommandNames));
}
}
- public void handleOnDeserialiseEndline(long currentTick, InputContainer deserialisedContainer, List> endlineFileCommands) {
- PlaybackFileCommandContainer fileCommandContainer = new PlaybackFileCommandContainer(endlineFileCommands);
+ public void handleOnDeserialiseEndline(long currentTick, InputContainer deserialisedContainer, UnsortedFileCommandContainer unsortedEndlineFileCommands) {
+ SortedFileCommandContainer sortedEndlineFileCommands = unsortedEndlineFileCommands.sort();
for (PlaybackFileCommandExtension extension : enabledExtensions) {
String[] fileCommandNames = extension.getFileCommandNames();
- extension.onDeserialiseEndlineComment(currentTick, deserialisedContainer, fileCommandContainer.split(fileCommandNames));
+ extension.onDeserialiseEndlineComment(currentTick, deserialisedContainer, sortedEndlineFileCommands.split(fileCommandNames));
}
}
@Override
+ public void onRecordingClear() {
+ onClear();
+ }
+
public void onClear() {
- REGISTRY.values().forEach(fc -> {
- fc.onClear();
+ REGISTRY.values().forEach(fileCommandExtension -> {
+ fileCommandExtension.onClear();
});
}
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/DesyncMonitorFileCommandExtension.java b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/DesyncMonitorFileCommandExtension.java
index f637fd63..13d42617 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/DesyncMonitorFileCommandExtension.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/DesyncMonitorFileCommandExtension.java
@@ -11,11 +11,11 @@
import com.dselent.bigarraylist.BigArrayList;
import com.minecrafttas.tasmod.TASmodClient;
import com.minecrafttas.tasmod.events.EventPlaybackClient;
-import com.minecrafttas.tasmod.playback.PlaybackControllerClient.TASstate;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
+import com.minecrafttas.tasmod.playback.PlaybackControllerClient.TASstate;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.SortedFileCommandContainer;
import com.minecrafttas.tasmod.playback.tasfile.exception.PlaybackLoadException;
import net.minecraft.client.Minecraft;
@@ -97,8 +97,8 @@ public void onDisable() {
}
@Override
- public PlaybackFileCommandContainer onSerialiseEndlineComment(long currentTick, InputContainer inputContainer) {
- PlaybackFileCommandContainer out = new PlaybackFileCommandContainer();
+ public SortedFileCommandContainer onSerialiseEndlineComment(long currentTick, InputContainer inputContainer) {
+ SortedFileCommandContainer out = new SortedFileCommandContainer();
MonitorContainer monitoredValues = monitorContainer.get(currentTick);
PlaybackFileCommand command = new PlaybackFileCommand("desyncMonitor", monitoredValues.toStringArray());
@@ -108,7 +108,7 @@ public PlaybackFileCommandContainer onSerialiseEndlineComment(long currentTick,
}
@Override
- public void onDeserialiseEndlineComment(long tick, InputContainer container, PlaybackFileCommandContainer fileCommandContainer) {
+ public void onDeserialiseEndlineComment(long tick, InputContainer container, SortedFileCommandContainer fileCommandContainer) {
List commandsEndline = fileCommandContainer.get("desyncMonitor");
if (commandsEndline == null || commandsEndline.isEmpty()) {
recordNull(tick);
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/LabelFileCommandExtension.java b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/LabelFileCommandExtension.java
index 8ebfe785..3bfb3a8c 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/LabelFileCommandExtension.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/LabelFileCommandExtension.java
@@ -1,34 +1,28 @@
package com.minecrafttas.tasmod.playback.filecommands.builtin;
-import java.io.IOException;
import java.nio.file.Path;
-import com.dselent.bigarraylist.BigArrayList;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandContainer;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.FileCommandsInTickList;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandLine;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.SortedFileCommandContainer;
public class LabelFileCommandExtension extends PlaybackFileCommandExtension {
private String labelText = "";
- BigArrayList label = new BigArrayList<>();
-
public LabelFileCommandExtension() {
this("label");
}
public LabelFileCommandExtension(String tempDirName) {
super(tempDirName);
- this.label = new BigArrayList<>(tempDir.toString());
enabled = true;
}
public LabelFileCommandExtension(Path tempDir) {
super(tempDir);
- this.label = new BigArrayList<>(tempDir.toString());
enabled = true;
}
@@ -42,51 +36,31 @@ public String[] getFileCommandNames() {
return new String[] { "label" };
}
- @Override
- public PlaybackFileCommandContainer onSerialiseInlineComment(long tick, InputContainer inputContainer) {
- PlaybackFileCommandContainer fileCommandContainer = new PlaybackFileCommandContainer();
- if (label.size() != 0 && label.get(tick).get("label") != null) {
- fileCommandContainer = label.get(tick);
- }
- return fileCommandContainer;
- }
-
- @Override
- public void onDeserialiseInlineComment(long tick, InputContainer container, PlaybackFileCommandContainer fileCommandContainer) {
- if (fileCommandContainer.containsKey("label")) {
- label.add(fileCommandContainer.split("label"));
- }
- }
-
@Override
public void onPlayback(long tick, InputContainer inputContainer) {
- if (label.size() <= tick) {
+ if (inlineFileCommandStorage.size() <= tick) {
return;
}
- PlaybackFileCommandContainer containerInTick = label.get(tick);
+ SortedFileCommandContainer containerInTick = inlineFileCommandStorage.get(tick);
if (containerInTick == null) {
return;
}
- PlaybackFileCommandLine line = containerInTick.get("label");
+ FileCommandsInTickList line = containerInTick.get("label");
if (line == null) {
return;
}
for (PlaybackFileCommand command : line) {
+ if (command == null)
+ continue;
labelText = String.join(", ", command.getArgs());
}
}
@Override
public void onClear() {
- try {
- label.clearMemory();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- label = new BigArrayList<>();
+ super.onClear();
labelText = "";
}
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/OptionsFileCommandExtension.java b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/OptionsFileCommandExtension.java
index c44a7e5f..197ee7c6 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/OptionsFileCommandExtension.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/filecommands/builtin/OptionsFileCommandExtension.java
@@ -1,36 +1,30 @@
package com.minecrafttas.tasmod.playback.filecommands.builtin;
-import java.io.IOException;
import java.nio.file.Path;
-import com.dselent.bigarraylist.BigArrayList;
import com.minecrafttas.tasmod.TASmod;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandContainer;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.FileCommandsInTickList;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandLine;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.SortedFileCommandContainer;
import com.minecrafttas.tasmod.util.LoggerMarkers;
public class OptionsFileCommandExtension extends PlaybackFileCommandExtension {
private boolean shouldRenderHud = true;
- BigArrayList hud;
-
public OptionsFileCommandExtension() {
this("hud");
}
public OptionsFileCommandExtension(String tempDirName) {
super(tempDirName);
- hud = new BigArrayList<>(tempDir.toString());
enabled = true;
}
public OptionsFileCommandExtension(Path tempDir) {
super(tempDir);
- this.hud = new BigArrayList<>(tempDir.toString());
enabled = true;
}
@@ -44,38 +38,24 @@ public String[] getFileCommandNames() {
return new String[] { "hud" };
}
- @Override
- public PlaybackFileCommandContainer onSerialiseInlineComment(long tick, InputContainer inputContainer) {
- PlaybackFileCommandContainer fileCommandContainer = new PlaybackFileCommandContainer();
- if (hud.size() != 0 && hud.get(tick).get("hud") != null) {
- fileCommandContainer = hud.get(tick);
- }
- return fileCommandContainer;
- }
-
- @Override
- public void onDeserialiseInlineComment(long tick, InputContainer container, PlaybackFileCommandContainer fileCommandContainer) {
- if (fileCommandContainer.containsKey("hud")) {
- hud.add(fileCommandContainer.split("hud"));
- }
- }
-
@Override
public void onPlayback(long tick, InputContainer inputContainer) {
- if (hud.size() <= tick) {
+ if (inlineFileCommandStorage.size() <= tick) {
return;
}
- PlaybackFileCommandContainer containerInTick = hud.get(tick);
+ SortedFileCommandContainer containerInTick = inlineFileCommandStorage.get(tick);
if (containerInTick == null) {
return;
}
- PlaybackFileCommandLine line = containerInTick.get("hud");
+ FileCommandsInTickList line = containerInTick.get("hud");
if (line == null) {
return;
}
for (PlaybackFileCommand command : line) {
+ if (command == null)
+ continue;
String[] args = command.getArgs();
if (args.length == 1) {
/*
@@ -102,21 +82,9 @@ public void onPlayback(long tick, InputContainer inputContainer) {
}
}
- @Override
- public void onRecord(long tick, InputContainer inputContainer) {
- // TODO Auto-generated method stub
- super.onRecord(tick, inputContainer);
- }
-
@Override
public void onClear() {
- try {
- hud.clearMemory();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- hud = new BigArrayList<>();
+ super.onClear();
shouldRenderHud = true;
}
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/metadata/PlaybackMetadataRegistry.java b/src/main/java/com/minecrafttas/tasmod/playback/metadata/PlaybackMetadataRegistry.java
index 658638f4..f57d2953 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/metadata/PlaybackMetadataRegistry.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/metadata/PlaybackMetadataRegistry.java
@@ -52,7 +52,7 @@ public void handleOnLoad(List meta) {
}
@Override
- public void onClear() {
+ public void onRecordingClear() {
REGISTRY.forEach((key, extension) ->{
extension.onClear();
});
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/SerialiserFlavorBase.java b/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/SerialiserFlavorBase.java
index 078c0729..ec182f8e 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/SerialiserFlavorBase.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/SerialiserFlavorBase.java
@@ -21,8 +21,9 @@
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.CommentContainer;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandContainer;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.FileCommandsInCommentList;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.UnsortedFileCommandContainer;
import com.minecrafttas.tasmod.playback.metadata.PlaybackMetadata;
import com.minecrafttas.tasmod.playback.tasfile.PlaybackSerialiser;
import com.minecrafttas.tasmod.playback.tasfile.exception.PlaybackLoadException;
@@ -42,7 +43,7 @@
* Adding functionality to playback should be made via {@link PlaybackFileCommand PlaybackFileCommands}
* instead of creating a new syntax and adding new information to the header should be made via {@link PlaybackMetadata}
*
- *
Sections
+ * Sections
* The TASfile has 2 main sections, which are called seperately by the {@link PlaybackSerialiser}:
*
*
@@ -158,7 +159,7 @@ protected String headerEnd() {
* serialiseHeader
* ├── {@link #headerStart()}
* ├── {@link #serialiseFlavorName(List)}
- * ├── {@link #serialiseFileCommandNames(List)}
+ * ├── {@link #serialiseEnabledFileCommandNames(List)}
* ├── {@link #serialiseMetadata(List)}
* │ ├── {@link #serialiseMetadataName(List, String)}
* │ └── {@link #serialiseMetadataValues(List, LinkedHashMap)}
@@ -168,7 +169,7 @@ protected String headerEnd() {
*
* ##################### TASfile #################### // {@link #headerStart()}
* Flavor: beta1 // {@link #serialiseFlavorName(List)}
- * FileCommand-Extensions: tasmod_desyncMonitor@v1, tasmod_options@v1, tasmod_label@v1 // {@link #serialiseFileCommandNames(List)}
+ * FileCommand-Extensions: tasmod_desyncMonitor@v1, tasmod_options@v1, tasmod_label@v1 // {@link #serialiseEnabledFileCommandNames(List)}
*
* --------------------- Credits -------------------- // {@link #serialiseMetadataName(List, String)}
* Title:Insert TAS category here // {@link #serialiseMetadataValues(List, LinkedHashMap)}
@@ -191,7 +192,7 @@ public List serialiseHeader() {
List out = new ArrayList<>();
out.add(headerStart());
serialiseFlavorName(out);
- serialiseFileCommandNames(out);
+ serialiseEnabledFileCommandNames(out);
serialiseMetadata(out);
out.add(headerEnd());
return out;
@@ -220,7 +221,7 @@ protected void serialiseFlavorName(List out) {
*
* @param out The serialised lines, passed by reference
*/
- protected void serialiseFileCommandNames(List out) {
+ protected void serialiseEnabledFileCommandNames(List out) {
List stringlist = new ArrayList<>();
List extensionList = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.getEnabled();
if (processExtensions) {
@@ -313,13 +314,13 @@ protected void serialiseMetadataValues(List out, LinkedHashMap out, InputContainer conta
List serialisedCameraAngle = serialiseCameraAngle(container.getCameraAngle());
pruneListEndEmpty(serialisedCameraAngle);
- PlaybackFileCommandContainer fileCommandsInline = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnSerialiseInline(currentTick, container);
- PlaybackFileCommandContainer fileCommandsEndline = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnSerialiseEndline(currentTick, container);
+ UnsortedFileCommandContainer fileCommandsInline = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnSerialiseInline(currentTick, container);
+ UnsortedFileCommandContainer fileCommandsEndline = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnSerialiseEndline(currentTick, container);
CommentContainer comments = container.getComments();
- List serialisedInlineComments = serialiseInlineComments(comments.getInlineComments(), fileCommandsInline.valuesBySubtick());
- List serialisedEndlineComments = serialiseEndlineComments(comments.getEndlineComments(), fileCommandsEndline.valuesBySubtick());
+ List serialisedInlineComments = serialiseInlineComments(comments.getInlineComments(), fileCommandsInline);
+ List serialisedEndlineComments = serialiseEndlineComments(comments.getEndlineComments(), fileCommandsEndline);
mergeInputs(out, serialisedKeyboard, serialisedMouse, serialisedCameraAngle, serialisedInlineComments, serialisedEndlineComments);
}
@@ -508,10 +509,10 @@ protected String serialiseCameraAngleSubtick(VirtualCameraAngle cameraAngleSubti
* @param fileCommandsInline The list of file commands to serialise
* @return List of comments including file commands
*/
- protected List serialiseInlineComments(List inlineComments, List> fileCommandsInline) {
+ protected List serialiseInlineComments(List inlineComments, UnsortedFileCommandContainer fileCommandsInline) {
List out = new ArrayList<>();
- Queue> fileCommandQueue = null;
+ Queue fileCommandQueue = null;
if (fileCommandsInline != null) {
fileCommandQueue = new LinkedList<>(fileCommandsInline);
}
@@ -581,10 +582,10 @@ protected String serialiseInlineComment(String comment) {
* @param fileCommandsEndline The list of file commands to serialise
* @return The serialised comments
*/
- protected List serialiseEndlineComments(List endlineComments, List> fileCommandsEndline) {
+ protected List serialiseEndlineComments(List endlineComments, UnsortedFileCommandContainer fileCommandsEndline) {
List out = new ArrayList<>();
- Queue> fileCommandQueue = null;
+ Queue fileCommandQueue = null;
if (fileCommandsEndline != null) {
fileCommandQueue = new LinkedList<>(fileCommandsEndline);
}
@@ -656,7 +657,7 @@ protected String serialiseEndlineComment(String comment) {
* @param fileCommands The file commands to serialise
* @return A string of serialised file commands or null if fileCommands is null
*/
- protected String serialiseFileCommandsInline(List fileCommands) {
+ protected String serialiseFileCommandsInline(FileCommandsInCommentList fileCommands) {
// File commands is null if there are no file commands in the comment.
// Return null if that is the case
if (fileCommands == null) {
@@ -666,7 +667,7 @@ protected String serialiseFileCommandsInline(List fileComma
for (PlaybackFileCommand command : fileCommands) {
serialisedCommands.add(serialiseFileCommand(command));
}
- return String.join(" ", serialisedCommands);
+ return joinNotEmpty(" ", serialisedCommands);
}
/**
@@ -680,7 +681,7 @@ protected String serialiseFileCommandsInline(List fileComma
* @param fileCommands The file commands to serialise
* @return A string of serialised file commands or null if fileCommands is null
*/
- protected String serialiseFileCommandsEndline(List fileCommands) {
+ protected String serialiseFileCommandsEndline(FileCommandsInCommentList fileCommands) {
return serialiseFileCommandsInline(fileCommands);
}
@@ -697,7 +698,7 @@ protected String serialiseFileCommandsEndline(List fileComm
* @return The serialised file command, empty if {@link #processExtensions} is false
*/
protected String serialiseFileCommand(PlaybackFileCommand fileCommand) {
- if (!processExtensions)
+ if (!processExtensions || fileCommand == null)
return "";
return String.format("$%s(%s);", fileCommand.getName(), String.join(", ", fileCommand.getArgs()));
}
@@ -924,14 +925,14 @@ public List extractHeader(BigArrayList lines) {
*
* deserialiseHeader
* ├── {@link #deserialiseMetadata(List)}
- * └── {@link #deserialiseFileCommandNames(List)}
+ * └── {@link #deserialiseEnabledFileCommandNames(List)}
*
* @param headerLines The header lines to deserialise
* @see #serialiseHeader()
*/
public void deserialiseHeader(List headerLines) {
deserialiseMetadata(headerLines);
- deserialiseFileCommandNames(headerLines);
+ deserialiseEnabledFileCommandNames(headerLines);
}
/**
@@ -978,10 +979,10 @@ protected void deserialiseMetadata(List headerLines) {
/**
* Deserialises file command extension names and enables them
* @param headerLines The header lines to search
- * @see #serialiseFileCommandNames(List)
+ * @see #serialiseEnabledFileCommandNames(List)
* @throws PlaybackLoadException If the "FileCommand-Extensions" keyword is not found in the header
*/
- protected void deserialiseFileCommandNames(List headerLines) {
+ protected void deserialiseEnabledFileCommandNames(List headerLines) {
if (!processExtensions) // Stops FileCommandProcessing
return;
@@ -1010,12 +1011,12 @@ protected void deserialiseFileCommandNames(List headerLines) {
* deserialise
* ├── {@link #extractContainer(List, BigArrayList, long)}
* └── {@link #deserialiseContainer(BigArrayList, List)}
- * ├── {@link #deserialiseMultipleInlineComments(List, List)}
- * │ └── {@link #deserialiseInlineComment(String, List)}
- * │ └── {@link #deserialiseFileCommandsInline(String, List)}
+ * ├── {@link #deserialiseMultipleInlineComments(List, UnsortedFileCommandContainer)}
+ * │ └── {@link #deserialiseInlineComment(String, FileCommandsInCommentList)}
+ * │ └── {@link #deserialiseFileCommandsInline(String, FileCommandsInCommentList)}
* ├── {@link #splitInputs(List, List, List, List, List, List)}
- * │ └── {@link #deserialiseEndlineComment(String, List)}
- * │ └── {@link #deserialiseFileCommandsEndline(String, List)}
+ * │ └── {@link #deserialiseEndlineComment(String, FileCommandsInCommentList)}
+ * │ └── {@link #deserialiseFileCommandsEndline(String, FileCommandsInCommentList)}
* ├── {@link #deserialiseKeyboard(List)}
* ├── {@link #deserialiseMouse(List)}
* └── {@link #deserialiseCameraAngle(List)}
@@ -1026,6 +1027,10 @@ protected void deserialiseFileCommandNames(List headerLines) {
*/
public BigArrayList deserialise(BigArrayList lines, long startPos) {
BigArrayList out = new BigArrayList<>();
+
+ if (processExtensions)
+ TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.onClear();
+
for (long i = startPos; i < lines.size(); i++) {
List container = new ArrayList<>();
// Extract the tick and set the index
@@ -1106,7 +1111,7 @@ protected enum ExtractPhases {
* ---------------------
*
*
- * Logic
+ * Logic
*
* - Phase: None
*
@@ -1207,14 +1212,14 @@ protected void deserialiseContainer(BigArrayList out, List tickLines = new ArrayList<>();
splitContainer(containerLines, inlineComments, tickLines);
- List> inlineFileCommands = new ArrayList<>();
+ UnsortedFileCommandContainer inlineFileCommands = new UnsortedFileCommandContainer();
deserialiseMultipleInlineComments(inlineComments, inlineFileCommands);
List keyboardStrings = new ArrayList<>();
List mouseStrings = new ArrayList<>();
List cameraAngleStrings = new ArrayList<>();
List endlineComments = new ArrayList<>();
- List> endlineFileCommands = new ArrayList<>();
+ UnsortedFileCommandContainer endlineFileCommands = new UnsortedFileCommandContainer();
splitInputs(tickLines, keyboardStrings, mouseStrings, cameraAngleStrings, endlineComments, endlineFileCommands);
@@ -1252,21 +1257,21 @@ protected void splitContainer(List lines, List inlineComments, L
}
}
- protected void deserialiseMultipleInlineComments(List inlineComments, List> inlineFileCommands) {
+ protected void deserialiseMultipleInlineComments(List inlineComments, UnsortedFileCommandContainer inlineFileCommands) {
for (int i = 0; i < inlineComments.size(); i++) {
- List deserialisedFileCommand = new ArrayList<>();
+ FileCommandsInCommentList deserialisedFileCommands = new FileCommandsInCommentList();
String comment = inlineComments.get(i);
- inlineComments.set(i, deserialiseInlineComment(comment, deserialisedFileCommand));
+ inlineComments.set(i, deserialiseInlineComment(comment, deserialisedFileCommands));
- if (deserialisedFileCommand.isEmpty()) {
- deserialisedFileCommand = null;
+ if (deserialisedFileCommands.isEmpty()) {
+ deserialisedFileCommands = null;
}
- inlineFileCommands.add(deserialisedFileCommand);
+ inlineFileCommands.add(deserialisedFileCommands);
}
}
- protected String deserialiseInlineComment(String comment, List deserialisedFileCommands) {
+ protected String deserialiseInlineComment(String comment, FileCommandsInCommentList deserialisedFileCommands) {
comment = deserialiseFileCommandsInline(comment, deserialisedFileCommands);
comment = extract("^// ?(.+)", comment, 1);
if (comment != null) {
@@ -1278,7 +1283,7 @@ protected String deserialiseInlineComment(String comment, List deserialisedFileCommands) {
+ protected String deserialiseEndlineComment(String comment, FileCommandsInCommentList deserialisedFileCommands) {
comment = deserialiseFileCommandsEndline(comment, deserialisedFileCommands);
comment = extract("^// ?(.+)", comment, 1);
if (comment != null) {
@@ -1290,7 +1295,7 @@ protected String deserialiseEndlineComment(String comment, List deserialisedFileCommands) {
+ protected String deserialiseFileCommandsInline(String comment, FileCommandsInCommentList deserialisedFileCommands) {
Matcher matcher = extract("\\$(.+?)\\((.*?)\\);", comment);
// Iterate through all file commands and add each to the list
@@ -1308,7 +1313,7 @@ protected String deserialiseFileCommandsInline(String comment, List deserialisedFileCommands) {
+ protected String deserialiseFileCommandsEndline(String comment, FileCommandsInCommentList deserialisedFileCommands) {
Matcher matcher = extract("\\$(.+?)\\((.*?)\\);", comment);
// Iterate through all file commands and add each to the list
@@ -1541,7 +1546,7 @@ protected Float deserialiseRelativeFloat(String name, String floatstring, Float
return out;
}
- protected void splitInputs(List lines, List serialisedKeyboard, List serialisedMouse, List serialisedCameraAngle, List commentsAtEnd, List> endlineFileCommands) {
+ protected void splitInputs(List lines, List serialisedKeyboard, List serialisedMouse, List serialisedCameraAngle, List commentsAtEnd, UnsortedFileCommandContainer endlineFileCommands) {
String previousCamera = null;
if (previousInputContainer != null) {
@@ -1568,7 +1573,7 @@ protected void splitInputs(List lines, List serialisedKeyboard,
serialisedCameraAngle.add(previousCamera);
}
- List deserialisedFileCommands = new ArrayList<>();
+ FileCommandsInCommentList deserialisedFileCommands = new FileCommandsInCommentList();
String endlineComment = line.substring(tickMatcher.group(0).length());
commentsAtEnd.add(deserialiseEndlineComment(endlineComment, deserialisedFileCommands));
diff --git a/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/builtin/AlphaFlavor.java b/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/builtin/AlphaFlavor.java
index 5d73e12a..48c313b6 100644
--- a/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/builtin/AlphaFlavor.java
+++ b/src/main/java/com/minecrafttas/tasmod/playback/tasfile/flavor/builtin/AlphaFlavor.java
@@ -20,6 +20,7 @@
import com.dselent.bigarraylist.BigArrayList;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.FileCommandsInCommentList;
import com.minecrafttas.tasmod.playback.metadata.PlaybackMetadata;
import com.minecrafttas.tasmod.playback.tasfile.exception.PlaybackLoadException;
import com.minecrafttas.tasmod.playback.tasfile.flavor.SerialiserFlavorBase;
@@ -239,7 +240,7 @@ protected List serialiseCameraAngle(VirtualCameraAngle subticks) {
}
@Override
- protected String serialiseFileCommandsInline(List fileCommands) {
+ protected String serialiseFileCommandsInline(FileCommandsInCommentList fileCommands) {
if (fileCommands == null) {
return null;
}
@@ -256,7 +257,7 @@ protected String serialiseFileCommandsInline(List fileComma
}
@Override
- protected String serialiseFileCommandsEndline(List fileCommands) {
+ protected String serialiseFileCommandsEndline(FileCommandsInCommentList fileCommands) {
if (fileCommands == null) {
return null;
}
@@ -345,7 +346,7 @@ protected String splitInputRegex() {
}
@Override
- protected String deserialiseFileCommandsInline(String comment, List deserialisedFileCommands) {
+ protected String deserialiseFileCommandsInline(String comment, FileCommandsInCommentList deserialisedFileCommands) {
Matcher matcher = extract("\\$(.+?) (.+?)", comment);
// Iterate through all file commands and add each to the list
@@ -371,7 +372,7 @@ protected String deserialiseFileCommandsInline(String comment, List deserialisedFileCommands) {
+ protected String deserialiseFileCommandsEndline(String comment, FileCommandsInCommentList deserialisedFileCommands) {
Matcher matcher = extract("Monitoring:(.+)", comment);
// Iterate through all file commands and add each to the list
@@ -528,7 +529,7 @@ protected VirtualCameraAngle deserialiseCameraAngle(List cameraAngleStri
}
@Override
- protected void deserialiseFileCommandNames(List headerLines) {
+ protected void deserialiseEnabledFileCommandNames(List headerLines) {
/*
* Alpha has these file commands hardcoded
*/
diff --git a/src/test/java/tasmod/playback/filecommands/PlaybackFileCommandTest.java b/src/test/java/tasmod/playback/filecommands/PlaybackFileCommandTest.java
new file mode 100644
index 00000000..483410a0
--- /dev/null
+++ b/src/test/java/tasmod/playback/filecommands/PlaybackFileCommandTest.java
@@ -0,0 +1,233 @@
+package tasmod.playback.filecommands;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertIterableEquals;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import com.dselent.bigarraylist.BigArrayList;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.FileCommandsInCommentList;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.SortedFileCommandContainer;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.UnsortedFileCommandContainer;
+import com.minecrafttas.tasmod.registries.TASmodAPIRegistry;
+
+class PlaybackFileCommandTest {
+
+ class TestFileCommandExtension extends PlaybackFileCommandExtension {
+
+ public TestFileCommandExtension() {
+ enabled = true;
+ }
+
+ @Override
+ public String getExtensionName() {
+ return "tasmod_test@v1";
+ }
+
+ @Override
+ public String[] getFileCommandNames() {
+ return new String[] { "test" };
+ }
+
+ public BigArrayList getInlineStorage() {
+ return this.inlineFileCommandStorage;
+ }
+
+ public BigArrayList getEndlineStorage() {
+ return this.endlineFileCommandStorage;
+ }
+ }
+
+ class TestMultiFileCommandExtension extends PlaybackFileCommandExtension {
+
+ public TestMultiFileCommandExtension() {
+ enabled = true;
+ }
+
+ @Override
+ public String getExtensionName() {
+ return "tasmod_multi@v1";
+ }
+
+ @Override
+ public String[] getFileCommandNames() {
+ return new String[] { "multi1", "multi2" };
+ }
+
+ public BigArrayList getInlineStorage() {
+ return this.inlineFileCommandStorage;
+ }
+
+ public BigArrayList getEndlineStorage() {
+ return this.endlineFileCommandStorage;
+ }
+ }
+
+ TestFileCommandExtension test;
+ TestMultiFileCommandExtension multi;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ test = new TestFileCommandExtension();
+ multi = new TestMultiFileCommandExtension();
+ TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.register(test, multi);
+ }
+
+ @AfterEach
+ void tearDown() throws Exception {
+ TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.clear();
+ }
+
+ @Test
+ void testInlineDeserialisation() {
+ // Actual
+ FileCommandsInCommentList list = new FileCommandsInCommentList();
+ list.add(new PlaybackFileCommand("test"));
+
+ UnsortedFileCommandContainer container = new UnsortedFileCommandContainer();
+ container.add(list);
+ TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnDeserialiseInline(0, null, container);
+
+ SortedFileCommandContainer actual = test.getInlineStorage().get(0);
+
+ // Expected
+ SortedFileCommandContainer expected = new SortedFileCommandContainer();
+ expected.add("test", new PlaybackFileCommand("test"));
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ void testEndlineDeserialisation() {
+ // Actual
+ FileCommandsInCommentList list = new FileCommandsInCommentList();
+ list.add(new PlaybackFileCommand("test"));
+
+ UnsortedFileCommandContainer container = new UnsortedFileCommandContainer();
+ container.add(list);
+ TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnDeserialiseEndline(0, null, container);
+
+ SortedFileCommandContainer actual = test.getEndlineStorage().get(0);
+
+ // Expected
+ SortedFileCommandContainer expected = new SortedFileCommandContainer();
+ expected.add("test", new PlaybackFileCommand("test"));
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ void testInline2LineDeserialisation() {
+ // Actual
+ FileCommandsInCommentList line1 = new FileCommandsInCommentList();
+ line1.add(new PlaybackFileCommand("test"));
+
+ UnsortedFileCommandContainer container = new UnsortedFileCommandContainer();
+ container.add(line1);
+ container.add(null);
+ TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnDeserialiseInline(0, null, container);
+
+ SortedFileCommandContainer actual = test.getInlineStorage().get(0);
+
+ // Expected
+ SortedFileCommandContainer expected = new SortedFileCommandContainer();
+ expected.add("test", new PlaybackFileCommand("test"));
+ expected.add("test", null);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ void testMultiInlineDeserialisation() {
+ // Actual
+ FileCommandsInCommentList line1 = new FileCommandsInCommentList();
+ line1.add(new PlaybackFileCommand("multi1"));
+ line1.add(new PlaybackFileCommand("multi2"));
+
+ UnsortedFileCommandContainer container = new UnsortedFileCommandContainer();
+ container.add(line1);
+ TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnDeserialiseInline(0, null, container);
+
+ SortedFileCommandContainer actual = multi.getInlineStorage().get(0);
+
+ // Expected
+ SortedFileCommandContainer expected = new SortedFileCommandContainer();
+ expected.add("multi1", new PlaybackFileCommand("multi1"));
+ expected.add("multi2", new PlaybackFileCommand("multi2"));
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ void testInlineSerialisation() {
+ // Actual
+ SortedFileCommandContainer container = new SortedFileCommandContainer();
+ container.add("test", new PlaybackFileCommand("test"));
+
+ test.getInlineStorage().add(container);
+
+ UnsortedFileCommandContainer actual = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnSerialiseInline(0, null);
+
+ // Expected
+ UnsortedFileCommandContainer expected = new UnsortedFileCommandContainer();
+ FileCommandsInCommentList commentList = new FileCommandsInCommentList();
+
+ commentList.add(new PlaybackFileCommand("test"));
+ expected.add(commentList);
+
+ assertIterableEquals(expected, actual);
+ }
+
+ @Test
+ void testEndlineSerialisation() {
+ // Actual
+ SortedFileCommandContainer container = new SortedFileCommandContainer();
+ container.add("test", new PlaybackFileCommand("test"));
+
+ test.getEndlineStorage().add(container);
+
+ UnsortedFileCommandContainer actual = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnSerialiseEndline(0, null);
+
+ // Expected
+ UnsortedFileCommandContainer expected = new UnsortedFileCommandContainer();
+ FileCommandsInCommentList commentList = new FileCommandsInCommentList();
+
+ commentList.add(new PlaybackFileCommand("test"));
+ expected.add(commentList);
+
+ assertIterableEquals(expected, actual);
+ }
+
+ @Test
+ void testMultiInlineSerialisation() {
+ // Actual
+ SortedFileCommandContainer container = new SortedFileCommandContainer();
+ container.add("multi1", new PlaybackFileCommand("multi1"));
+ container.add("multi1", null);
+
+ container.add("multi2", null);
+ container.add("multi2", new PlaybackFileCommand("multi2"));
+
+ multi.getInlineStorage().add(container);
+
+ UnsortedFileCommandContainer actual = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.handleOnSerialiseInline(0, null);
+
+ // Expected
+ UnsortedFileCommandContainer expected = new UnsortedFileCommandContainer();
+ FileCommandsInCommentList commentList1 = new FileCommandsInCommentList();
+ FileCommandsInCommentList commentList2 = new FileCommandsInCommentList();
+
+ commentList1.add(new PlaybackFileCommand("multi1"));
+ commentList1.add(null);
+ commentList2.add(null);
+ commentList2.add(new PlaybackFileCommand("multi2"));
+ expected.add(commentList1);
+ expected.add(commentList2);
+
+ assertIterableEquals(expected, actual);
+ }
+}
diff --git a/src/test/java/tasmod/playback/tasfile/PlaybackSerialiserTest.java b/src/test/java/tasmod/playback/tasfile/PlaybackSerialiserTest.java
index bb192afa..50a3eeda 100644
--- a/src/test/java/tasmod/playback/tasfile/PlaybackSerialiserTest.java
+++ b/src/test/java/tasmod/playback/tasfile/PlaybackSerialiserTest.java
@@ -23,8 +23,8 @@
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.CommentContainer;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
-import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.SortedFileCommandContainer;
import com.minecrafttas.tasmod.playback.metadata.PlaybackMetadata;
import com.minecrafttas.tasmod.playback.metadata.PlaybackMetadata.PlaybackMetadataExtension;
import com.minecrafttas.tasmod.playback.tasfile.PlaybackSerialiser;
@@ -89,33 +89,22 @@ public void onClear() {
private static class TestFileCommand extends PlaybackFileCommandExtension {
- List inline = new ArrayList<>();
- List endline = new ArrayList<>();
-
@Override
public String getExtensionName() {
return "tasmod_testFileExtension";
}
- @Override
- public void onDeserialiseInlineComment(long tick, InputContainer container, PlaybackFileCommandContainer fileCommandContainer) {
- inline.add(fileCommandContainer.split("testKey"));
- }
-
- @Override
- public void onDeserialiseEndlineComment(long tick, InputContainer container, PlaybackFileCommandContainer fileCommandContainer) {
- endline.add(fileCommandContainer.split("endlineKey"));
- }
-
@Override
public String[] getFileCommandNames() {
return new String[] { "testKey", "endlineKey" };
}
- @Override
- public void onClear() {
- inline.clear();
- endline.clear();
+ public BigArrayList getInlineStorage() {
+ return this.inlineFileCommandStorage;
+ }
+
+ public BigArrayList getEndlineStorage() {
+ return this.endlineFileCommandStorage;
}
}
@@ -282,30 +271,26 @@ void testDeserialiser() throws PlaybackLoadException, IOException {
assertEquals("Wat", testMetadata.actual);
- List fclist = new ArrayList<>();
- PlaybackFileCommandContainer fccontainer = new PlaybackFileCommandContainer();
+ BigArrayList fclist = new BigArrayList<>();
+ SortedFileCommandContainer fccontainer = new SortedFileCommandContainer();
fccontainer.add("testKey", new PlaybackFileCommand("testKey", "test"));
- PlaybackFileCommandContainer fccontainerempty = new PlaybackFileCommandContainer();
- fccontainerempty.put("testKey", null);
-
fclist.add(fccontainer);
- fclist.add(fccontainerempty);
- fclist.add(fccontainerempty);
- assertIterableEquals(fclist, testFileCommand.inline);
+ fclist.add(new SortedFileCommandContainer());
+ fclist.add(new SortedFileCommandContainer());
+ assertBigArrayList(fclist, testFileCommand.getInlineStorage());
- List fclistEnd = new ArrayList<>();
- PlaybackFileCommandContainer fccontainerEnd = new PlaybackFileCommandContainer();
+ BigArrayList fclistEnd = new BigArrayList<>();
+ SortedFileCommandContainer fccontainerEnd = new SortedFileCommandContainer();
fccontainerEnd.add("endlineKey", null);
fccontainerEnd.add("endlineKey", new PlaybackFileCommand("endlineKey"));
-
- PlaybackFileCommandContainer fccontainerEndEmpty = new PlaybackFileCommandContainer();
- fccontainerEndEmpty.put("endlineKey", null);
+ fccontainerEnd.add("testKey", null);
+ fccontainerEnd.add("testKey", new PlaybackFileCommand("testKey"));
fclistEnd.add(fccontainerEnd);
- fclistEnd.add(fccontainerEndEmpty);
- fclistEnd.add(fccontainerEndEmpty);
- assertIterableEquals(fclistEnd, testFileCommand.endline);
+ fclistEnd.add(new SortedFileCommandContainer());
+ fclistEnd.add(new SortedFileCommandContainer());
+ assertBigArrayList(fclistEnd, testFileCommand.getEndlineStorage());
}
@Test
@@ -372,8 +357,8 @@ void testDeserialiserNoExtensions() throws PlaybackLoadException, IOException {
assertEquals("e", testMetadata.actual);
- assertTrue(testFileCommand.inline.isEmpty());
- assertTrue(testFileCommand.endline.isEmpty());
+ assertTrue(testFileCommand.getInlineStorage().isEmpty());
+ assertTrue(testFileCommand.getEndlineStorage().isEmpty());
}
@Test
diff --git a/src/test/java/tasmod/playback/tasfile/SerialiserFlavorBaseTest.java b/src/test/java/tasmod/playback/tasfile/SerialiserFlavorBaseTest.java
index dc14c380..6481476f 100644
--- a/src/test/java/tasmod/playback/tasfile/SerialiserFlavorBaseTest.java
+++ b/src/test/java/tasmod/playback/tasfile/SerialiserFlavorBaseTest.java
@@ -19,7 +19,9 @@
import com.dselent.bigarraylist.BigArrayList;
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.InputContainer;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.FileCommandsInCommentList;
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension;
+import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.UnsortedFileCommandContainer;
import com.minecrafttas.tasmod.playback.metadata.PlaybackMetadata;
import com.minecrafttas.tasmod.playback.metadata.PlaybackMetadata.PlaybackMetadataExtension;
import com.minecrafttas.tasmod.playback.tasfile.exception.PlaybackLoadException;
@@ -184,7 +186,7 @@ public String[] getFileCommandNames() {
TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.setEnabled("tasmod_testFileCommand", true);
List actual = new ArrayList<>();
- serialiseFileCommandNames(actual);
+ serialiseEnabledFileCommandNames(actual);
List expected = new ArrayList<>();
expected.add("FileCommand-Extensions: tasmod_testFileCommand");
@@ -244,7 +246,7 @@ void testSerialiseComments() {
inlineComments.add("Test2");
inlineComments.add(""); // Should result in "// "
- List actual = serialiseInlineComments(inlineComments, new ArrayList<>());
+ List actual = serialiseInlineComments(inlineComments, new UnsortedFileCommandContainer());
List expected = new ArrayList<>();
expected.add("// Test");
@@ -262,18 +264,18 @@ void testSerialiseComments() {
@Test
void testSerialiseFileCommands() {
- List> fileCommands = new ArrayList<>();
- List fcInLine = new ArrayList<>();
+ UnsortedFileCommandContainer fileCommands = new UnsortedFileCommandContainer();
+ FileCommandsInCommentList fcInLine = new FileCommandsInCommentList();
fcInLine.add(new PlaybackFileCommand("test"));
fcInLine.add(new PlaybackFileCommand("testing2", "true", "false"));
- List fcInLine2 = new ArrayList<>();
+ FileCommandsInCommentList fcInLine2 = new FileCommandsInCommentList();
fcInLine2.add(new PlaybackFileCommand("interpolation", "true"));
fileCommands.add(fcInLine);
fileCommands.add(null);
fileCommands.add(fcInLine2);
- fileCommands.add(new ArrayList<>());
+ fileCommands.add(new FileCommandsInCommentList());
List actual = serialiseInlineComments(null, fileCommands);
@@ -288,22 +290,22 @@ void testSerialiseFileCommands() {
@Test
void testMergingCommentsAndCommands() {
- List> fileCommands = new ArrayList<>();
- List fcInLine = new ArrayList<>();
+ UnsortedFileCommandContainer fileCommands = new UnsortedFileCommandContainer();
+ FileCommandsInCommentList fcInLine = new FileCommandsInCommentList();
fcInLine.add(new PlaybackFileCommand("test"));
fcInLine.add(new PlaybackFileCommand("testing2", "true", "false"));
fileCommands.add(fcInLine);
fileCommands.add(null);
fileCommands.add(null);
- fileCommands.add(new ArrayList<>());
+ fileCommands.add(new FileCommandsInCommentList());
- List fcInLine2 = new ArrayList<>();
+ FileCommandsInCommentList fcInLine2 = new FileCommandsInCommentList();
fcInLine2.add(new PlaybackFileCommand("interpolation", "true"));
fileCommands.add(fcInLine2);
- List fcInLine3 = new ArrayList<>();
+ FileCommandsInCommentList fcInLine3 = new FileCommandsInCommentList();
fcInLine3.add(new PlaybackFileCommand("info", "Scribble"));
fcInLine3.add(new PlaybackFileCommand("info", "Dribble"));
@@ -521,7 +523,7 @@ public String[] getFileCommandNames() {
List lines = new ArrayList<>();
lines.add("FileCommand-Extensions: tasmod_test1, tasmod_test2");
- deserialiseFileCommandNames(lines);
+ deserialiseEnabledFileCommandNames(lines);
assertTrue(test1.isEnabled());
assertTrue(test2.isEnabled());
@@ -529,7 +531,7 @@ public String[] getFileCommandNames() {
lines = new ArrayList<>();
lines.add("FileCommand-Extensions: ");
- deserialiseFileCommandNames(lines);
+ deserialiseEnabledFileCommandNames(lines);
assertFalse(test1.isEnabled());
assertFalse(test2.isEnabled());
@@ -537,7 +539,7 @@ public String[] getFileCommandNames() {
lines = new ArrayList<>();
lines.add("FileCommand-Extensions: tasmod_test1,tasmod_test2");
- deserialiseFileCommandNames(lines);
+ deserialiseEnabledFileCommandNames(lines);
assertTrue(test1.isEnabled());
assertTrue(test2.isEnabled());
@@ -546,7 +548,7 @@ public String[] getFileCommandNames() {
lines2.add("FileCommand-Extensions tasmod_test1,tasmod_test2");
Throwable t = assertThrows(PlaybackLoadException.class, () -> {
- deserialiseFileCommandNames(lines2);
+ deserialiseEnabledFileCommandNames(lines2);
});
assertEquals("FileCommand-Extensions value was not found in the header", t.getMessage());
@@ -729,7 +731,7 @@ void testSplitInputs() {
List actualMouse = new ArrayList<>();
List actualCameraAngle = new ArrayList<>();
List actualComment = new ArrayList<>();
- List> actualFileCommand = new ArrayList<>();
+ UnsortedFileCommandContainer actualFileCommand = new UnsortedFileCommandContainer();
splitInputs(tick, actualKeyboard, actualMouse, actualCameraAngle, actualComment, actualFileCommand);
@@ -737,7 +739,7 @@ void testSplitInputs() {
List expectedMouse = new ArrayList<>();
List expectedCameraAngle = new ArrayList<>();
List expectedComment = new ArrayList<>();
- List> expectedFileCommand = new ArrayList<>();
+ UnsortedFileCommandContainer expectedFileCommand = new UnsortedFileCommandContainer();
expectedKeyboard.add("W,LCONTROL;w");
@@ -756,7 +758,7 @@ void testSplitInputs() {
expectedFileCommand.add(null);
expectedFileCommand.add(null);
- List lineCommand = new ArrayList<>();
+ FileCommandsInCommentList lineCommand = new FileCommandsInCommentList();
lineCommand.add(new PlaybackFileCommand("test", "true"));
expectedFileCommand.add(lineCommand);
@@ -784,7 +786,7 @@ void testSplitContainer() {
List actualTick = new ArrayList<>();
splitContainer(lines, actualComments, actualTick);
- List> actualInlineFileCommands = new ArrayList<>();
+ UnsortedFileCommandContainer actualInlineFileCommands = new UnsortedFileCommandContainer();
deserialiseMultipleInlineComments(actualComments, actualInlineFileCommands);
List expectedComments = new ArrayList<>();
@@ -796,8 +798,8 @@ void testSplitContainer() {
expectedTicks.add("\t1||RC;-15,1580,658|11.85;-2.74799");
expectedTicks.add("\t2||;0,1580,658|45;-22.799");
- List> expectedInlineFileCommands = new ArrayList<>();
- List commands = new ArrayList<>();
+ UnsortedFileCommandContainer expectedInlineFileCommands = new UnsortedFileCommandContainer();
+ FileCommandsInCommentList commands = new FileCommandsInCommentList();
commands.add(new PlaybackFileCommand("interpolation", "on"));
expectedInlineFileCommands.add(commands);
expectedInlineFileCommands.add(null);
diff --git a/src/test/java/tasmod/playback/tasfile/builtin/AlphaFlavorTest.java b/src/test/java/tasmod/playback/tasfile/builtin/AlphaFlavorTest.java
index b5cc470f..3a891d41 100644
--- a/src/test/java/tasmod/playback/tasfile/builtin/AlphaFlavorTest.java
+++ b/src/test/java/tasmod/playback/tasfile/builtin/AlphaFlavorTest.java
@@ -210,7 +210,7 @@ void testDeserialiseMetadata() {
@Test
void testDeserialiseFileCommandNames() {
- deserialiseFileCommandNames(new ArrayList<>());
+ deserialiseEnabledFileCommandNames(new ArrayList<>());
List fcList = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.getEnabled();
assertTrue(fcList.get(0) instanceof LabelFileCommandExtension);