-
Notifications
You must be signed in to change notification settings - Fork 2
/
QuestObservationObjective.java
37 lines (30 loc) · 1.13 KB
/
QuestObservationObjective.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package edu.whimc.observations.models;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.module.BukkitCustomObjective;
import me.pikamug.quests.Quests;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.Plugin;
/**
* A custom observation objective using the Quest plugin.
*/
public class QuestObservationObjective extends BukkitCustomObjective {
public QuestObservationObjective() {
this.setName("Observation Objective");
this.setAuthor("WHIMC");
this.setShowCount(true);
this.setCountPrompt("Enter the number of observations the player must make:");
this.setDisplay("Make %count% observations");
}
@EventHandler
public void onObserve(ObserveEvent event) {
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("Quests");
if (plugin == null) {
return;
}
Quests quests = (Quests) plugin;
for (Quest quest : quests.getQuester(event.getPlayer().getUniqueId()).getCurrentQuests().keySet()) {
incrementObjective(event.getPlayer(), this, 1, quest);
}
}
}