Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Destacar que hace falta un Java Enum llamado TeamType donde tenga Red,Blue.
- package es.hol.eliaseeg;
- import java.util.ArrayList;
- import java.util.List;
- import org.bukkit.entity.Player;
- public class Team {
- private static List<String> redTeam = new ArrayList<String>();
- private static List<String> blueTeam = new ArrayList<String>();
- public static void addToTeam(TeamType type, Player player) {
- switch (type) {
- case Red:
- redTeam.add(player.getName());
- break;
- case Blue:
- blueTeam.add(player.getName());
- break;
- }
- player.sendMessage("Added to " + type.name() + " team!");
- }
- public static boolean isInTeam(Player player) {
- return redTeam.contains(player.getName())
- || blueTeam.contains(player.getName());
- }
- public static void clearTeams(){
- redTeam.clear();
- blueTeam.clear();
- }
- public static List<String> getRedTeam() {
- return redTeam;
- }
- public static List<String> getBlueTeam() {
- return blueTeam;
- }
- public static List<String> getAllPlayersInTeams() {
- List<String> combinedTeams = new ArrayList<String>();
- combinedTeams.addAll(redTeam);
- combinedTeams.addAll(blueTeam);
- return combinedTeams;
- }
- public static TeamType getTeamType(Player player) {
- if (!isInTeam(player))
- return null;
- return (redTeam.contains(player.getName()) ? TeamType.Red
- : TeamType.Blue);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement