Support for KingdomsX

This commit is contained in:
Jules 2022-02-06 17:52:53 +01:00
parent db90693676
commit fd3a245125
5 changed files with 24 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.Faction;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.AbstractGuild;
import net.Indyuce.mmocore.guild.GuildModule; import net.Indyuce.mmocore.guild.GuildModule;
import org.jetbrains.annotations.NotNull;
public class FactionsGuildModule implements GuildModule { public class FactionsGuildModule implements GuildModule {
@ -16,6 +17,8 @@ public class FactionsGuildModule implements GuildModule {
} }
class CustomGuild implements AbstractGuild { class CustomGuild implements AbstractGuild {
@NotNull
private final Faction faction; private final Faction faction;
CustomGuild(Faction faction) { CustomGuild(Faction faction) {

View File

@ -5,6 +5,7 @@ import me.glaremasters.guilds.guild.Guild;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.AbstractGuild;
import net.Indyuce.mmocore.guild.GuildModule; import net.Indyuce.mmocore.guild.GuildModule;
import org.jetbrains.annotations.NotNull;
public class GuildsGuildModule implements GuildModule { public class GuildsGuildModule implements GuildModule {
@ -15,6 +16,8 @@ public class GuildsGuildModule implements GuildModule {
} }
class CustomGuild implements AbstractGuild { class CustomGuild implements AbstractGuild {
@NotNull
private final Guild guild; private final Guild guild;
CustomGuild(Guild guild) { CustomGuild(Guild guild) {

View File

@ -3,16 +3,28 @@ package net.Indyuce.mmocore.guild.compat;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.AbstractGuild;
import net.Indyuce.mmocore.guild.GuildModule; import net.Indyuce.mmocore.guild.GuildModule;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.kingdoms.constants.kingdom.Kingdom;
import org.kingdoms.constants.player.KingdomPlayer;
import org.kingdoms.main.Kingdoms;
public class KingdomsXGuildModule implements GuildModule { public class KingdomsXGuildModule implements GuildModule {
@Override @Override
public AbstractGuild getGuild(PlayerData playerData) { public AbstractGuild getGuild(PlayerData playerData) {
throw new RuntimeException("Not supported"); KingdomPlayer kPlayer = Kingdoms.get().getDataHandlers().getKingdomPlayerManager().getData(playerData.getUniqueId());
Kingdom kingdom = kPlayer == null ? null : kPlayer.getKingdom();
return kingdom == null ? null : new CustomGuild(kingdom);
} }
class CustomGuild implements AbstractGuild { class CustomGuild implements AbstractGuild {
CustomGuild() {
@NotNull
private final Kingdom kingdom;
CustomGuild(Kingdom kingdom) {
this.kingdom = kingdom;
} }
} }
} }

View File

@ -6,6 +6,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.AbstractGuild;
import net.Indyuce.mmocore.guild.GuildModule; import net.Indyuce.mmocore.guild.GuildModule;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
public class UltimateClansGuildModule implements GuildModule { public class UltimateClansGuildModule implements GuildModule {
private static final UClans API = (UClans) Bukkit.getPluginManager().getPlugin("UltimateCLans"); private static final UClans API = (UClans) Bukkit.getPluginManager().getPlugin("UltimateCLans");
@ -15,8 +16,9 @@ public class UltimateClansGuildModule implements GuildModule {
return API.getPlayerAPI().hasClan(playerData.getUniqueId()) ? new CustomGuild(API.getClanAPI().getClan(API.getPlayerAPI().getClanID(playerData.getUniqueId()))) : null; return API.getPlayerAPI().hasClan(playerData.getUniqueId()) ? new CustomGuild(API.getClanAPI().getClan(API.getPlayerAPI().getClanID(playerData.getUniqueId()))) : null;
} }
class CustomGuild implements AbstractGuild { class CustomGuild implements AbstractGuild {
@NotNull
private final ClanData clan; private final ClanData clan;
CustomGuild(ClanData clan) { CustomGuild(ClanData clan) {

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
@Deprecated
public class DungeonsPartyModule implements PartyModule { public class DungeonsPartyModule implements PartyModule {
@Override @Override