mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-23 00:31:36 +01:00
Add DungeonsXL group support, untested
This commit is contained in:
parent
4b082d55f8
commit
8957c68bdf
@ -113,6 +113,11 @@
|
||||
<artifactId>GPS</artifactId>
|
||||
<version>-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.DRE2N</groupId>
|
||||
<artifactId>DungeonsXL</artifactId>
|
||||
<version>-6523caa908-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.AlessioDP.Parties</groupId>
|
||||
<artifactId>parties-api</artifactId>
|
||||
|
@ -19,6 +19,8 @@ import com.herocraftonline.heroes.Heroes;
|
||||
import com.live.bemmamin.gps.Vars;
|
||||
import com.live.bemmamin.gps.api.GPSAPI;
|
||||
|
||||
import de.erethon.dungeonsxl.DungeonsXL;
|
||||
|
||||
public class Dependencies {
|
||||
|
||||
private Quests plugin;
|
||||
@ -33,6 +35,7 @@ public class Dependencies {
|
||||
private static CitizensPlugin citizens;
|
||||
private static Denizen denizen = null;
|
||||
private static CitizensBooksAPI citizensBooks = null;
|
||||
private static DungeonsXL dungeons = null;
|
||||
private static PartiesAPI parties = null;
|
||||
|
||||
public Dependencies(Quests plugin) {
|
||||
@ -83,6 +86,10 @@ public class Dependencies {
|
||||
return citizensBooks;
|
||||
}
|
||||
|
||||
public DungeonsXL getDungeonsApi() {
|
||||
return dungeons;
|
||||
}
|
||||
|
||||
public PartiesAPI getPartiesApi() {
|
||||
return parties;
|
||||
}
|
||||
@ -130,6 +137,9 @@ public class Dependencies {
|
||||
}
|
||||
if (isPluginAvailable("CitizensBooks")) {
|
||||
citizensBooks = ((CitizensBooksPlugin) plugin.getServer().getPluginManager().getPlugin("CitizensBooks")).getAPI();
|
||||
}
|
||||
if (isPluginAvailable("DungeonsXL")) {
|
||||
dungeons = DungeonsXL.getInstance();
|
||||
}
|
||||
if (isPluginAvailable("Parties")) {
|
||||
parties = Parties.getApi();
|
||||
|
@ -37,6 +37,7 @@ import com.herocraftonline.heroes.characters.Hero;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
import de.erethon.dungeonsxl.player.DGroup;
|
||||
import me.blackvein.quests.exceptions.InvalidStageException;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -181,6 +182,19 @@ public class Quest {
|
||||
plugin.getLogger().info("Quest \'" + name + "\' was completed by party " + party.getName() + " (" + party.getMembers().size() + " members)");
|
||||
}
|
||||
}
|
||||
if (plugin.getDependencies().getDungeonsApi() != null) {
|
||||
DGroup group = DGroup.getByPlayer(q.getPlayer());
|
||||
if (group != null) {
|
||||
for (UUID id : group.getPlayers().getUniqueIds()) {
|
||||
if (!id.equals(q.getUUID())) {
|
||||
if (plugin.getQuester(id).getCurrentQuests().containsKey(this)) {
|
||||
completeQuest(plugin.getQuester(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getLogger().info("Quest \'" + name + "\' was completed by group " + group.getName() + " (" + group.getPlayers().size() + " players)");
|
||||
}
|
||||
}
|
||||
completeQuest(q);
|
||||
} else {
|
||||
try {
|
||||
|
@ -84,6 +84,7 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
import me.blackvein.quests.listeners.CmdExecutor;
|
||||
import me.blackvein.quests.listeners.DungeonsListener;
|
||||
import me.blackvein.quests.listeners.NpcListener;
|
||||
import me.blackvein.quests.listeners.PartiesListener;
|
||||
import me.blackvein.quests.listeners.PlayerListener;
|
||||
@ -118,6 +119,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
private PlayerListener playerListener;
|
||||
private NpcListener npcListener;
|
||||
private NpcEffectThread effThread;
|
||||
private DungeonsListener dungeonsListener;
|
||||
private PartiesListener partiesListener;
|
||||
private DenizenTrigger trigger;
|
||||
private Lang lang;
|
||||
@ -140,6 +142,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
playerListener = new PlayerListener(this);
|
||||
effThread = new NpcEffectThread(this);
|
||||
npcListener = new NpcListener(this);
|
||||
dungeonsListener = new DungeonsListener();
|
||||
partiesListener = new PartiesListener();
|
||||
questFactory = new QuestFactory(this);
|
||||
eventFactory = new EventFactory(this);
|
||||
@ -196,6 +199,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, effThread, 20, 20);
|
||||
}
|
||||
}
|
||||
if (depends.getDungeonsApi() != null) {
|
||||
getServer().getPluginManager().registerEvents(dungeonsListener, this);
|
||||
}
|
||||
if (depends.getPartiesApi() != null) {
|
||||
getServer().getPluginManager().registerEvents(partiesListener, this);
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package me.blackvein.quests.listeners;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import de.erethon.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||
import de.erethon.dungeonsxl.event.dgroup.DGroupDisbandEvent;
|
||||
import de.erethon.dungeonsxl.event.dplayer.DPlayerJoinDGroupEvent;
|
||||
import de.erethon.dungeonsxl.event.dplayer.DPlayerLeaveDGroupEvent;
|
||||
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
public class DungeonsListener implements Listener {
|
||||
@EventHandler
|
||||
public void onGroupCreate(DGroupCreateEvent event) {
|
||||
event.getCreator().sendMessage(ChatColor.YELLOW + Lang.get("questDungeonsCreate"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGroupDisbandEvent(DGroupDisbandEvent event) {
|
||||
event.getDisbander().sendMessage(ChatColor.RED + Lang.get("questDungeonsDisband"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoinEvent(DPlayerJoinDGroupEvent event) {
|
||||
Player i = event.getDGroup().getCaptain();
|
||||
Player p = event.getDPlayer().getPlayer();
|
||||
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questDungeonsInvite").replace("<player>", p.getName()));
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questDungeonsJoin").replace("<player>", i.getName()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeaveEvent(DPlayerLeaveDGroupEvent event) {
|
||||
Player k = event.getDGroup().getCaptain();
|
||||
Player p = event.getDPlayer().getPlayer();
|
||||
k.sendMessage(ChatColor.RED + Lang.get(k, "questDungeonsKicked").replace("<player>", k.getName()));
|
||||
p.sendMessage(ChatColor.RED + Lang.get(p, "questDungeonsLeave").replace("<player>", p.getName()));
|
||||
}
|
||||
}
|
@ -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, Parties, PhatLoots, PlaceholderAPI, Vault, WorldGuard]
|
||||
softdepend: [Citizens, CitizensBooks, Denizen, DungeonsXL, GPS, Heroes, mcMMO, Parties, PhatLoots, PlaceholderAPI, Vault, WorldGuard]
|
||||
permissions:
|
||||
quests.quest:
|
||||
description: View current quest objectives
|
||||
|
@ -73,6 +73,12 @@ questEditorEnterNPCStart: "Enter NPC ID, <clear>, <cancel>"
|
||||
questEditorEnterBlockStart: "Right-click on a block to use as a start point, <done>, <clear>, <cancel>"
|
||||
questEditorEnterInitialEvent: "Enter an Event name, <clear>, <cancel>"
|
||||
questRequiredNoneSet: "Required, none set"
|
||||
questDungeonsCreate: "Players added to this group may perform quests together!"
|
||||
questDungeonsDisband: "The quest group was disbanded."
|
||||
questDungeonsInvite: "<player> can now perform quests with you!"
|
||||
questDungeonsJoin: "You can now perform quests with Captain <player>."
|
||||
questDungeonsKicked: "<player> can no longer perform quests with you."
|
||||
questDungeonsLeave: "You can no longer perform quests with Captain <player>."
|
||||
questPartiesCreate: "Players added to this party may perform quests together!"
|
||||
questPartiesDelete: "The quest party was disbanded."
|
||||
questPartiesInvite: "<player> can now perform quests with you!"
|
||||
|
Loading…
Reference in New Issue
Block a user