From aed0eef98aa0908c8b89a04c47ba0f50979e3f86 Mon Sep 17 00:00:00 2001 From: enjarai Date: Fri, 20 Sep 2024 16:42:03 +0200 Subject: [PATCH] Teehee :3 --- src/main/java/dev/enjarai/trickster/spell/Fragment.java | 4 ++-- src/main/java/dev/enjarai/trickster/spell/SpellPart.java | 4 +--- .../dev/enjarai/trickster/spell/fragment/EntityFragment.java | 4 ++-- .../dev/enjarai/trickster/spell/fragment/ListFragment.java | 5 +++++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/enjarai/trickster/spell/Fragment.java b/src/main/java/dev/enjarai/trickster/spell/Fragment.java index d749af1f..b67111f8 100644 --- a/src/main/java/dev/enjarai/trickster/spell/Fragment.java +++ b/src/main/java/dev/enjarai/trickster/spell/Fragment.java @@ -46,8 +46,8 @@ default SerializedSpellInstruction asSerialized() { return new SerializedSpellInstruction(SpellInstructionType.FRAGMENT, this); } - default boolean isEphemeral() { - return false; + default Fragment applyEphemeral() { + return this; } default Optional, Fragment>> getActivator() { diff --git a/src/main/java/dev/enjarai/trickster/spell/SpellPart.java b/src/main/java/dev/enjarai/trickster/spell/SpellPart.java index fed468e7..9d922024 100644 --- a/src/main/java/dev/enjarai/trickster/spell/SpellPart.java +++ b/src/main/java/dev/enjarai/trickster/spell/SpellPart.java @@ -75,9 +75,7 @@ public void brutallyMurderEphemerals() { if (glyph instanceof SpellPart spellPart) { spellPart.brutallyMurderEphemerals(); } else { - if (glyph.isEphemeral()) { - glyph = new ZalgoFragment(); - } + glyph = glyph.applyEphemeral(); } } diff --git a/src/main/java/dev/enjarai/trickster/spell/fragment/EntityFragment.java b/src/main/java/dev/enjarai/trickster/spell/fragment/EntityFragment.java index 18126d33..bad85f3f 100644 --- a/src/main/java/dev/enjarai/trickster/spell/fragment/EntityFragment.java +++ b/src/main/java/dev/enjarai/trickster/spell/fragment/EntityFragment.java @@ -44,8 +44,8 @@ public BooleanFragment asBoolean() { } @Override - public boolean isEphemeral() { - return true; + public Fragment applyEphemeral() { + return new ZalgoFragment(); } public static EntityFragment from(Entity entity) { diff --git a/src/main/java/dev/enjarai/trickster/spell/fragment/ListFragment.java b/src/main/java/dev/enjarai/trickster/spell/fragment/ListFragment.java index d21d9e83..f79fdc7d 100644 --- a/src/main/java/dev/enjarai/trickster/spell/fragment/ListFragment.java +++ b/src/main/java/dev/enjarai/trickster/spell/fragment/ListFragment.java @@ -39,6 +39,11 @@ public Text asText() { return result.append("]"); } + @Override + public Fragment applyEphemeral() { + return new ListFragment(fragments.stream().map(Fragment::applyEphemeral).toList()); + } + @Override public BooleanFragment asBoolean() { return new BooleanFragment(!fragments.isEmpty());