mirror of
https://github.com/Maxlego08/zKoth.git
synced 2024-06-24 10:04:42 +02:00
📝 Add BetterTeams
This commit is contained in:
parent
f2494891b1
commit
9c313a4892
|
@ -2,6 +2,7 @@ package fr.maxlego08.koth.hook;
|
|||
|
||||
import fr.maxlego08.koth.KothPlugin;
|
||||
import fr.maxlego08.koth.api.KothTeam;
|
||||
import fr.maxlego08.koth.hook.teams.BetterTeamHook;
|
||||
import fr.maxlego08.koth.hook.teams.HuskTownHook;
|
||||
import fr.maxlego08.koth.hook.teams.LandHook;
|
||||
import fr.maxlego08.koth.hook.teams.SuperiorSkyblock2Hook;
|
||||
|
@ -15,6 +16,7 @@ public enum TeamPlugin {
|
|||
LANDS("Lands", LandHook.class),
|
||||
HUSKTOWN("HuskTowns", HuskTownHook.class),
|
||||
SUPERIORSKYBLOCK("SuperiorSkyblock2", SuperiorSkyblock2Hook.class),
|
||||
BETTERTEAMS("BetterTeams", BetterTeamHook.class),
|
||||
|
||||
;
|
||||
|
||||
|
|
51
src/fr/maxlego08/koth/hook/teams/BetterTeamHook.java
Normal file
51
src/fr/maxlego08/koth/hook/teams/BetterTeamHook.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package fr.maxlego08.koth.hook.teams;
|
||||
|
||||
import com.booksaw.betterTeams.PlayerRank;
|
||||
import com.booksaw.betterTeams.Team;
|
||||
import com.booksaw.betterTeams.customEvents.DisbandTeamEvent;
|
||||
import fr.maxlego08.koth.KothPlugin;
|
||||
import fr.maxlego08.koth.api.KothTeam;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BetterTeamHook implements KothTeam {
|
||||
|
||||
private final KothPlugin plugin;
|
||||
|
||||
public BetterTeamHook(KothPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactionTag(Player player) {
|
||||
Team team = Team.getTeam(player);
|
||||
return team == null ? player.getName() : team.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getOnlinePlayer(Player player) {
|
||||
Team team = Team.getTeam(player);
|
||||
return team == null ? Collections.singletonList(player) : team.getOnlineMembers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLeaderName(Player player) {
|
||||
Team team = Team.getTeam(player);
|
||||
return team == null ? player.getName() : team.getMembers().getRank(PlayerRank.OWNER).get(0).getPlayer().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeamId(Player player) {
|
||||
Team team = Team.getTeam(player);
|
||||
return team == null ? player.getUniqueId().toString() : team.getID().toString();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDisband(DisbandTeamEvent event) {
|
||||
this.plugin.getStorageManager().onTeamDisband(event.getTeam().getID().toString());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user