aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/eu/olli/cowmoonication/Friends.java
blob: 2becc74f0e2c4c13145916d30493a67182140dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package eu.olli.cowmoonication;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

public class Friends {
    private final Cowmoonication main;
    private Set<String> bestFriends = new HashSet<>();

    public Friends(Cowmoonication main) {
        this.main = main;
    }

    public boolean isBestFriend(String playerName) {
        return bestFriends.contains(playerName);
    }

    public Set<String> getBestFriends() {
        return new TreeSet<>(bestFriends);
    }

    public void syncFriends(String[] bestFriends) {
        this.bestFriends = new HashSet<>();
        Collections.addAll(this.bestFriends, bestFriends);
    }
}