forked from Upstream/mmocore
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
79b007f144
@ -196,6 +196,20 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.civious</groupId>
|
||||
<artifactId>OBTeam</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.playavalon</groupId>
|
||||
<artifactId>DungeonParties</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alessiodp</groupId>
|
||||
<artifactId>Parties</artifactId>
|
||||
|
@ -12,6 +12,8 @@ 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),
|
||||
;
|
||||
|
@ -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<PlayerData> getOnlineMembers() {
|
||||
final List<PlayerData> 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();
|
||||
}
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class DungeonsXLPartyModule implements PartyModule, Listener {
|
||||
MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData()));
|
||||
}
|
||||
|
||||
class CustomParty implements AbstractParty, Listener {
|
||||
class CustomParty implements AbstractParty {
|
||||
private final PlayerGroup group;
|
||||
|
||||
public CustomParty(PlayerGroup group) {
|
||||
|
@ -74,12 +74,11 @@ public class McMMOPartyModule implements PartyModule, Listener {
|
||||
MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData()));
|
||||
}
|
||||
|
||||
class CustomParty implements AbstractParty, Listener {
|
||||
class CustomParty implements AbstractParty {
|
||||
private final Party party;
|
||||
|
||||
public CustomParty(Party party) {
|
||||
this.party = party;
|
||||
Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,59 @@
|
||||
package net.Indyuce.mmocore.party.compat;
|
||||
|
||||
import com.civious.obteam.mechanics.Team;
|
||||
import com.civious.obteam.mechanics.TeamManager;
|
||||
import com.civious.obteam.mechanics.TeamMember;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.party.AbstractParty;
|
||||
import net.Indyuce.mmocore.party.PartyModule;
|
||||
import org.bukkit.Bukkit;
|
||||
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 OBTeamPartyModule implements PartyModule, Listener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AbstractParty getParty(PlayerData playerData) {
|
||||
final @Nullable Team team = TeamManager.getInstance().getTeam(playerData.getPlayer());
|
||||
return team == null ? null : new CustomParty(team);
|
||||
}
|
||||
|
||||
class CustomParty implements AbstractParty {
|
||||
private final Team team;
|
||||
|
||||
public CustomParty(Team team) {
|
||||
this.team = team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMember(Player player) {
|
||||
for (TeamMember member : team.getMembers())
|
||||
if (member.getOfflinePlayer().getUniqueId().equals(player.getUniqueId())) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlayerData> getOnlineMembers() {
|
||||
final List<PlayerData> list = new ArrayList<>();
|
||||
|
||||
for (TeamMember member : team.getMembersAndOwner())
|
||||
try {
|
||||
list.add(PlayerData.get(member.getOfflinePlayer().getUniqueId()));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countMembers() {
|
||||
return team.getMembersAndOwner().size();
|
||||
}
|
||||
}
|
||||
}
|
@ -60,6 +60,8 @@ protect-custom-mine: false
|
||||
# - party_and_friends (Use this one if you are using Party and Friends Extended for Spigot)
|
||||
# - party_and_friends_bungeecord_velocity (Use this one if you are using Party and Friends For Bungeecord, Party and Friends For Velocity or Party and Friends Extended Edition for Bungeecord/Velocity. This one requires https://www.spigotmc.org/resources/spigot-party-api-for-party-and-friends.39751/ to be installed)
|
||||
# - mcmmo
|
||||
# - obteam (addon for DungeonMMO)
|
||||
# - mythicdungeons (only when using default party handler)
|
||||
party-plugin: mmocore
|
||||
|
||||
# Edit the plugin handling guilds here.
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user