mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 06:57:39 +01:00
Add permission for local channel chat
This commit is contained in:
parent
88c8ccd29b
commit
2f5c24d114
@ -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.
|
noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion.
|
||||||
noPowerTools=\u00a76You have no power tools assigned.
|
noPowerTools=\u00a76You have no power tools assigned.
|
||||||
notAcceptingPay=\u00a74{0} \u00a74is not accepting payment.
|
notAcceptingPay=\u00a74{0} \u00a74is not accepting payment.
|
||||||
notAllowedToQuestion=\u00a74You are not authorized to use question.
|
notAllowedToLocal=\u00a74You don't have permission to speak in local chat.
|
||||||
notAllowedToShout=\u00a74You are not authorized to shout.
|
notAllowedToQuestion=\u00a74You don't have permission to use question.
|
||||||
|
notAllowedToShout=\u00a74You don't have permission to shout.
|
||||||
notEnoughExperience=\u00a74You do not have enough experience.
|
notEnoughExperience=\u00a74You do not have enough experience.
|
||||||
notEnoughMoney=\u00a74You do not have sufficient funds.
|
notEnoughMoney=\u00a74You do not have sufficient funds.
|
||||||
notFlying=not flying
|
notFlying=not flying
|
||||||
|
@ -43,21 +43,29 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
|
|||||||
final User user = chatStore.getUser();
|
final User user = chatStore.getUser();
|
||||||
chatStore.setRadius(radius);
|
chatStore.setRadius(radius);
|
||||||
|
|
||||||
if (event.getMessage().length() > 1 && chatStore.getType().length() > 0) {
|
if (event.getMessage().length() > 1) {
|
||||||
final StringBuilder permission = new StringBuilder();
|
if (chatStore.getType().isEmpty()) {
|
||||||
permission.append("essentials.chat.").append(chatStore.getType());
|
if (!user.isAuthorized("essentials.chat.local")) {
|
||||||
|
user.sendMessage(tl("notAllowedToLocal"));
|
||||||
if (user.isAuthorized(permission.toString())) {
|
event.setCancelled(true);
|
||||||
if (event.getMessage().charAt(0) == ess.getSettings().getChatShout() || event.getMessage().charAt(0) == ess.getSettings().getChatQuestion()) {
|
return;
|
||||||
event.setMessage(event.getMessage().substring(1));
|
|
||||||
}
|
}
|
||||||
event.setFormat(tl(chatStore.getType() + "Format", event.getFormat()));
|
} else {
|
||||||
|
final StringBuilder permission = new StringBuilder();
|
||||||
|
permission.append("essentials.chat.").append(chatStore.getType());
|
||||||
|
|
||||||
|
if (user.isAuthorized(permission.toString())) {
|
||||||
|
if (event.getMessage().charAt(0) == ess.getSettings().getChatShout() || event.getMessage().charAt(0) == ess.getSettings().getChatQuestion()) {
|
||||||
|
event.setMessage(event.getMessage().substring(1));
|
||||||
|
}
|
||||||
|
event.setFormat(tl(chatStore.getType() + "Format", event.getFormat()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.sendMessage(tl("notAllowedTo" + chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH) + chatStore.getType().substring(1)));
|
||||||
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.sendMessage(tl("notAllowedTo" + chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH) + chatStore.getType().substring(1)));
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Location loc = user.getLocation();
|
final Location loc = user.getLocation();
|
||||||
|
@ -13,3 +13,6 @@ commands:
|
|||||||
description: Toggles whether you are talking in shout mode
|
description: Toggles whether you are talking in shout mode
|
||||||
usage: /<command> [player] [on|off]
|
usage: /<command> [player] [on|off]
|
||||||
aliases: [etoggleshout]
|
aliases: [etoggleshout]
|
||||||
|
permissions:
|
||||||
|
essentials.chat.local:
|
||||||
|
default: true
|
||||||
|
Loading…
Reference in New Issue
Block a user