Add basic support for Parties, untested

This commit is contained in:
BuildTools 2019-01-05 16:42:57 -05:00
parent 2c899bb5ae
commit 665a0fb2fb
8 changed files with 66 additions and 3 deletions

BIN
lib/Parties-2.4.6.jar Normal file

Binary file not shown.

10
pom.xml
View File

@ -37,6 +37,10 @@
<id>Vault</id>
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
@ -193,6 +197,12 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/GPSAPI.jar</systemPath>
</dependency>
<dependency>
<groupId>com.github.AlessioDP.Parties</groupId>
<artifactId>parties-api</artifactId>
<version>2.4.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@ -16,6 +16,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -26,6 +27,7 @@ import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import com.alessiodp.parties.api.interfaces.Party;
import com.codisimus.plugins.phatloots.PhatLootsAPI;
import com.codisimus.plugins.phatloots.loot.CommandLoot;
import com.codisimus.plugins.phatloots.loot.LootBundle;
@ -682,6 +684,14 @@ public class Quest {
Quests.gpsapi.stopGPS(player);
}
}
if (Quests.parties != null) {
Party party = Quests.parties.getParty(Quests.parties.getPartyPlayer(q.getUUID()).getPartyName());
for (UUID id : party.getMembers()) {
if (q.getCurrentQuests().containsKey(this)) {
completeQuest(plugin.getQuester(id));
}
}
}
q.findCompassTarget();
}

View File

@ -79,6 +79,8 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.alessiodp.parties.api.Parties;
import com.alessiodp.parties.api.interfaces.PartiesAPI;
import com.codisimus.plugins.phatloots.PhatLoots;
import com.codisimus.plugins.phatloots.PhatLootsAPI;
import com.gmail.nossr50.mcMMO;
@ -130,6 +132,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public static CitizensPlugin citizens;
public static Denizen denizen = null;
public static CitizensBooksAPI citizensBooks = null;
public static PartiesAPI parties = null;
// Config settings
public int acceptTimeout = 20;
public boolean allowCommands = true;
@ -446,6 +449,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
if (isPluginReady("CitizensBooks")) {
citizensBooks = ((CitizensBooksPlugin) getServer().getPluginManager().getPlugin("CitizensBooks")).getAPI();
}
if (isPluginReady("Parties")) {
parties = Parties.getApi();
}
if (isPluginReady("Vault")) {
if (!setupEconomy()) {

View File

@ -0,0 +1,36 @@
package me.blackvein.quests.listeners;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.alessiodp.parties.api.events.bukkit.party.BukkitPartiesPartyPostCreateEvent;
import com.alessiodp.parties.api.events.bukkit.party.BukkitPartiesPartyPostDeleteEvent;
import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostJoinEvent;
import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostLeaveEvent;
public class PartiesListener implements Listener {
//TODO add configurable strings
@EventHandler
public void onPartyCreate(BukkitPartiesPartyPostCreateEvent event) {
Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID()).sendMessage("Players added to this party may perform quests together!");
}
@EventHandler
public void onPartyDeleteEvent(BukkitPartiesPartyPostDeleteEvent event) {
Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID()).sendMessage("The quest party was disbanded.");
}
@EventHandler
public void onPlayerJoinEvent(BukkitPartiesPlayerPostJoinEvent event) {
Bukkit.getServer().getPlayer(event.getInviter()).sendMessage(event.getPartyPlayer().getName() + " can now perform quests with you!");
Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()).sendMessage("You can now perform quests with " + event.getParty().getName());
}
@EventHandler
public void onPlayerLeaveEvent(BukkitPartiesPlayerPostLeaveEvent event) {
Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID()).sendMessage(event.getPartyPlayer().getName() + " can no longer perform quests with you.");
Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()).sendMessage("You can no longer perform quests with " + event.getParty().getName());
}
}

View File

@ -13,7 +13,8 @@
package me.blackvein.quests.util;
public class CK {
// Temporary data storage for prompts and factories
public static final String ED_QUEST_EDIT = "edit";
public static final String ED_QUEST_DELETE = "delQuest";
public static final String ED_EVENT_DELETE = "delEvent";

View File

@ -49,7 +49,7 @@ public class ItemUtil {
* -3 if stack durability is unequal<br>
* -4 if stack display name/lore is unequal<br>
* -5 if stack enchantments are unequal<br>
* -6 if stack stored enchants are unequal
* -6 if stack stored enchants are unequal<br>
* -7 if stack item flags are unequal
*/
@SuppressWarnings("deprecation")

View File

@ -6,7 +6,7 @@ description: An extensive questing system.
website: https://www.spigotmc.org/resources/quests.3711/
dev-url: https://github.com/FlyingPikachu/Quests
author: HappyPikachu
softdepend: [Citizens, CitizensBooks, Denizen, GPS, Heroes, mcMMO, PhatLoots, PlaceholderAPI, Vault, WorldGuard]
softdepend: [Citizens, CitizensBooks, Denizen, GPS, Heroes, mcMMO, Parties, PhatLoots, PlaceholderAPI, Vault, WorldGuard]
permissions:
quests.quest:
description: View current quest objectives