From 16651dfe99cc048df9c557b9ee4a27907e48e425 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 22 Jan 2022 11:34:04 +0100 Subject: [PATCH] support for UClans --- pom.xml | 13 +++++++-- .../mmocore/guild/GuildModuleType.java | 4 +++ .../compat/UltimateClansGuildModule.java | 28 +++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java diff --git a/pom.xml b/pom.xml index 7f9a2c31..b2c18c0b 100644 --- a/pom.xml +++ b/pom.xml @@ -92,17 +92,17 @@ spigot-repo https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - + sk89q-repo https://maven.enginehub.org/repo/ - + papermc https://papermc.io/repo/repository/maven-public/ - + @@ -216,6 +216,13 @@ provided + + me.ulrich + UltimateClans + 4.2.0 + provided + + diff --git a/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java b/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java index ceb0508f..48e03605 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java +++ b/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java @@ -1,10 +1,14 @@ package net.Indyuce.mmocore.guild; +import net.Indyuce.mmocore.guild.compat.FactionsGuildModule; +import net.Indyuce.mmocore.guild.compat.UltimateClansGuildModule; import org.bukkit.Bukkit; import javax.inject.Provider; public enum GuildModuleType { + FACTIONS("Factions", FactionsGuildModule::new), + ULTIMATE_CLANS("UltimateClans", UltimateClansGuildModule::new), ; private final String pluginName; diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java b/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java new file mode 100644 index 00000000..467f6f11 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java @@ -0,0 +1,28 @@ +package net.Indyuce.mmocore.guild.compat; + +import me.ulrich.clans.data.ClanData; +import me.ulrich.clans.packets.interfaces.UClans; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.guild.AbstractGuild; +import net.Indyuce.mmocore.guild.GuildModule; +import org.bukkit.Bukkit; +import org.jetbrains.annotations.Nullable; + +public class UltimateClansGuildModule implements GuildModule { + private static final UClans API = (UClans) Bukkit.getPluginManager().getPlugin("UltimateCLans"); + + @Override + public AbstractGuild getGuild(PlayerData playerData) { + return API.getPlayerAPI().hasClan(playerData.getUniqueId()) ? new CustomGuild(API.getClanAPI().getClan(API.getPlayerAPI().getClanID(playerData.getUniqueId()))) : null; + } + + class CustomGuild implements AbstractGuild { + + @Nullable + private final ClanData clan; + + CustomGuild(ClanData clan) { + this.clan = clan; + } + } +}