Recommended Version: 17
Tested Versions: 16, 17
Do not shade message into your plugin. It will always be present in its plugin form at runtime.
Maven
<repository>
<id>oskarsmc-repo</id>
<url>https://repository.oskarsmc.com/releases</url>
</repository>
<dependency>
<groupId>com.oskarsmc</groupId>
<artifactId>message</artifactId>
<version>1.2.0</version>
</dependency>
Gradle Kotlin DSL
maven("https://repository.oskarsmc.com/releases")
implementation("com.oskarsmc:message:1.2.0")
Javadocs are not published anywhere yet. A javadoc jar is published alongside each artifact.
import com.google.inject.Inject;
import com.oskarsmc.message.event.MessageEvent;
import com.oskarsmc.message.event.StringResult;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@Plugin(
id = "testvelocityplugin",
name = "TestVelocityPlugin",
version = "1.0.0"
)
public class TestVelocityPlugin {
@Subscribe
private void MessageEvent(@NotNull MessageEvent event) {
if (event.originalMessage().contains("poop")) { // Check if message contains a very naughty word.
event.setResult(StringResult.denied()); // Don't send naughty words to people.
}
}
}