1 | package sh.okx.rankup; | |
2 | ||
3 | import java.util.function.Supplier; | |
4 | import org.bukkit.entity.Player; | |
5 | import org.bukkit.event.EventHandler; | |
6 | import org.bukkit.event.Listener; | |
7 | import org.bukkit.event.player.PlayerJoinEvent; | |
8 | import sh.okx.rankup.util.UpdateNotifier; | |
9 | ||
10 | public class JoinUpdateNotifier implements Listener { | |
11 | private final UpdateNotifier notifier; | |
12 | private final Supplier<Boolean> enabledSupplier; | |
13 | private final String permission; | |
14 | ||
15 | public JoinUpdateNotifier(UpdateNotifier notifier, | |
16 | Supplier<Boolean> enabledSupplier, String permission) { | |
17 | this.notifier = notifier; | |
18 | this.enabledSupplier = enabledSupplier; | |
19 | this.permission = permission; | |
20 | } | |
21 | ||
22 | @EventHandler | |
23 | public void on(PlayerJoinEvent e) { | |
24 |
1
1. on : negated conditional → SURVIVED |
if (enabledSupplier.get()) { |
25 | Player player = e.getPlayer(); | |
26 |
1
1. on : negated conditional → SURVIVED |
if (player.hasPermission(permission)) { |
27 |
1
1. on : removed call to sh/okx/rankup/util/UpdateNotifier::notify → NO_COVERAGE |
notifier.notify(player, true); |
28 | } | |
29 | } | |
30 | } | |
31 | } | |
Mutations | ||
24 |
1.1 |
|
26 |
1.1 |
|
27 |
1.1 |