mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 06:57:39 +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);
|
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" : "";
|
return message.length() > 1 ? "shout" : "";
|
||||||
} else if (ess.getSettings().isChatQuestionEnabled() && prefix == ess.getSettings().getChatQuestion()) {
|
} else if (ess.getSettings().isChatQuestionEnabled() && prefix == ess.getSettings().getChatQuestion()) {
|
||||||
return message.length() > 1 ? "question" : "";
|
return message.length() > 1 ? "question" : "";
|
||||||
|
} else if (user.isToggleShout()) {
|
||||||
|
return message.length() > 1 ? "shout" : "";
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,17 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
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"));
|
event.getRecipients().removeIf(player -> !ess.getUser(player).isAuthorized("essentials.chat.receive.local"));
|
||||||
} else {
|
} else {
|
||||||
final String permission = "essentials.chat." + chatStore.getType();
|
final String permission = "essentials.chat." + chatStore.getType();
|
||||||
|
|
||||||
if (user.isAuthorized(permission)) {
|
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.setMessage(event.getMessage().substring(1));
|
||||||
}
|
}
|
||||||
event.setFormat(tl(chatStore.getType() + "Format", event.getFormat()));
|
event.setFormat(tl(chatStore.getType() + "Format", event.getFormat()));
|
||||||
|
Loading…
Reference in New Issue
Block a user