mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-30 01:13:38 +01:00
Support for more guild/party plugins
This commit is contained in:
parent
87ffe8e621
commit
db90693676
14
pom.xml
14
pom.xml
@ -208,6 +208,13 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.denizen</groupId>
|
||||||
|
<artifactId>Dungeons</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Guild plugins -->
|
<!-- Guild plugins -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.massivecraft</groupId>
|
<groupId>com.massivecraft</groupId>
|
||||||
@ -230,6 +237,13 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.kingdoms.main</groupId>
|
||||||
|
<artifactId>Kingdoms</artifactId>
|
||||||
|
<version>1.11.15.0.0.0.1.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Quest plugins -->
|
<!-- Quest plugins -->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
package net.Indyuce.mmocore.guild;
|
package net.Indyuce.mmocore.guild;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.guild.compat.FactionsGuildModule;
|
import net.Indyuce.mmocore.guild.compat.FactionsGuildModule;
|
||||||
|
import net.Indyuce.mmocore.guild.compat.GuildsGuildModule;
|
||||||
import net.Indyuce.mmocore.guild.compat.UltimateClansGuildModule;
|
import net.Indyuce.mmocore.guild.compat.UltimateClansGuildModule;
|
||||||
|
import net.Indyuce.mmocore.guild.provided.MMOCoreGuildModule;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
|
|
||||||
public enum GuildModuleType {
|
public enum GuildModuleType {
|
||||||
FACTIONS("Factions", FactionsGuildModule::new),
|
FACTIONS("Factions", FactionsGuildModule::new),
|
||||||
|
GUILDS("Guilds", GuildsGuildModule::new),
|
||||||
|
KINGDOMSX("Guilds", GuildsGuildModule::new),
|
||||||
|
MMOCORE("MMOCore", MMOCoreGuildModule::new),
|
||||||
ULTIMATE_CLANS("UltimateClans", UltimateClansGuildModule::new),
|
ULTIMATE_CLANS("UltimateClans", UltimateClansGuildModule::new),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package net.Indyuce.mmocore.guild.compat;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.guild.AbstractGuild;
|
||||||
|
import net.Indyuce.mmocore.guild.GuildModule;
|
||||||
|
|
||||||
|
public class KingdomsXGuildModule implements GuildModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractGuild getGuild(PlayerData playerData) {
|
||||||
|
throw new RuntimeException("Not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
class CustomGuild implements AbstractGuild {
|
||||||
|
CustomGuild() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,18 @@
|
|||||||
package net.Indyuce.mmocore.party;
|
package net.Indyuce.mmocore.party;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.party.compat.DungeonsPartyModule;
|
import net.Indyuce.mmocore.party.compat.*;
|
||||||
import net.Indyuce.mmocore.party.compat.McMMOPartyModule;
|
|
||||||
import net.Indyuce.mmocore.party.compat.PAFPartyModule;
|
|
||||||
import net.Indyuce.mmocore.party.compat.PartiesPartyModule;
|
|
||||||
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
|
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
|
|
||||||
public enum PartyModuleType {
|
public enum PartyModuleType {
|
||||||
DUNGEONSXL("DungeonsXL", () -> new DungeonsPartyModule()),
|
DUNGEONS("Dungeons", DungeonsPartyModule::new),
|
||||||
MMOCORE("MMOCore", () -> new MMOCorePartyModule()),
|
DUNGEONSXL("DungeonsXL", DungeonsXLPartyModule::new),
|
||||||
PARTY_AND_FRIENDS("PartyAndFriends", () -> new PAFPartyModule()),
|
MCMMO("mcMMO", McMMOPartyModule::new),
|
||||||
PARTIES("Parties", () -> new PartiesPartyModule()),
|
MMOCORE("MMOCore", MMOCorePartyModule::new),
|
||||||
MCMMO("mcMMO", () -> new McMMOPartyModule()),
|
PARTIES("Parties", PartiesPartyModule::new),
|
||||||
// DUNGEONS("Dungeons", null),
|
PARTY_AND_FRIENDS("PartyAndFriends", PAFPartyModule::new),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String pluginName;
|
private final String pluginName;
|
||||||
|
@ -1,52 +1,37 @@
|
|||||||
package net.Indyuce.mmocore.party.compat;
|
package net.Indyuce.mmocore.party.compat;
|
||||||
|
|
||||||
import de.erethon.dungeonsxl.DungeonsXL;
|
|
||||||
import de.erethon.dungeonsxl.api.player.PlayerGroup;
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.party.AbstractParty;
|
import net.Indyuce.mmocore.party.AbstractParty;
|
||||||
import net.Indyuce.mmocore.party.PartyModule;
|
import net.Indyuce.mmocore.party.PartyModule;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class DungeonsPartyModule implements PartyModule {
|
public class DungeonsPartyModule implements PartyModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractParty getParty(PlayerData playerData) {
|
public AbstractParty getParty(PlayerData playerData) {
|
||||||
PlayerGroup group = DungeonsXL.getInstance().getPlayerGroup(playerData.getPlayer());
|
throw new RuntimeException("Not supported");
|
||||||
return group == null ? null : new CustomParty(group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomParty implements AbstractParty {
|
class CustomParty implements AbstractParty {
|
||||||
private final PlayerGroup group;
|
|
||||||
|
|
||||||
public CustomParty(PlayerGroup group) {
|
public CustomParty() {
|
||||||
this.group = group;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasMember(Player player) {
|
public boolean hasMember(Player player) {
|
||||||
return group.getMembers().contains(player.getUniqueId());
|
throw new RuntimeException("Not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlayerData> getOnlineMembers() {
|
public List<PlayerData> getOnlineMembers() {
|
||||||
List<PlayerData> list = new ArrayList<>();
|
throw new RuntimeException("Not supported");
|
||||||
|
|
||||||
for (UUID playerUid : group.getMembers().getUniqueIds()) {
|
|
||||||
PlayerData found = PlayerData.get(playerUid);
|
|
||||||
if (found.isOnline())
|
|
||||||
list.add(found);
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countMembers() {
|
public int countMembers() {
|
||||||
return group.getMembers().getUniqueIds().size();
|
throw new RuntimeException("Not supported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
package net.Indyuce.mmocore.party.compat;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.DungeonsXL;
|
||||||
|
import de.erethon.dungeonsxl.api.player.PlayerGroup;
|
||||||
|
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 java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DungeonsXLPartyModule implements PartyModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractParty getParty(PlayerData playerData) {
|
||||||
|
PlayerGroup group = DungeonsXL.getInstance().getPlayerGroup(playerData.getPlayer());
|
||||||
|
return group == null ? null : new CustomParty(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
class CustomParty implements AbstractParty {
|
||||||
|
private final PlayerGroup group;
|
||||||
|
|
||||||
|
public CustomParty(PlayerGroup group) {
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasMember(Player player) {
|
||||||
|
return group.getMembers().contains(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlayerData> getOnlineMembers() {
|
||||||
|
List<PlayerData> list = new ArrayList<>();
|
||||||
|
|
||||||
|
for (UUID playerUid : group.getMembers().getUniqueIds()) {
|
||||||
|
PlayerData found = PlayerData.get(playerUid);
|
||||||
|
if (found.isOnline())
|
||||||
|
list.add(found);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countMembers() {
|
||||||
|
return group.getMembers().getUniqueIds().size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user