VaultGroupProvider.java

1
package sh.okx.rankup.hook;
2
3
import net.milkbowl.vault.permission.Permission;
4
import org.bukkit.Bukkit;
5
6
import java.util.Objects;
7
import java.util.UUID;
8
9
public class VaultGroupProvider implements GroupProvider {
10
  private final Permission permission;
11
12
  public VaultGroupProvider(Permission permission) {
13
    this.permission = permission;
14
  }
15
16
  @Override
17
  public boolean inGroup(UUID uuid, String group) {
18
    Objects.requireNonNull(uuid);
19
    Objects.requireNonNull(group);
20
21
    String[] playerGroups = permission.getPlayerGroups(null, Bukkit.getOfflinePlayer(uuid));
22
    for (String playerGroup : playerGroups) {
23 1 1. inGroup : negated conditional → NO_COVERAGE
      if (group.equalsIgnoreCase(playerGroup)) {
24 1 1. inGroup : replaced boolean return with false for sh/okx/rankup/hook/VaultGroupProvider::inGroup → NO_COVERAGE
        return true;
25
      }
26
    }
27 1 1. inGroup : replaced boolean return with true for sh/okx/rankup/hook/VaultGroupProvider::inGroup → NO_COVERAGE
    return false;
28
  }
29
30
  @Override
31
  public void addGroup(UUID uuid, String group) {
32
    Objects.requireNonNull(uuid);
33
    Objects.requireNonNull(group);
34
35
    permission.playerAddGroup(null, Bukkit.getOfflinePlayer(uuid), group);
36
  }
37
38
  @Override
39
  public void removeGroup(UUID uuid, String group) {
40
    Objects.requireNonNull(uuid);
41
    Objects.requireNonNull(group);
42
43
    permission.playerRemoveGroup(null, Bukkit.getOfflinePlayer(uuid), group);
44
  }
45
}

Mutations

23

1.1
Location : inGroup
Killed by : none
negated conditional → NO_COVERAGE

24

1.1
Location : inGroup
Killed by : none
replaced boolean return with false for sh/okx/rankup/hook/VaultGroupProvider::inGroup → NO_COVERAGE

27

1.1
Location : inGroup
Killed by : none
replaced boolean return with true for sh/okx/rankup/hook/VaultGroupProvider::inGroup → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.7.0