Add permission for local channel chat

This commit is contained in:
Josh Roy 2021-09-28 21:26:47 -04:00
parent 88c8ccd29b
commit 2f5c24d114
3 changed files with 26 additions and 14 deletions

View File

@ -833,8 +833,9 @@ noPlacePermission=\u00a74You do not have permission to place a block near that s
noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion.
noPowerTools=\u00a76You have no power tools assigned.
notAcceptingPay=\u00a74{0} \u00a74is not accepting payment.
notAllowedToQuestion=\u00a74You are not authorized to use question.
notAllowedToShout=\u00a74You are not authorized to shout.
notAllowedToLocal=\u00a74You don't have permission to speak in local chat.
notAllowedToQuestion=\u00a74You don't have permission to use question.
notAllowedToShout=\u00a74You don't have permission to shout.
notEnoughExperience=\u00a74You do not have enough experience.
notEnoughMoney=\u00a74You do not have sufficient funds.
notFlying=not flying

View File

@ -43,7 +43,14 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
final User user = chatStore.getUser();
chatStore.setRadius(radius);
if (event.getMessage().length() > 1 && chatStore.getType().length() > 0) {
if (event.getMessage().length() > 1) {
if (chatStore.getType().isEmpty()) {
if (!user.isAuthorized("essentials.chat.local")) {
user.sendMessage(tl("notAllowedToLocal"));
event.setCancelled(true);
return;
}
} else {
final StringBuilder permission = new StringBuilder();
permission.append("essentials.chat.").append(chatStore.getType());
@ -59,6 +66,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
event.setCancelled(true);
return;
}
}
final Location loc = user.getLocation();
final World world = loc.getWorld();

View File

@ -13,3 +13,6 @@ commands:
description: Toggles whether you are talking in shout mode
usage: /<command> [player] [on|off]
aliases: [etoggleshout]
permissions:
essentials.chat.local:
default: true