Support for more guild/party plugins

This commit is contained in:
Jules 2022-02-06 17:40:32 +01:00
parent 87ffe8e621
commit db90693676
6 changed files with 101 additions and 30 deletions

14
pom.xml
View File

@ -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>

View File

@ -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),
; ;

View File

@ -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() {
}
}
}

View File

@ -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;

View File

@ -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");
} }
} }
} }

View File

@ -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();
}
}
}