package me.yaruma.fightsystem.fight; import me.yaruma.fightsystem.utils.Config; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; public class Fight { public static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedPrefix, Config.TeamRedSpawn, Config.TeamRedPaste, Config.TeamRedRotate, false); public static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBluePrefix, Config.TeamBlueSpawn, Config.TeamBluePaste, Config.TeamBlueRotate, true); public static FightTeam getPlayerTeam(Player player) { if(redTeam.isPlayerInTeam(player)) return redTeam; if(blueTeam.isPlayerInTeam(player)) return blueTeam; return null; } public static FightTeam getOpposite(FightTeam fightTeam) { if(fightTeam == redTeam) return blueTeam; if(fightTeam == blueTeam) return redTeam; return null; } public static FightTeam getInvitedTeam(Player player){ if(redTeam.getInvited().contains(player)) return redTeam; else if(blueTeam.getInvited().contains(player)) return blueTeam; return null; } public static FightPlayer getFightPlayer(Player player) { if(redTeam.isPlayerInTeam(player)) return redTeam.getFightPlayer(player); if(blueTeam.isPlayerInTeam(player)) return blueTeam.getFightPlayer(player); return null; } public static FightTeam getRedTeam() { return redTeam; } public static FightTeam getBlueTeam() { return blueTeam; } public static void playSound(Sound sound, float volume, float pitch) { for(Player player : Bukkit.getServer().getOnlinePlayers()) { player.playSound(player.getLocation(), sound, volume, pitch); //volume: max. 100, pitch: max. 2 } } public static void setLevel(int level) { for(Player player : Bukkit.getServer().getOnlinePlayers()) { player.setLevel(level); } } }