Fix question and shout prefixes with toggle shout (#5367)
This commit is contained in:
parent
52a4dd2c60
commit
1e0f7cb984
|
@ -104,15 +104,13 @@ public abstract class AbstractChatHandler {
|
||||||
|
|
||||||
// Local, shout and question chat types are only enabled when there's a valid radius
|
// Local, shout and question chat types are only enabled when there's a valid radius
|
||||||
if (chat.getRadius() > 0 && event.getMessage().length() > 0) {
|
if (chat.getRadius() > 0 && event.getMessage().length() > 0) {
|
||||||
if (chat.getType() == ChatType.UNKNOWN) {
|
if (event.getMessage().length() > 1 && ((chat.getType() == ChatType.SHOUT && event.getMessage().charAt(0) == ess.getSettings().getChatShout()) || (chat.getType() == ChatType.QUESTION && event.getMessage().charAt(0) == ess.getSettings().getChatQuestion()))) {
|
||||||
if (user.isToggleShout() && event.getMessage().charAt(0) == ess.getSettings().getChatShout()) {
|
|
||||||
event.setMessage(event.getMessage().substring(1));
|
event.setMessage(event.getMessage().substring(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chat.getType() == ChatType.UNKNOWN) {
|
||||||
format = tl("chatTypeLocal").concat(format);
|
format = tl("chatTypeLocal").concat(format);
|
||||||
} else {
|
} else {
|
||||||
if (event.getMessage().charAt(0) == ess.getSettings().getChatShout() || (event.getMessage().charAt(0) == ess.getSettings().getChatQuestion() && ess.getSettings().isChatQuestionEnabled())) {
|
|
||||||
event.setMessage(event.getMessage().substring(1));
|
|
||||||
}
|
|
||||||
format = tl(chat.getType().key() + "Format", format);
|
format = tl(chat.getType().key() + "Format", format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,16 +291,23 @@ public abstract class AbstractChatHandler {
|
||||||
return ChatType.UNKNOWN;
|
return ChatType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final char shoutPrefix = ess.getSettings().getChatShout();
|
||||||
|
final char questionPrefix = ess.getSettings().getChatQuestion();
|
||||||
|
|
||||||
final char prefix = message.charAt(0);
|
final char prefix = message.charAt(0);
|
||||||
if (prefix == ess.getSettings().getChatShout()) {
|
final boolean singleChar = message.length() == 1;
|
||||||
|
|
||||||
|
if (singleChar) {
|
||||||
if (user.isToggleShout()) {
|
if (user.isToggleShout()) {
|
||||||
|
return ChatType.SHOUT;
|
||||||
|
}
|
||||||
return ChatType.UNKNOWN;
|
return ChatType.UNKNOWN;
|
||||||
}
|
}
|
||||||
return message.length() > 1 ? ChatType.SHOUT : ChatType.UNKNOWN;
|
|
||||||
} else if (ess.getSettings().isChatQuestionEnabled() && prefix == ess.getSettings().getChatQuestion()) {
|
if (prefix == questionPrefix && ess.getSettings().isChatQuestionEnabled()) {
|
||||||
return message.length() > 1 ? ChatType.QUESTION : ChatType.UNKNOWN;
|
return ChatType.QUESTION;
|
||||||
} else if (user.isToggleShout()) {
|
} else if (prefix == shoutPrefix || user.isToggleShout()) {
|
||||||
return message.length() > 1 ? ChatType.SHOUT : ChatType.UNKNOWN;
|
return ChatType.SHOUT;
|
||||||
} else {
|
} else {
|
||||||
return ChatType.UNKNOWN;
|
return ChatType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue