@@ -58,6 +58,11 @@ public class Notification implements StringSupplier {
5858 */
5959 public transient boolean editing = false ;
6060
61+ /**
62+ * The time, in ticks, remaining until this notification is eligible for triggering.
63+ */
64+ public transient long countdown = 0 ;
65+
6166 // Options
6267
6368 /**
@@ -84,6 +89,13 @@ public enum CheckOwnMode {
8489 OFF ,
8590 }
8691
92+ /**
93+ * The time, in ticks, for which this instance should be ineligible for activation after being
94+ * activated.
95+ */
96+ public int cooldown ;
97+ public static final int cooldownDefault = 0 ;
98+
8799 /**
88100 * Whether this instance allows use of inclusion triggers.
89101 */
@@ -227,6 +239,7 @@ public enum CheckOwnMode {
227239 Notification (
228240 boolean enabled ,
229241 CheckOwnMode checkOwnMode ,
242+ int cooldown ,
230243 boolean inclusionEnabled ,
231244 boolean exclusionEnabled ,
232245 boolean responseEnabled ,
@@ -260,6 +273,7 @@ public enum CheckOwnMode {
260273 ) {
261274 this .enabled = enabled ;
262275 this .checkOwnMode = checkOwnMode ;
276+ this .cooldown = cooldown ;
263277 this .inclusionEnabled = inclusionEnabled ;
264278 this .exclusionEnabled = exclusionEnabled ;
265279 this .responseEnabled = responseEnabled ;
@@ -300,6 +314,7 @@ static Notification createUser() {
300314 return new Notification (
301315 enabledDefault ,
302316 CheckOwnMode .values ()[0 ],
317+ cooldownDefault ,
303318 inclusionEnabledDefault ,
304319 exclusionEnabledDefault ,
305320 responseEnabledDefault ,
@@ -340,6 +355,7 @@ static Notification createBlank(Sound sound, TextStyle textStyle) {
340355 return new Notification (
341356 enabledDefault ,
342357 CheckOwnMode .values ()[0 ],
358+ cooldownDefault ,
343359 inclusionEnabledDefault ,
344360 exclusionEnabledDefault ,
345361 responseEnabledDefault ,
@@ -378,7 +394,7 @@ static Notification createBlank(Sound sound, TextStyle textStyle) {
378394 * user if {@code ownMsg} is {@code true}).
379395 */
380396 public boolean canBeTriggered (boolean ownMsg ) {
381- if (enabled && !editing ) {
397+ if (enabled && countdown <= 0 && !editing ) {
382398 if (ownMsg ) {
383399 return switch (checkOwnMode ) {
384400 case DEFER -> Config .get ().checkOwnMessages ;
@@ -546,6 +562,13 @@ public Notification deserialize(
546562 silent
547563 );
548564
565+ int cooldown = JsonUtil .getOrDefault (
566+ obj ,
567+ "cooldown" ,
568+ cooldownDefault ,
569+ silent
570+ );
571+
549572 boolean responseEnabled = JsonUtil .getOrDefault (
550573 obj ,
551574 "responseEnabled" ,
@@ -774,6 +797,7 @@ public Notification deserialize(
774797 return new Notification (
775798 enabled ,
776799 checkOwnMode ,
800+ cooldown ,
777801 inclusionEnabled ,
778802 exclusionEnabled ,
779803 responseEnabled ,
0 commit comments