forked from Upstream/mmocore
support for Guilds
This commit is contained in:
parent
c9fe2c805c
commit
52183f81f6
7
pom.xml
7
pom.xml
@ -223,6 +223,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.glaremasters</groupId>
|
||||
<artifactId>Guilds</artifactId>
|
||||
<version>3.5.6.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Quest plugins -->
|
||||
|
||||
</dependencies>
|
||||
|
@ -1,8 +1,10 @@
|
||||
package net.Indyuce.mmocore.guild;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface GuildModule {
|
||||
|
||||
@Nullable
|
||||
public AbstractGuild getGuild(PlayerData playerData);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public class FactionsGuildModule implements GuildModule {
|
||||
@Override
|
||||
public AbstractGuild getGuild(PlayerData playerData) {
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(playerData.getPlayer());
|
||||
return new CustomGuild(fPlayer.getFaction());
|
||||
return fPlayer.hasFaction() ? new CustomGuild(fPlayer.getFaction()) : null;
|
||||
}
|
||||
|
||||
class CustomGuild implements AbstractGuild {
|
||||
|
@ -0,0 +1,24 @@
|
||||
package net.Indyuce.mmocore.guild.compat;
|
||||
|
||||
import me.glaremasters.guilds.Guilds;
|
||||
import me.glaremasters.guilds.guild.Guild;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.guild.AbstractGuild;
|
||||
import net.Indyuce.mmocore.guild.GuildModule;
|
||||
|
||||
public class GuildsGuildModule implements GuildModule {
|
||||
|
||||
@Override
|
||||
public AbstractGuild getGuild(PlayerData playerData) {
|
||||
Guild guild = Guilds.getApi().getGuild(playerData.getUniqueId());
|
||||
return guild == null ? null : new CustomGuild(guild);
|
||||
}
|
||||
|
||||
class CustomGuild implements AbstractGuild {
|
||||
private final Guild guild;
|
||||
|
||||
CustomGuild(Guild guild) {
|
||||
this.guild = guild;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user