mirror of
https://github.com/Maxlego08/zKoth.git
synced 2025-02-17 01:52:25 +01:00
🚧 Add clan support
This commit is contained in:
parent
ae5ce350c6
commit
105da06993
@ -1,7 +1,7 @@
|
||||
name: zKoth
|
||||
author: Maxlego08
|
||||
main: fr.maxlego08.zkoth.ZKothPlugin
|
||||
version: 2.0.1.3
|
||||
version: 2.0.1.4
|
||||
softdepend: [PlaceholderAPI, Guilds, Factions, FactionsX, SuperiorSkyblock2, LegacyFactions, FeatherBoard, TAB, TitleManager, UltimateFactions]
|
||||
commands:
|
||||
api-version: 1.13
|
@ -35,6 +35,7 @@ import fr.maxlego08.zkoth.api.event.events.KothHookEvent;
|
||||
import fr.maxlego08.zkoth.api.event.events.KothMoveEvent;
|
||||
import fr.maxlego08.zkoth.api.event.events.KothStopEvent;
|
||||
import fr.maxlego08.zkoth.api.event.events.KothWinEvent;
|
||||
import fr.maxlego08.zkoth.hooks.ClanHook;
|
||||
import fr.maxlego08.zkoth.hooks.DefaultHook;
|
||||
import fr.maxlego08.zkoth.hooks.FactionLegacyHook;
|
||||
import fr.maxlego08.zkoth.hooks.FactionMassiveHook;
|
||||
@ -100,6 +101,11 @@ public class ZKothManager extends ListenerAdapter implements KothManager {
|
||||
|
||||
factionListener = new SuperiorSkyblock2Hook();
|
||||
Logger.info("SuperiorSkyblock2 plugin detected successfully.", LogType.SUCCESS);
|
||||
|
||||
} else if (pluginManager.isPluginEnabled("Clans")) {
|
||||
|
||||
factionListener = new ClanHook();
|
||||
Logger.info("Clans plugin detected successfully.", LogType.SUCCESS);
|
||||
|
||||
} else if (pluginManager.isPluginEnabled("GangsPlus")) {
|
||||
|
||||
|
43
src/fr/maxlego08/zkoth/hooks/ClanHook.java
Normal file
43
src/fr/maxlego08/zkoth/hooks/ClanHook.java
Normal file
@ -0,0 +1,43 @@
|
||||
package fr.maxlego08.zkoth.hooks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import Clans.ClanConfiguration;
|
||||
import Clans.Main;
|
||||
import fr.maxlego08.zkoth.api.FactionListener;
|
||||
|
||||
public class ClanHook implements FactionListener {
|
||||
|
||||
public ClanHook() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactionTag(Player player) {
|
||||
Main main = (Main) Bukkit.getPluginManager().getPlugin("Clans");
|
||||
ClanConfiguration clanConfiguration = main.getClanConfiguration();
|
||||
String clan;
|
||||
return (clan = clanConfiguration.getClan(player)) == null ? player.getName() : clan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getOnlinePlayer(Player player) {
|
||||
Main main = (Main) Bukkit.getPluginManager().getPlugin("Clans");
|
||||
ClanConfiguration clanConfiguration = main.getClanConfiguration();
|
||||
String currentClan = clanConfiguration.getClan(player);
|
||||
if (currentClan == null)
|
||||
return Arrays.asList(player);
|
||||
return Bukkit.getOnlinePlayers().stream().filter(e -> {
|
||||
String tmpClan = clanConfiguration.getClan(e);
|
||||
if (tmpClan == null)
|
||||
return false;
|
||||
return tmpClan.equals(currentClan);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user