diff --git a/MMOCore-API/pom.xml b/MMOCore-API/pom.xml index 26f77a47..e06a0583 100644 --- a/MMOCore-API/pom.xml +++ b/MMOCore-API/pom.xml @@ -203,6 +203,13 @@ provided + + net.playavalon + DungeonParties + 1.0 + provided + + com.alessiodp Parties diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java index bf93487f..abfbc663 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java @@ -12,6 +12,7 @@ public enum PartyModuleType { MCMMO("mcMMO", McMMOPartyModule::new), MMOCORE("MMOCore", MMOCorePartyModule::new), PARTIES("Parties", PartiesPartyModule::new), + MYTHICDUNGEONS("MythicDungeons", DungeonPartiesPartyModule::new), OBTEAM("OBTeam", OBTeamPartyModule::new), PARTY_AND_FRIENDS("PartyAndFriends", PAFPartyModule::new), PARTY_AND_FRIENDS_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyPartyModule::new), diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/DungeonPartiesPartyModule.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/DungeonPartiesPartyModule.java new file mode 100644 index 00000000..9b1f34d9 --- /dev/null +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/DungeonPartiesPartyModule.java @@ -0,0 +1,57 @@ +package net.Indyuce.mmocore.party.compat; + +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.party.AbstractParty; +import net.Indyuce.mmocore.party.PartyModule; +import net.playavalon.avnparty.AvNParty; +import net.playavalon.avnparty.party.Party; +import net.playavalon.avnparty.player.AvalonPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class DungeonPartiesPartyModule implements PartyModule, Listener { + + @Nullable + @Override + public AbstractParty getParty(PlayerData playerData) { + final @Nullable Party party = AvNParty.plugin.players.get(playerData.getPlayer()).getParty(); + return party == null ? null : new CustomParty(party); + } + + class CustomParty implements AbstractParty { + private final Party party; + + public CustomParty(Party party) { + this.party = party; + } + + @Override + public boolean hasMember(Player player) { + for (AvalonPlayer member : party.getPlayers()) + if (member.getPlayer().getUniqueId().equals(player.getUniqueId())) return true; + return false; + } + + @Override + public List getOnlineMembers() { + final List list = new ArrayList<>(); + + for (AvalonPlayer member : party.getPlayers()) + try { + list.add(PlayerData.get(member.getPlayer().getUniqueId())); + } catch (Exception ignored) { + } + + return list; + } + + @Override + public int countMembers() { + return party.getPlayers().size(); + } + } +} diff --git a/MMOCore-Dist/src/main/resources/plugin.yml b/MMOCore-Dist/src/main/resources/plugin.yml index 152a94ca..0b937b09 100644 --- a/MMOCore-Dist/src/main/resources/plugin.yml +++ b/MMOCore-Dist/src/main/resources/plugin.yml @@ -3,9 +3,9 @@ version: ${project.version} main: net.Indyuce.mmocore.MMOCore author: Indyuce description: ${project.description} -loadbefore: [ MMOItems ] +loadbefore: [ MMOItems,MythicDungeons ] depend: [ MythicLib ] -softdepend: [ Vault,MythicMobs,PlaceholderAPI,Residence,Citizens,ProtocolLib ] +softdepend: [ Vault,MythicMobs,PlaceholderAPI,Residence,Citizens,ProtocolLib,OBTeam ] api-version: 1.13 commands: mmocore: