Class FoliosQuests

java.lang.Object
net.ixdarklord.folios.api.FoliosQuests

public final class FoliosQuests extends Object
Quests the server follows: those data packs give (data/<namespace>/folios/quests/<name>.json), checked by the server alone and rewarded by it. Books show them with a quest element naming one ("quest": "mymod:first_quest").
FoliosQuests.onCompleted((player, quest) -> MyMod.LOGGER.info("{} finished {}", player.getName().getString(), quest));
FoliosQuests.registerValue(MyMod.id("mana"), player -> Mana.of(player).current());
FoliosQuests.setFlag(player, "mymod:met_the_wizard", true);
if (FoliosQuests.isDone(player, MyMod.id("first_quest"))) ...
Server side only: call these on the server thread.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Told when a player finishes a server quest.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    complete(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
    Finishes a quest for a player, as though they had done all of it.
    static boolean
    isClaimed(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
    Whether a player has claimed a server quest's reward.
    static boolean
    isDone(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
    Whether a player has finished a server quest.
    static void
    Listens for players finishing quests.
    static float
    progress(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
    How far along a player is with a server quest, 0 to 1.
    static List<net.minecraft.resources.Identifier>
    The server quests there are.
    static void
    registerFlag(String flag, Predicate<net.minecraft.server.level.ServerPlayer> on)
    A flag a mod works out for each player, for quests' "flag" objectives.
    static void
    registerValue(net.minecraft.resources.Identifier id, ToDoubleFunction<net.minecraft.server.level.ServerPlayer> value)
    A value for quests' "source" objectives to follow ({"source": "mymod:mana", "goal": 100}).
    static void
    reset(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
    Takes back a player's quest, and its claim: they can do it, and claim it, again.
    static void
    setFlag(net.minecraft.server.level.ServerPlayer player, String flag, boolean on)
    Sets or clears one of a player's own flags.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • onCompleted

      public static void onCompleted(FoliosQuests.Completed listener)
      Listens for players finishing quests.
    • registerValue

      public static void registerValue(net.minecraft.resources.Identifier id, ToDoubleFunction<net.minecraft.server.level.ServerPlayer> value)
      A value for quests' "source" objectives to follow ({"source": "mymod:mana", "goal": 100}).
    • registerFlag

      public static void registerFlag(String flag, Predicate<net.minecraft.server.level.ServerPlayer> on)
      A flag a mod works out for each player, for quests' "flag" objectives.
    • setFlag

      public static void setFlag(net.minecraft.server.level.ServerPlayer player, String flag, boolean on)
      Sets or clears one of a player's own flags. Their quests are checked again straight away.
    • isDone

      public static boolean isDone(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
      Whether a player has finished a server quest.
    • isClaimed

      public static boolean isClaimed(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
      Whether a player has claimed a server quest's reward.
    • progress

      public static float progress(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
      How far along a player is with a server quest, 0 to 1.
    • complete

      public static void complete(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
      Finishes a quest for a player, as though they had done all of it.
    • reset

      public static void reset(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest)
      Takes back a player's quest, and its claim: they can do it, and claim it, again.
    • quests

      public static List<net.minecraft.resources.Identifier> quests()
      The server quests there are.