3.6-beta
add force rankup and prestige add update notification on join more reliable legacy server version check added permissions: rankup.admin (grants rankup.checkversion, rankup.reload, rankup.force, and rankup.notify), rankup.notify (receive update notiifications on login), rankup.force (force a player to rankup or prestige)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package sh.okx.rankup;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import sh.okx.rankup.util.UpdateNotifier;
|
||||
|
||||
public class JoinUpdateNotifier implements Listener {
|
||||
private final UpdateNotifier notifier;
|
||||
private final Supplier<Boolean> enabledSupplier;
|
||||
|
||||
public JoinUpdateNotifier(UpdateNotifier notifier,
|
||||
Supplier<Boolean> enabledSupplier) {
|
||||
this.notifier = notifier;
|
||||
this.enabledSupplier = enabledSupplier;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerJoinEvent e) {
|
||||
if (enabledSupplier.get()) {
|
||||
Player player = e.getPlayer();
|
||||
if (player.hasPermission("rankup.notify")) {
|
||||
notifier.notify(player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user