Skip to content

Commit

Permalink
Review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
SekoiaTree committed Feb 12, 2024
1 parent af58fb0 commit cdfa410
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.mojang.serialization.Codec;
import net.minecraft.network.PacketByteBuf;
import org.jetbrains.annotations.ApiStatus;
import org.ladysnake.blabber.impl.common.BlabberRegistrar;

import java.util.function.BiConsumer;
Expand Down Expand Up @@ -71,6 +72,7 @@ public void writeToPacket(PacketByteBuf buf, T toWrite) {
* Same as writeToPacket, but does an unchecked cast, for when the type information is lost somewhere.
* Make sure it's safe.
*/
@ApiStatus.Internal
public void writeToPacketUnsafe(PacketByteBuf buf, DialogueIllustration illustration) {
//noinspection unchecked
this.writeToPacket(buf, (T) illustration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static ValidationResult validateStructure(DialogueTemplate dialogue) {
for (Map.Entry<String, DialogueState> state : dialogue.states().entrySet()) {
for (String illustration : state.getValue().illustrations()) {
if (!dialogue.illustrations().containsKey(illustration)) {
warnings.add(new ValidationResult.Warning.NonexistentIllustrationList(state.getKey(), illustration));
return new ValidationResult.Error.NonexistentIllustrationList(state.getKey(), illustration);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ public String message() {
return state() + " only has conditional paths to the end of the dialogue";
}
}

record NonexistentIllustrationList(String state, String illustration) implements Warning {

@Override
public String message() {
return state() + " references non-existent illustration list " + illustration();
}
}
}

sealed interface Error extends ValidationResult {
Expand All @@ -81,5 +73,12 @@ public String message() {
return state() + " does not have any path to the end of the dialogue";
}
}

record NonexistentIllustrationList(String state, String illustration) implements Error {
@Override
public String message() {
return state() + " references non-existent illustration list " + illustration();
}
}
}
}

0 comments on commit cdfa410

Please sign in to comment.