mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-02-25 15:11:23 +01:00
support for mcmmo parties
This commit is contained in:
parent
8ad0880eea
commit
604bc2ff48
@ -1,6 +1,7 @@
|
|||||||
package net.Indyuce.mmocore.party;
|
package net.Indyuce.mmocore.party;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.party.compat.DungeonsPartyModule;
|
import net.Indyuce.mmocore.party.compat.DungeonsPartyModule;
|
||||||
|
import net.Indyuce.mmocore.party.compat.McMMOPartyModule;
|
||||||
import net.Indyuce.mmocore.party.compat.PAFPartyModule;
|
import net.Indyuce.mmocore.party.compat.PAFPartyModule;
|
||||||
import net.Indyuce.mmocore.party.compat.PartiesPartyModule;
|
import net.Indyuce.mmocore.party.compat.PartiesPartyModule;
|
||||||
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
|
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
|
||||||
@ -13,6 +14,7 @@ public enum PartyModuleType {
|
|||||||
MMOCORE("MMOCore", () -> new MMOCorePartyModule()),
|
MMOCORE("MMOCore", () -> new MMOCorePartyModule()),
|
||||||
PARTY_AND_FRIENDS("PartyAndFriends", () -> new PAFPartyModule()),
|
PARTY_AND_FRIENDS("PartyAndFriends", () -> new PAFPartyModule()),
|
||||||
PARTIES("Parties", () -> new PartiesPartyModule()),
|
PARTIES("Parties", () -> new PartiesPartyModule()),
|
||||||
|
MCMMO("mcMMO", () -> new McMMOPartyModule()),
|
||||||
// DUNGEONS("Dungeons", null),
|
// DUNGEONS("Dungeons", null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -49,5 +49,4 @@ public class DungeonsPartyModule implements PartyModule {
|
|||||||
return group.getMembers().getUniqueIds().size();
|
return group.getMembers().getUniqueIds().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
package net.Indyuce.mmocore.party.compat;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.party.AbstractParty;
|
||||||
|
import net.Indyuce.mmocore.party.PartyModule;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class McMMOPartyModule implements PartyModule {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public AbstractParty getParty(PlayerData playerData) {
|
||||||
|
McMMOPlayer extPlayerData = UserManager.getPlayer(playerData.getPlayer());
|
||||||
|
Party party = extPlayerData == null ? null : extPlayerData.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) {
|
||||||
|
return party.hasMember(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlayerData> getOnlineMembers() {
|
||||||
|
List<PlayerData> list = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Player online : party.getOnlineMembers())
|
||||||
|
list.add(PlayerData.get(online.getUniqueId()));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countMembers() {
|
||||||
|
return party.getMembers().size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user