diff --git a/pom.xml b/pom.xml
index cba1f1b74..7e3189200 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,6 +37,10 @@
Vault
http://nexus.hc.to/content/repositories/pub_releases/
+
+ citizensbooks_repo
+ https://raw.github.com/nicuch/maven_repo/
+
@@ -172,6 +176,12 @@
2.8.2
provided
+
+ ro.nicuch
+ CitizensBooks
+ 2.4.4
+ provided
+
diff --git a/src/main/java/me/blackvein/quests/Event.java b/src/main/java/me/blackvein/quests/Event.java
index 6bcc98bd5..10c024063 100644
--- a/src/main/java/me/blackvein/quests/Event.java
+++ b/src/main/java/me/blackvein/quests/Event.java
@@ -79,6 +79,7 @@ public class Event {
int saturation = -1;
float health = -1;
Location teleport;
+ String book = "";
public Event(final Quests plugin) {
this.plugin = plugin;
@@ -176,6 +177,9 @@ public class Event {
} else if (other.teleport == null && teleport != null) {
return false;
}
+ if (other.book != book) {
+ return false;
+ }
}
return true;
}
@@ -247,6 +251,11 @@ public class Event {
if (teleport != null) {
player.teleport(teleport);
}
+ if (!(book == null && book.isEmpty() && plugin.citizensBooks == null)) {
+ if (plugin.citizensBooks.hasFilter(book)) {
+ plugin.citizensBooks.openBook(player, plugin.citizensBooks.getFilter(book));
+ }
+ }
if (failQuest == true) {
quest.failQuest(quester);
}
@@ -315,6 +324,9 @@ public class Event {
if (data.contains(eventKey + "message")) {
event.message = Quests.parseString(data.getString(eventKey + "message"));
}
+ if (data.contains(eventKey + "open-book")) {
+ event.book = data.getString(eventKey + "open-book");
+ }
if (data.contains(eventKey + "clear-inventory")) {
if (data.isBoolean(eventKey + "clear-inventory")) {
event.clearInv = data.getBoolean(eventKey + "clear-inventory");
diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java
index 8da519135..a3b006405 100644
--- a/src/main/java/me/blackvein/quests/Quests.java
+++ b/src/main/java/me/blackvein/quests/Quests.java
@@ -104,6 +104,8 @@ import net.citizensnpcs.api.npc.NPC;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
+import ro.nicuch.citizensbooks.CitizensBooksAPI;
+import ro.nicuch.citizensbooks.CitizensBooksPlugin;
public class Quests extends JavaPlugin implements ConversationAbandonedListener {
@@ -118,6 +120,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public static Vault vault = null;
public static CitizensPlugin citizens;
public static Denizen denizen = null;
+ public static CitizensBooksAPI citizensBooks;
// Config settings
public int acceptTimeout = 20;
public boolean allowCommands = true;
@@ -412,6 +415,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
placeholder = (PlaceholderAPIPlugin) getServer().getPluginManager().getPlugin("PlaceholderAPI");
}
+ if (getServer().getPluginManager().getPlugin("CitizensBooks") != null) {
+ citizensBooks = ((CitizensBooksPlugin) getServer().getPluginManager().getPlugin("CitizensBooks")).getAPI();
+ }
if (!setupEconomy()) {
getLogger().warning("Economy not found.");
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 360e8f6c3..82f38fb96 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -6,7 +6,7 @@ website: https://www.spigotmc.org/resources/quests.3711/
dev-url: https://github.com/FlyingPikachu/Quests
author: HappyPikachu
depend: [Vault]
-softdepend: [Citizens, PhatLoots, PlaceholderAPI]
+softdepend: [Citizens, PhatLoots, PlaceholderAPI, CitizensBooks]
permissions:
quests.quest:
description: View current Quest objectives