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

@ -1,4 +1,5 @@
Version 2.1.172
Added 'mcmmo.broadcast.levelup' permission node, if a player lacks this node they will not have their level up milestones broadcast to chat
Updated german locale (thanks TheBusyBiscuit)
Changed Fists to not be capitalized (en_US) when lowering/readying berserk
SkillActivationPerkEvent can now be called in async threads (thanks electronicboy)
@ -6,6 +7,10 @@ Version 2.1.172
Added 'Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops' to advanced.yml
Removed a few never implemented settings from Skills.Woodcutting.TreeFeller in advanced.yml
NOTES:
The new 'mcmmo.broadcast.levelup' node is a default node included under the 'mcmmo.defaults' node umbrella, you shouldn't have to give this to your players unless they don't have access to 'mcmmo.defaults'
If you don't have a permission plugin you don't need to worry, players will have this node by default in that case
Version 2.1.171
Fixed a bug where arrows shot by infinite bow enchant would duplicate
Fixed a bug where Archery XP would calculate incorrectly

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.