Gradle
repositories {
maven("https://eldonexus.de/repository/maven-public")
}
dependencies {
implementation("de.eldoria", "messageblocker", "version")
}
Maven
<repository>
<id>EldoNexus</id>
<url>https://eldonexus.de/repository/maven-public/</url>
</repository>
<dependency>
<groupId>de.eldoria</groupId>
<artifactId>messageblocker</artifactId>
<version>version</version>
</dependency>
Use MessageBlockerAPI
to create a messageblocker. You will receive a message blocker instance, which will be a blocker
or a dummy. If ProtocolLib is not active on the server a dummy will be returned which can be used as if the blocker
would run.
To block messages you have to call MessageBlockerService#blockPlayer(Player)
method.
To unblock the MessageBlockerService#unblockPlayer(Player)
. This will return a future which will be completed when the
player has received all blocked messages.
If you want to send a message to the player you have to announce it.
Use MessageBlockerService#announce(Player, String)
to announce a message to the blocker. The next message for this
player which contains the string will be send to the player.
As an alternative you can add a plugin prefix or something which will be contained in the message to the whitelist when
you use the builder to create the MessageBlockerService
.