[~] 修改消息转发逻辑

This commit is contained in:
Taskeren 2019-08-07 21:48:43 +08:00
parent 3c386797d3
commit ad598de368

View File

@ -56,7 +56,10 @@ public class Chatting {
if(isPrefixed(message)) { if(isPrefixed(message)) {
message = removePrefix(message); if(shouldSubstring(message)) {
message = removePrefix(message);
}
message = CQUtils.removeCqCode(message); message = CQUtils.removeCqCode(message);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@ -97,7 +100,9 @@ public class Chatting {
if(isPrefixed(message)) { if(isPrefixed(message)) {
message = removePrefix(message); if(shouldSubstring(message)) {
message = removePrefix(message);
}
evt.setMessage(message); evt.setMessage(message);
@ -120,6 +125,11 @@ public class Chatting {
return false; return false;
} }
public static boolean shouldSubstring(String message) {
if(!Config.require_prefix) return false;
return true;
}
public static String removePrefix(String message) { public static String removePrefix(String message) {
return message.length() < 1 ? "" : message.substring(1); return message.length() < 1 ? "" : message.substring(1);
} }