Missions
Using missions, you can give your players tasks to do on your server. In this documentation, you will understand how to edit them to your own style!
How do missions work?
First of all, it's important to understand how missions work. Missions are instructions that given to external jars (similar to plugins). The jars handle the events and actions that player do, and by following the instructions that are given to them, they know how to reward the players or islands. SuperiorSkyblock provides default jars that know how to handle a large range of actions, such as block breaking, island actions, enchanting, collection of items and crafting of items.
Default mission jars
Here you can find information about every default mission jar.
BlocksMissions
The BlocksMissions jar handles tracking of placement and breaking of blocks in islands. Using this jar, you can give players missions that they need to break certain blocks or place them. You can read more about it here.
BrewingMissions
The BrewingMissions jar handles tracking of brewing potions in islands. Using this jar, you can give players missions that they need to brew certain potions. You can read more about it here.
CraftingMissions
The CraftingMissions jar handles tracking of crafting items in islands. Using this jar, you can give players missions that they need to craft items in a crafting table. You can read more about it here.
EnchantingMissions
The EnchantingMissions jar handles tracking of enchanting items in islands. Using this jar, you can give players missions that they need to enchant certain items. You can read more about it here.
FarmingMissions
The FarmingMissions jar handles tracking of growth of crops in islands. Using this jar, you can give players missions that they need to plant crops. You can read more about it here.
FishingMissions
The FishingMissions jar handles tracking of fishing in islands. Using this jar, you can give players missions that they need to fish. You can read more about it here.
IslandMissions
The IslandMissions jar handles tracking island events. Using this jar, you can give players missions that can be completed once an event is fired. You can read more about it here.
ItemsMissions
The ItemsMissions jar handles tracking of items in inventories. Using this jar, you can give players missions that they need to hold an item for completion. You can read more about it here.
KillsMissions
The KillsMissions jar handles tracking of mobs killing in islands. Using this jar, you can give players missions that they need to kill mobs. You can read more about it here.
StatisticsMissions
The StatisticsMissions jar handles tracking of statistics. Using this jar, you can give players missions that they need to get certain statistics. You can read more about it here.
Missions files-structure
The root folder for missions is the "categories" folder, located in modules/missions/categories
. This folder should contain only folders, each represents a different missions-category. Each category folder can contain unlimited amount of files, each represents a different mission inside that category. The name of the missions will be the same as the name of the file representing your mission.
Create your first mission
Here you'll understand how to create your own mission. All the missions have the follow the same concept, but in this tutorial I chose to customize my own lumberjack mission!
I first start with setting basic information (name & mission type):
After that, I start giving it some more advanced settings. I want my players to only gain progress from natural blocks spawning, I want the mission to be reset upon disbanding of an island, and I want them to be able to use the mission if they are above island level of 250.
Now, I will configure three important things:
The blocks that will be tracked (I am using 1.16 blocks).
Rewards for the mission
The icon of the mission that will be displayed in /is missions.
As you might have noticed, I used some built-in placeholders, such as {0} and {1}. {0} - Used as a percentage placeholder. {1} - Used as a placeholder for the amount of tracked blocks. {value_<block>} - Used as a placeholder for the amount of a specific tracked block. {percentage_<block>} - Used as a percentage placeholder for a specific block.
That's it! The mission is now setup and ready to be used. There are more settings that can be applied to all the missions:
required-missions
: A list of missions that must be completed before completion of the mission.
required-checks
: A list of checks which depend on placeholders that needs to be checked before completion of the mission.
only-show-if-required-completed
: Whether or not the mission should only be shown in menus when the required missions & checks are completed.
island
: Whether or not the mission should be an islands mission (mission that is synced with all island members). weight
: The order this mission will be displayed in the missions folder. Missions will be sorted by their weights, and if two missions have the same weight, they will be sorted by their names instead.
auto-reward
: Whether or not the plugin should reward the players without them doing it in the missions menu.
disband-reset
: Whether or not the mission should be reset when disbanding the island (used for player-missions).
leave-reset
: Whether or not the mission should be reset when leaving an island (used for player-missions).
reset-amount
: The amount of times a mission can be completed.
rewards.items
: A list of items that will be given to players when they complete the mission. rewards.commands
: A list of commands that will be executed when players complete the mission. icons.not-completed
: The item that will be shown in the menu when the mission is not completed. icons.can-complete
: The item that will be shown in the menu when the mission can be completed. icons.completed
: The item that will be shown in the menu when the mission is completed.
Create your own mission jar
In order to create your own missions jar, you must have knowledge in Java and the Spigot API. Mission jars are part of the SuperiorSkyblock's API, which can be found here. In this tutorial, I will make a chat-mission that counts the amount of times a player has written "Hello". First, I create a ChatMission object that extends the Mission object, and override all the methods.
As you can see, the Mission object needs an argument. This argument will be our data. The Mission object has a built-in system to organize all the data for us. In this tutorial, I can just use the Integer class. In more complicated missions, you might want to use your own custom object.
Now, we need to start implementing the default methods.
load()
- That's your "constructor" of the mission. It has two parameters: the plugin's instance, and the configurationsection of the mission. If something was not done correctly, and you want to cancel the loading of the mission - throw MissionLoadException with your error as a message.
getProgress()
- Calculates the progress of the player. Must return a number between 0 and 1. onComplete()
- A callback method that will be ran when a player completes a mission.
onCompleteFail()
- A callback method that will be ran when a player fails to complete a mission.
At this point, you can start listening to your events and alter the data when necessary. There's only one important thing to do, and it's to call the rewardMission() method. Furthermore, it's important to implement the saveProgress() and loadProgress() methods, so data will be saved on restarts.
The final product after adding a listener & registering it:
More complicated missions will require more data to be tracked and more listeners. Moreoever, I didn't implement the saveProgress() and loadProgress(), and didn't implement other useful methods that you might want to use. I recommend going through the Mission object before creating your own jar and see all the things it provides. If you want to see how the default mission jars are implemented, check out their github repository!
Last updated