support for UClans

This commit is contained in:
Indyuce 2022-01-22 11:34:04 +01:00
parent 34c3b5bf2f
commit 16651dfe99
3 changed files with 42 additions and 3 deletions

13
pom.xml
View File

@ -92,17 +92,17 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
@ -216,6 +216,13 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.ulrich</groupId>
<artifactId>UltimateClans</artifactId>
<version>4.2.0</version>
<scope>provided</scope>
</dependency>
<!-- Quest plugins -->
</dependencies>

View File

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

View File

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