API usage - LeonidMem/DialogsM-Wiki GitHub Wiki
-
DialogsPreReloadEvent
- calls when dialogs' files are going to be loaded. -
DialogsReloadEvent
- calls when dialogs' files were loaded. -
DialogLoadEvent
- calls when a dialog was loaded from the map.-
getDialogName()
- returns loaded dialog's file name. -
getMap()
- returns immutable map from which the dialog was loaded.
-
-
DialogPreOpenEvent
(cancellable) - calls before a dialog was opened to the player.-
getDialogName()
- returns dialog's file name. -
getPlayer()
- returns the player who opened the dialog.
-
-
DialogOpenEvent
- calls when a dialog was opened to the player.-
getDialogName()
- returns dialog's file name. -
getPlayer()
- returns the player who opened the dialog.
-
-
DialogAddEvent
- calls when a dialog was added as read to the player.-
getDialogName()
- returns dialog's file name. -
getOfflinePlayer()
- returns the OfflinePlayer to whom the dialog was added.
-
-
DialogRemoveEvent
- calls when a dialog was removed as read to the player.-
getDialogName()
- returns dialog's file name. -
getOfflinePlayer()
- returns the OfflinePlayer from whom the dialog was removed.
-
-
QuestsPreReloadEvent
- calls when quests' files are going to be loaded. -
QuestsReloadEvent
- calls when quests' files were loaded. -
QuestLoadEvent
- calls when a quest was loaded from the map.-
getQuestName()
- returns loaded quest's file name. -
getMap()
- returns immutable map from which the quest was loaded.
-
-
QuestStartEvent
- calls when a quest was added as a quest in progress to the player.-
getQuestName()
- returns quest's file name. -
getPlayer()
- returns the player to whom the quest was added.
-
-
QuestPreCompleteEvent
(cancellable) - calls before a quest was added as completed to the player.-
getQuestName()
- returns quest's file name. -
getOfflinePlayer()
- returns the OfflinePlayer to whom the quest was added.
-
-
QuestCompleteEvent
- calls when a quest was added as completed to the player.-
getQuestName()
- returns quest's file name. -
getOfflinePlayer()
- returns the OfflinePlayer to whom the quest was added.
-
-
QuestRemoveEvent
- calls when a quest was removed as completed or as a quest in progress from the player.-
getQuestName()
- returns quest's file name. -
getOfflinePlayer()
- returns the OfflinePlayer from whom the quest was removed.
-
-
NPCsPreReloadEvent
- calls when NPCs' files are going to be loaded. -
NPCsReloadEvent
- calls when NPCs' files were loaded. -
NPCLoadEvent
- calls when NPC was loaded from the map.-
getNpcName()
- returns loaded NPC's file name. -
getNpcUUID()
- returns attached entity's uuid. -
getMap()
- returns immutable map from which the NPC was loaded.
-
-
DialogsConfigReloadEvent
- calls whenDialogsM
's config was reloaded.
All methods below return true
the if player has a dialog or a quest in needed stage, false
if not or value of outIfExceptionOccurred
if something went wrong.
isDialogRead(Player player, String dialogName, boolean outIfExceptionOccurred)
isQuestInProgress(Player player, String dialogName, boolean outIfExceptionOccurred)
isQuestCompleted(Player player, String dialogName, boolean outIfExceptionOccurred)
All methods below return list of names which player has in needed stage or value of outIfExceptionOccurred
if something went wrong.
getReadDialogsNames(Player player, List<String> outIfExceptionOccurred)
getQuestsInProgressNames(Player player, List<String> outIfExceptionOccurred)
getCompletedQuestsNames(Player player, List<String> outIfExceptionOccurred)
addDialog(OfflinePlayer player, String dialogName)
removeDialog(OfflinePlayer player, String dialogName)
startQuest(OfflinePlayer player, String dialogName)
addQuest(OfflinePlayer player, String dialogName)
removeQuest(OfflinePlayer player, String dialogName)
canQuestBeCompleted(Player player, String questName)
canDialogBeRead(Player player, String questName)
isEntityNPC(UUID uuid)
loadDialogFromMap(String fileName, Map<String, Object> map)
loadQuestFromMap(String fileName, Map<String, Object> map)
loadNPCFromMap(String fileName, Map<String, Object> map)
You can use decorators to create your own conditions for the quests and dialogs. Just implement needed interface: DialogDecorator
or QuestDecorator
(overriden methods must return true
if all conditions fit or false
if not) and register it using methods below.
registerDecorator(DialogDecorator dialogDecorator)
registerDecorator(QuestDecorator questDecorator)