Skip to content

Latest commit

 

History

History
76 lines (51 loc) · 2.92 KB

Readme.md

File metadata and controls

76 lines (51 loc) · 2.92 KB

Wakatime_Badge

Publish Build

Releases Development Snapshots

Dependency

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>

Usage

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.

Block messages

To block messages you have to call MessageBlockerService#blockPlayer(Player) method.

Unblock messages

To unblock the MessageBlockerService#unblockPlayer(Player). This will return a future which will be completed when the player has received all blocked messages.

Send messages through the blocker

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.