forked from Upstream/mmocore
Basic support for OBTeam
This commit is contained in:
parent
77f543f347
commit
966cd333c1
@ -196,6 +196,13 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.civious</groupId>
|
||||||
|
<artifactId>OBTeam</artifactId>
|
||||||
|
<version>1.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alessiodp</groupId>
|
<groupId>com.alessiodp</groupId>
|
||||||
<artifactId>Parties</artifactId>
|
<artifactId>Parties</artifactId>
|
||||||
|
@ -12,6 +12,7 @@ public enum PartyModuleType {
|
|||||||
MCMMO("mcMMO", McMMOPartyModule::new),
|
MCMMO("mcMMO", McMMOPartyModule::new),
|
||||||
MMOCORE("MMOCore", MMOCorePartyModule::new),
|
MMOCORE("MMOCore", MMOCorePartyModule::new),
|
||||||
PARTIES("Parties", PartiesPartyModule::new),
|
PARTIES("Parties", PartiesPartyModule::new),
|
||||||
|
OBTEAM("OBTeam", OBTeamPartyModule::new),
|
||||||
PARTY_AND_FRIENDS("PartyAndFriends", PAFPartyModule::new),
|
PARTY_AND_FRIENDS("PartyAndFriends", PAFPartyModule::new),
|
||||||
PARTY_AND_FRIENDS_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyPartyModule::new),
|
PARTY_AND_FRIENDS_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyPartyModule::new),
|
||||||
;
|
;
|
||||||
|
@ -68,7 +68,7 @@ public class DungeonsXLPartyModule implements PartyModule, Listener {
|
|||||||
MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData()));
|
MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomParty implements AbstractParty, Listener {
|
class CustomParty implements AbstractParty {
|
||||||
private final PlayerGroup group;
|
private final PlayerGroup group;
|
||||||
|
|
||||||
public CustomParty(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()));
|
MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomParty implements AbstractParty, Listener {
|
class CustomParty implements AbstractParty {
|
||||||
private final Party party;
|
private final Party party;
|
||||||
|
|
||||||
public CustomParty(Party party) {
|
public CustomParty(Party party) {
|
||||||
this.party = party;
|
this.party = party;
|
||||||
Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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,7 @@ protect-custom-mine: false
|
|||||||
# - party_and_friends (Use this one if you are using Party and Friends Extended for Spigot)
|
# - 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)
|
# - 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
|
# - mcmmo
|
||||||
|
# - obteam (addon for DungeonMMO)
|
||||||
party-plugin: mmocore
|
party-plugin: mmocore
|
||||||
|
|
||||||
# Edit the plugin handling guilds here.
|
# Edit the plugin handling guilds here.
|
||||||
|
Loading…
Reference in New Issue
Block a user