mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 18:24:43 +02:00
Add permission node 'mcmmo.broadcast.levelup' for level up broadcasts
This commit is contained in:
@ -25,6 +25,7 @@ public final class Permissions {
|
||||
* GENERAL
|
||||
*/
|
||||
public static boolean motd(Permissible permissible) { return permissible.hasPermission("mcmmo.motd"); }
|
||||
public static boolean levelUpBroadcast(Permissible permissible) { return permissible.hasPermission("mcmmo.broadcast.levelup"); }
|
||||
public static boolean mobHealthDisplay(Permissible permissible) { return permissible.hasPermission("mcmmo.mobhealthdisplay"); }
|
||||
public static boolean updateNotifications(Permissible permissible) {return permissible.hasPermission("mcmmo.tools.updatecheck"); }
|
||||
public static boolean chimaeraWing(Permissible permissible) { return permissible.hasPermission("mcmmo.item.chimaerawing"); }
|
||||
|
@ -272,13 +272,18 @@ public class NotificationManager {
|
||||
|
||||
//Check if broadcasting is enabled
|
||||
if(Config.getInstance().shouldLevelUpBroadcasts()) {
|
||||
//Permission check
|
||||
if(!Permissions.levelUpBroadcast(mmoPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
int levelInterval = Config.getInstance().getLevelUpBroadcastInterval();
|
||||
int remainder = level % levelInterval;
|
||||
|
||||
if(remainder == 0) {
|
||||
//Grab appropriate audience
|
||||
Audience audience = mcMMO.getAudiences().filter(getLevelUpBroadcastPredicate(mmoPlayer.getPlayer()));
|
||||
//TODO: Make prettier+
|
||||
//TODO: Make prettier
|
||||
HoverEvent<Component> levelMilestoneHover = Component.text(mmoPlayer.getPlayer().getName())
|
||||
.append(Component.newline())
|
||||
.append(Component.text(LocalDate.now().toString()))
|
||||
|
@ -195,6 +195,7 @@ permissions:
|
||||
mcmmo.motd: true
|
||||
mcmmo.skills.all: true
|
||||
mcmmo.chat.colors: true
|
||||
mcmmo.broadcast.levelup: true
|
||||
mcmmo.defaultsop:
|
||||
default: op
|
||||
description: mcmmo permissions that default to op
|
||||
@ -219,6 +220,8 @@ permissions:
|
||||
mcmmo.defaultsop: true
|
||||
mcmmo.party.all: true
|
||||
mcmmo.perks.all: true
|
||||
mcmmo.broadcast.levelup:
|
||||
description: when the player reaches certain level milestones their achievement will be broadcast in chat to other plays
|
||||
mcmmo.ability.*:
|
||||
default: false
|
||||
description: Implies all mcmmo.ability permissions.
|
||||
|
Reference in New Issue
Block a user