Class FoliosQuests
java.lang.Object
net.ixdarklord.folios.api.FoliosQuests
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 ClassesModifier and TypeClassDescriptionstatic interfaceTold when a player finishes a server quest. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcomplete(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 booleanisClaimed(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest) Whether a player has claimed a server quest's reward.static booleanisDone(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier quest) Whether a player has finished a server quest.static voidonCompleted(FoliosQuests.Completed listener) Listens for players finishing quests.static floatprogress(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> quests()The server quests there are.static voidregisterFlag(String flag, Predicate<net.minecraft.server.level.ServerPlayer> on) A flag a mod works out for each player, for quests'"flag"objectives.static voidregisterValue(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 voidreset(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 voidSets or clears one of a player's own flags.
-
Method Details
-
onCompleted
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
-
setFlag
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
The server quests there are.
-