Skip to content

Plugin API

MoParticles exposes a small, dependency-light API so other plugins can trigger effects. Everything is available through the static MoParticleAPI class.

1. Add the dependency

MoParticles is published to JitPack — trigger a build with the tag you want.

Gradle
groovy
repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    compileOnly 'com.github.Chest-Solutions:MoParticles:1.1.0'
}
Maven
xml
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.Chest-Solutions</groupId>
        <artifactId>MoParticles</artifactId>
        <version>1.1.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

2. Declare the plugin dependency

In your plugin.yml:

yaml
name: MyPlugin
version: 1.0
main: com.example.plugin.MyPlugin
depend: [MoParticles]

3. Use the API

java
import com.csl.moparticles.api.MoParticleAPI;
import org.bukkit.Location;
import java.util.UUID;

MoParticleAPI api = MoParticleAPI.get();
String effectName = "snowstorm:fire";
Location target = player.getLocation();

if (api.hasEffect(effectName)) {          // safety check
    UUID animationId = api.play(effectName, target, 10.0); // play it

    // later...
    api.stop(animationId);                // stop it
}

API reference

MethodReturnsDescription
MoParticleAPI.get()MoParticleAPIThe API instance (throws if MoParticles isn't enabled)
isEnabled()booleanWhether MoParticles is currently enabled
listEffects()List<String>All loaded effect IDs, sorted
hasEffect(String id)booleanWhether an effect with this ID is loaded
play(String effect, Location where, double radius)UUIDPlay an effect; returns the animation ID (or null on failure)
stop(UUID id)voidStop a specific animation
stopAll()voidStop every animation
getResourcePackFile()FilePath to the generated resourcepack.zip

Effect IDs passed to hasEffect / play support the same shorthand resolution as commands — see Effect IDs.

Keeping an effect alive

Effects with a looping emitter stop themselves when their active_time ends. For a permanent ambience loop, re-play the effect when it finishes (or on a scheduled task):

java
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
    api.play("snowstorm:rainbow", lobbyLocation, 8.0);
}, 60L, 2400L); // every 2 minutes

Free, open-source software for Minecraft servers.