mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-23 01:27:35 +01:00
Merge pull request #466 from nicuch/master
Added compability with CitizensBooks.
This commit is contained in:
commit
e8e6bec085
10
pom.xml
10
pom.xml
@ -37,6 +37,10 @@
|
||||
<id>Vault</id>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citizensbooks_repo</id>
|
||||
<url>https://raw.github.com/nicuch/maven_repo/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -172,6 +176,12 @@
|
||||
<version>2.8.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ro.nicuch</groupId>
|
||||
<artifactId>CitizensBooks</artifactId>
|
||||
<version>2.4.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -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;
|
||||
@ -175,6 +176,9 @@ public class Event {
|
||||
return false;
|
||||
} else if (other.teleport == null && teleport != null) {
|
||||
return false;
|
||||
}
|
||||
if (other.book != book) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -246,6 +250,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);
|
||||
@ -314,6 +323,9 @@ public class Event {
|
||||
event.name = name;
|
||||
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")) {
|
||||
|
@ -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;
|
||||
@ -411,6 +414,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.");
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user