raids plugin: limit layout message to 300 characters

This commit is contained in:
Adam
2019-11-25 13:11:09 -05:00
parent c117bc9bd5
commit 6d6647a43f

View File

@@ -100,6 +100,7 @@ public class RaidsPlugin extends Plugin
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##"); private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
private static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###"); private static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###");
private static final String LAYOUT_COMMAND = "!layout"; private static final String LAYOUT_COMMAND = "!layout";
private static final int MAX_LAYOUT_LEN = 300;
@Inject @Inject
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@@ -637,6 +638,12 @@ public class RaidsPlugin extends Plugin
.map(RaidRoom::getName) .map(RaidRoom::getName)
.toArray()); .toArray());
if (layoutMessage.length() > MAX_LAYOUT_LEN)
{
log.debug("layout message too long! {}", layoutMessage.length());
return;
}
String response = new ChatMessageBuilder() String response = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT) .append(ChatColorType.HIGHLIGHT)
.append("Layout: ") .append("Layout: ")