Update AntiSpamListener.java

This commit is contained in:
Deauthorized 2024-05-02 17:29:38 -04:00 committed by GitHub
parent 6e5f0d7beb
commit 344df2b225
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
package dev.plex.listener.impl;
import dev.plex.listener.PlexListener;
import dev.plex.util.PlexUtils;
import dev.plex.services.impl.TimingService;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.text.Component;
@ -19,7 +20,7 @@ public class AntiSpamListener extends PlexListener
TimingService.spamCooldown.merge(event.getPlayer().getUniqueId(), 1L, Long::sum);
if (getCount(event.getPlayer().getUniqueId()) > 8L)
{
event.getPlayer().sendMessage(Component.text("Please refrain from spamming messages.").color(NamedTextColor.GRAY));
event.getPlayer().sendMessage(PlexUtils.messageComponent("antiSpamMessage"));
event.setCancelled(true);
}
}
@ -30,7 +31,7 @@ public class AntiSpamListener extends PlexListener
TimingService.spamCooldown.merge(event.getPlayer().getUniqueId(), 1L, Long::sum);
if (getCount(event.getPlayer().getUniqueId()) > 8L)
{
event.getPlayer().sendMessage(Component.text("Please refrain from spamming commands.").color(NamedTextColor.GRAY));
event.getPlayer().sendMessage(PlexUtils.messageComponent("antiSpamMessage"));
event.setCancelled(true);
}
}