Add permission node 'mcmmo.broadcast.levelup' for level up broadcasts

This commit is contained in:
nossr50
2021-01-21 14:31:11 -08:00
parent 4fea5438fe
commit 80a1b3949e
4 changed files with 15 additions and 1 deletions

View File

@ -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"); }

View File

@ -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()))

View File

@ -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.