public abstract class Mission<V>
extends java.lang.Object
Constructor and Description |
---|
Mission() |
Modifier and Type | Method and Description |
---|---|
void |
addRequiredCheck(java.lang.String... checks)
Add required check for completing this mission.
|
void |
addRequiredMission(java.lang.String... missions)
Add required missions for completing this mission.
|
boolean |
canComplete(SuperiorPlayer superiorPlayer)
Check whether or not a player can complete the mission.
|
void |
clearData(SuperiorPlayer superiorPlayer)
A function that is called in order to clear progress of a player.
|
protected java.util.Set<java.util.Map.Entry<SuperiorPlayer,V>> |
entrySet()
Get the entry set of the data map.
|
boolean |
equals(java.lang.Object o) |
void |
formatItem(SuperiorPlayer superiorPlayer,
org.bukkit.inventory.ItemStack itemStack)
A function that is called on every item of the menu.
|
protected V |
get(SuperiorPlayer superiorPlayer)
Get data for a player.
|
protected SuperiorPlayer |
getDataKey(SuperiorPlayer superiorPlayer)
Get they data-key for the provided player.
|
boolean |
getIslandMission()
Get the island-mission of the mission.
|
MissionCategory |
getMissionCategory()
Get the category of the mission.
|
java.lang.String |
getName()
Get the name of the mission.
|
protected V |
getOrCreate(SuperiorPlayer superiorPlayer,
java.util.function.Function<SuperiorPlayer,? extends V> createFunction)
Get or create data for a player.
|
abstract double |
getProgress(SuperiorPlayer superiorPlayer)
Get the progress of a specific player.
|
int |
getProgressValue(SuperiorPlayer superiorPlayer)
Get the progress value of a specific player.
|
java.util.List<java.lang.String> |
getRequiredChecks()
Get the required checks for completing this mission.
|
java.util.List<java.lang.String> |
getRequiredMissions()
Get the required missions for completing this mission.
|
int |
hashCode() |
protected void |
insertData(SuperiorPlayer superiorPlayer,
V value)
Insert data to the mission data.
|
boolean |
isOnlyShowIfRequiredCompleted()
Check whether or not the item in the gui should be shown only
if all required missions are completed.
|
abstract void |
load(org.bukkit.plugin.java.JavaPlugin plugin,
org.bukkit.configuration.ConfigurationSection missionSection)
The load function of the mission.
|
void |
loadProgress(org.bukkit.configuration.ConfigurationSection section)
Load mission's progress.
|
abstract void |
onComplete(SuperiorPlayer superiorPlayer)
A function that is called when a player is completing the mission.
|
abstract void |
onCompleteFail(SuperiorPlayer superiorPlayer)
A function that is called when a player cannot complete the mission.
|
void |
saveProgress(org.bukkit.configuration.ConfigurationSection section)
Save mission's progress.
|
void |
setClearMethod(java.util.function.Consumer<V> clearMethod)
Set the clear method for the data object.
|
void |
setIslandMission(boolean islandMission)
Set whether or not this mission is an island mission or not.
|
void |
setMissionCategory(MissionCategory missionCategory)
Set the category of the mission.
|
void |
setName(java.lang.String name)
Set the name of the mission.
|
void |
toggleOnlyShowIfRequiredCompleted()
Toggle the onlyShowIfRequiredCompleted flag.
|
java.lang.String |
toString() |
void |
transferData(SuperiorPlayer oldPlayer,
SuperiorPlayer newPlayer)
A function that is called when islands are transferred.
|
public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name to set.public MissionCategory getMissionCategory()
public void setMissionCategory(MissionCategory missionCategory)
missionCategory
- The category to set.public boolean getIslandMission()
public void setIslandMission(boolean islandMission)
islandMission
- The island-mission status.public void setClearMethod(@Nullable java.util.function.Consumer<V> clearMethod)
public void addRequiredMission(java.lang.String... missions)
missions
- The array of required missions.public void addRequiredCheck(java.lang.String... checks)
checks
- The array of required missions.public java.util.List<java.lang.String> getRequiredMissions()
public java.util.List<java.lang.String> getRequiredChecks()
public void toggleOnlyShowIfRequiredCompleted()
public boolean isOnlyShowIfRequiredCompleted()
public abstract void load(org.bukkit.plugin.java.JavaPlugin plugin, org.bukkit.configuration.ConfigurationSection missionSection) throws MissionLoadException
plugin
- The plugin that loaded the mission (The SuperiorSkyblock's JavaPlugin class)missionSection
- The configuration section of the mission from the configMissionLoadException
- if load was not success.public abstract double getProgress(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player to check.public int getProgressValue(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player to check.public boolean canComplete(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player to check.public void saveProgress(org.bukkit.configuration.ConfigurationSection section)
section
- The mission's section in the config.public void loadProgress(org.bukkit.configuration.ConfigurationSection section)
section
- The mission's section in the config.public abstract void onComplete(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player that completed the mission.public abstract void onCompleteFail(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player that tried to complete the mission.public void clearData(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player to clear the data of.public void transferData(SuperiorPlayer oldPlayer, SuperiorPlayer newPlayer)
oldPlayer
- The old owner of the player.newPlayer
- The new owner of the player.@Nullable protected SuperiorPlayer getDataKey(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player to check.protected void insertData(SuperiorPlayer superiorPlayer, V value)
superiorPlayer
- The player to change it's data.value
- The data to insert.@Nullable protected V getOrCreate(SuperiorPlayer superiorPlayer, java.util.function.Function<SuperiorPlayer,? extends V> createFunction)
superiorPlayer
- The player to get data from.createFunction
- The function that will be run when data doesn't exist yet.@Nullable protected V get(SuperiorPlayer superiorPlayer)
superiorPlayer
- The player to get data from.protected java.util.Set<java.util.Map.Entry<SuperiorPlayer,V>> entrySet()
public void formatItem(SuperiorPlayer superiorPlayer, org.bukkit.inventory.ItemStack itemStack)
superiorPlayer
- The player that opens the menu.itemStack
- The item of the mission.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object