Skip to content

About

A small, version-aware library for spawning particle effects from Spigot/Paper plugins.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

yggraParticle

Release (latest by date) Workflow Status License Downloads Stars Issues Forks

A small, version-aware library for spawning particle effects from Spigot/Paper plugins. It selects the appropriate implementation for the running server at runtime, so your plugin can use one API without maintaining its own version-specific particle code.

Features

  • One API for spawning particles across supported Minecraft server versions.
  • Overloads for particle count, uniform offset, per-axis offsets, and speed.
  • Automatic server version detection with a graceful fallback when no compatible implementation is available.
  • A single shaded bootstrap JAR that contains the API and the bundled implementations.

Supported versions

Minecraft version Implementation How it works
1.9.4+ impl_v1_9_4 Bukkit World#spawnParticle(Particle, ...) API
1.8.x – 1.9.3 impl_v1_8_8 Reflective NMS PacketPlayOutWorldParticles packets (v1_8_R3)

The implementation is selected once when YggraParticle is constructed. If the server version is unsupported or the implementation cannot be loaded, a warning is logged and spawn calls are ignored instead of crashing your plugin.

Note: Particle names must match the identifiers expected by the selected implementation. On 1.9.4+ servers this means the org.bukkit.Particle enum name. On 1.8.x servers this means the EnumParticle name used by v1_8_R3.

Project structure

Module Purpose
api The public IParticle interface
bootstrap Version detection and the YggraParticle facade
implementation/impl_v1_8_8 1.8.x – 1.9.3 implementation
implementation/impl_v1_9_4 1.9.4+ implementation
plugin-test Example plugin showing runtime usage

Requirements

  • A Spigot or Paper server running a supported Minecraft version.
  • Java 8+ at runtime for the published library modules.
  • JDK 25 with the included Gradle wrapper to build the project.

Building from source

You only need this when you want to build the library yourself. To consume a released version, use itPack instead.

./gradlew build

The library JAR is written to:

bootstrap/build/libs/yggraParticle-0.1.0.jar

This JAR contains the API, the bootstrap facade, and both bundled implementations.

To build the example plugin:

./gradlew :plugin-test:shadowJar

The result is plugin-test/build/libs/yggraParticle-test-1.0.0.jar.

Usage

1. Add the library to your plugin

From JitPack (recommended)

JitPack builds the library from this repository, so there is no need to clone or build it locally. Add the JitPack repository.

Gradle (Kotlin DSL):

repositories {
    mavenCentral()
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.TavstalDev:yggraParticle:<version>")
}

Gradle (Groovy DSL):

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.TavstalDev:yggraParticle:<version>'
}

Maven:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.TavstalDev</groupId>
        <artifactId>yggraParticle</artifactId>
        <version>replace-with-version</version>
    </dependency>
</dependencies>

Use a GitHub release tag as the version (v0.1.0 above). JitPack also accepts a short commit hash or <branch>-SNAPSHOT (for example stable-SNAPSHOT) for unreleased changes. The first time a version is requested JitPack builds it on demand, so the initial resolution may take a few minutes. Shade the resolved JAR into your plugin as you would with any other dependency.

From a local build

Shade the produced library JAR into your plugin. If you build this repository as part of your project, you can depend on the shaded bootstrap artifact directly:

dependencies {
    implementation(project(":bootstrap", configuration = "shadow")) {
        isTransitive = false
    }
}

If you use the pre-built JAR, add it as a local dependency:

dependencies {
    implementation(files("libs/yggraParticle-0.1.0.jar"))
}

2. Create the facade

Create one YggraParticle instance during onEnable and reuse it for the lifetime of the plugin:

import com.github.TavstalDev.yggraParticle.api.IParticle;
import com.github.TavstalDev.yggraParticle.bootstrap.YggraParticle;
import org.bukkit.plugin.java.JavaPlugin;

public final class MyPlugin extends JavaPlugin {

    private IParticle particles;

    @Override
    public void onEnable() {
        particles = new YggraParticle(this);
    }
}

YggraParticle implements IParticle, so you can store it as either type.

3. Spawn particles

import org.bukkit.Location;
import org.bukkit.entity.Player;

public void showEffect(Player player) {
    Location location = player.getLocation();

    // Spawn a single particle.
    particles.spawn(location, "HEART");

    // Spawn 10 particles.
    particles.spawn(location, "HEART", 10);

    // Spawn 10 particles with a uniform offset and speed.
    particles.spawn(location, "HEART", 10, 1.0, 0.5);

    // Spawn 10 particles with per-axis offsets and speed.
    particles.spawn(location, "HEART", 10, 1.0, 0.5, 1.0, 0.2);
}

API overview

public interface IParticle {

    void spawn(Location location, String particleName);

    void spawn(Location location, String particleName, int count);

    void spawn(Location location, String particleName, int count, double offset, double speed);

    void spawn(Location location, String particleName, int count,
               double offsetX, double offsetY, double offsetZ, double speed);
}
Method Description
spawn(Location, String) Spawns a single particle.
spawn(Location, String, int) Spawns the specified number of particles.
spawn(Location, String, int, double, double) Spawns particles with a uniform offset on each axis and a speed value.
spawn(Location, String, int, double, double, double, double) Spawns particles with per-axis offsets and a speed value.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

For issues or feature requests, use the GitHub issue tracker.

About

A small, version-aware library for spawning particle effects from Spigot/Paper plugins.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages