mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Fix toggleshout causing issues with question/local chat
This commit is contained in:
parent
4bf4bd432a
commit
cbb012853c
@ -36,10 +36,15 @@ public abstract class EssentialsChatPlayer implements Listener {
|
||||
}
|
||||
|
||||
final char prefix = message.charAt(0);
|
||||
if (prefix == ess.getSettings().getChatShout() || user.isToggleShout()) {
|
||||
if (prefix == ess.getSettings().getChatShout()) {
|
||||
if (user.isToggleShout()) {
|
||||
return "";
|
||||
}
|
||||
return message.length() > 1 ? "shout" : "";
|
||||
} else if (ess.getSettings().isChatQuestionEnabled() && prefix == ess.getSettings().getChatQuestion()) {
|
||||
return message.length() > 1 ? "question" : "";
|
||||
} else if (user.isToggleShout()) {
|
||||
return message.length() > 1 ? "shout" : "";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
@ -50,12 +50,17 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.isToggleShout() && event.getMessage().length() > 1 && event.getMessage().charAt(0) == ess.getSettings().getChatShout()) {
|
||||
event.setMessage(event.getMessage().substring(1));
|
||||
}
|
||||
|
||||
event.getRecipients().removeIf(player -> !ess.getUser(player).isAuthorized("essentials.chat.receive.local"));
|
||||
} else {
|
||||
final String permission = "essentials.chat." + chatStore.getType();
|
||||
|
||||
if (user.isAuthorized(permission)) {
|
||||
if (event.getMessage().charAt(0) == ess.getSettings().getChatShout() || event.getMessage().charAt(0) == ess.getSettings().getChatQuestion()) {
|
||||
if (event.getMessage().charAt(0) == ess.getSettings().getChatShout() || (event.getMessage().charAt(0) == ess.getSettings().getChatQuestion() && ess.getSettings().isChatQuestionEnabled())) {
|
||||
event.setMessage(event.getMessage().substring(1));
|
||||
}
|
||||
event.setFormat(tl(chatStore.getType() + "Format", event.getFormat()));
|
||||
|
Loading…
Reference in New Issue
Block a user