Description
The Quests addon adds the ability to create quests.
These quests are fairly customizable and there are many options to allow you to configure them however you want to.
There are a few more complicated things that you can do with this addon, but for the most part it is pretty simple.
Commands
/quest
– Displays the quest GUI/quest reload
– Reloads all data for the mod/quest reset
– Resets all the quest data for the players/quest reset {players}
– Resets the quest data for the players/quest grant {players} {questID}
– Completes the quest for the players/quest grant {players} {questID} {stage}
– Completes the quest stage for the players
Creating Quests
After you start your server for the first time after adding the mod, a new config folder will be made here: \config\serverutils\quests
Inside of this folder is where all of your quest files will be located. You should see a file called test.json. When you open it, you will see the following:
{
"name": "Test",
"desc": "This is an example",
"rewards": [
"Knowledge"
],
"requirements": [],
"taskList": [
{
"type": "block_break",
"goal": "Break a block of dirt",
"objectives": {
"dirt": {
"tag": "minecraft:dirt",
"desc": "Break Dirt",
"count": 1
}
},
"reward": {
"cmds": [
"broadcast \"{player} broke a block of dirt!\""
],
"msgs": [
"You broke a block of dirt!"
]
}
}
],
"lockedID": 0,
"unlockedID": 0,
"startedID": 0,
"finishedID": 0
}
At first this may look like a lot to understand, but we will break it down to help you understand it better.
The “name”, “desc”, and “rewards” are just text that will be displayed when the player hovers over the item.
The “requirements” is a list of the quest IDs that this quest needs to be unlocked. The quest ID is the name of the file.
One important thing to remember is that none of the quest files should share a name.
Under that you will find the “taskList”. This is a list of all of the Tasks in a quest and they need to be in order from start to finish.
Tasks
Each task has a fair amount of settings. Here is just the code for a single task:
{
"type": "block_break",
"goal": "Break a block of dirt",
"objectives": {
"dirt": {
"tag": "minecraft:dirt",
"desc": "Break Dirt",
"count": 1
}
},
"reward": {
"cmds": [
"broadcast \"{player} broke a block of dirt!\""
],
"msgs": [
"You broke a block of dirt!"
]
}
}
At the top is “type”, this is what kind of task this is. Valid TaskTypes are:
- block_break : Tasks for breaking blocks
- block_interact : Tasks for right-clicking on blocks
- entity_kill : Tasks for killing entities
- entity_interact : Tasks for right-clicking on entities
The next setting is “goal”. This is just text to display when the player hovers over the quest in the GUI.
Objectives
The “objectives” contains all of the objectives for this task. For example, having the player break one of each ore. To add an objective, you need an ID for it (for example: “dirt”) as well as the objective.
Each objective contains 3 things. A “tag”, “desc”, and “count”.
The “tag” can be a few things. For blocks it is the id of the block (for example: “minecraft:dirt”), for entities it is the id of the entity (for example: “minecraft:zombie”). The tag can be set to have multiple tags. If you put a comma between two ids (for example: “minecraft:spider,minecraft:cave_spider”) then this objective will track when the player interacts/kills any of the tags.
A tag can also be a specific tag. If you prefix a tag with # then it will search for any block that is in that tag (for example: “#minecraft:oak_logs” will work for any type of oak log). For entities however, this will check to see if the entity has this Tag set. The tag on an entity can be done in a few different ways, but to do so using commands you can use this: /summon pig ~ ~ ~ {Tags:[”omega_pig”]}
. Then, to see if the player killed this pig instead of a random one you could use this as the tag: “#omega_pig”. This should work in most cases.
You can also require that the Tag has all of the tags listed. To do that you use the and sign. Then it will check to see if all of the tags are present (for example: “minecraft:pig&#omega_pig”. This will require that the entity is both a pig and has the omega_pig tag set to it.)
There is another type of tag as well. This one will compare the tag to the item in the player’s main hand to see if it should be tracked. To do this, you start the tag with the dollar sign (for example: “minecraft:dirt&$minecraft:stone_shovel”. This will check to see if the player broke a block of dirt with a stone shovel.
To summarize the “tag” here are the allowed formatting for a tag:
minecraft:dirt
: The block/etntiy ID#minecraft:oak_logs
: The block/entity Tags$minecraft:stone_axe
: The item ID in the players main hand.
In order to chain multiple tags together (only use one type for an objective):
tag&tag
: Requires both tags to be counted.tag,tag
: Requires either tag to be counted.
The “desc” is what the player will be shown that the objective is. If the count is larger than one, it will show how many are done out of how many are needed.
The “count” is simply how many times the player needs to do this objective for it to be finished.
Task Reward
The rewards are run after this task has been finished. Both the “cmds” and “msgs” are lists of text. When the reward is given, it will replace any {player} with the player’s name, as well as replacing any {name} with the player’s display name.
To delay a message or command, prefix the reward with this: “${delay:#}$” where the # is how many seconds you want it to be delayed. For example: “${delay:5}$econ add{player} 100” will give the player 100$ after 5 seconds.
The “cmds” are a list of commands that will be run as console. You can do things like granting a player an advancement, giving them an item, giving them money, etc.
The “msgs” are a list of messages that will be sent to the player when the task is finished.
CustomModelData
the last 4 settings are “lockedID”, “unlockedID”, “startedID”, “finishedID”. These are optional, but if they are set they will set the quest icon to having the ID based on the state of the quest. You can use this to change the model/texture of the item shown in the GUI if you are using a resource pack.
Folders
You are able to create folders for your quests. Simply make a new folder in the config folder for the quests and put a quest into it. When you reload the quests it will automatically detect the new subfolder and you will see a book displayed on the quest menu.
Clicking on it will open up a submenu of any quests that are in that folder.
After a new folder has been detected a new file will be made. This file is called folder.dat. You can open it with any text editor. Inside it should look like this:
{
"name": "",
"desc": [],
"customModelData": 0
}
All of these are optional. The “name” will change the name of the folder in the GUI. The “desc” will set the lore of the item in the GUI. Both of these support ServerUtils and Minecraft color codes. The “customModelData” will again allow you change the model of the item when using a resource pack.
Resource Pack
I have made a template resource pack that will allow you to have a place to start to customize your quests UI. You can download it here: DOWNLOAD
Player Quest Data
The player’s quest data can be found in: “/world/playerdata/{uuid}.qdat”. If you want to manually edit it, be careful. When you finish run /quest reload