### Gradle Setup for PlayerParticles
Source: https://github.com/rosewood-development/playerparticles/wiki/API-Getting-Started
Add the PlayerParticles dependency to your project using Gradle. Ensure you have the correct repository configured.
```groovy
repositories {
maven {
url = 'https://repo.rosewooddev.io/repository/public/'
}
}
dependencies {
implementation 'dev.esophose:playerparticles:$VERSION$'
}
```
--------------------------------
### Getting PlayerParticles API Instance
Source: https://github.com/rosewood-development/playerparticles/wiki/API-Getting-Started
Acquire an instance of the PlayerParticlesAPI within your Bukkit plugin. Check if the plugin is enabled before attempting to get the instance.
```java
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class Example extends JavaPlugin {
private PlayerParticlesAPI ppAPI;
@Override
public void onEnable() {
if (Bukkit.getPluginManager().isPluginEnabled("PlayerParticles")) {
this.ppAPI = PlayerParticlesAPI.getInstance();
}
// When you want to access the API, check if the instance is null
if (this.ppAPI != null) {
// Do stuff with the API here
}
}
}
```
--------------------------------
### Maven Setup for PlayerParticles
Source: https://github.com/rosewood-development/playerparticles/wiki/API-Getting-Started
Add the PlayerParticles dependency to your project using Maven. Ensure you have the correct repository configured.
```xml
rwd-repo
https://repo.rosewooddev.io/repository/public/
dev.esophose
playerparticles
$VERSION$
provided
```
--------------------------------
### Implement ParticleStyle Interface
Source: https://github.com/rosewood-development/playerparticles/wiki/API-Custom-Styles
This class implements the ParticleStyle interface to define a custom particle effect. It includes logic for generating particle positions in a circular pattern around the player.
```java
public class ExampleParticleStyle implements ParticleStyle {
private int step = 0;
private final int maxStep = 20;
private final double radius = 1.25;
private final int amount = 5;
private final double spread = 0.1;
private final double speed = 0.05;
@Override
public List getParticles(ParticlePair particle, Location location) {
List particles = new ArrayList<>();
double angle = Math.PI * 2 * (this.step / (double) this.maxStep);
double x = Math.cos(angle) * this.radius;
double z = Math.sin(angle) * this.radius;
Location point = location.clone().add(x, 0, z);
for (int i = 0; i < this.amount; i++)
particles.add(new PParticle(point, this.spread, this.spread, this.spread, this.speed));
return particles;
}
@Override
public void updateTimers() {
this.step = (this.step + 1) % this.maxStep;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public String getInternalName() {
return "test";
}
@Override
public Material getGuiIconMaterial() {
return Material.EMERALD;
}
@Override
public boolean canBeFixed() {
return true;
}
@Override
public boolean canToggleWithMovement() {
return true;
}
@Override
public double getFixedEffectOffset() {
return 0;
}
}
```
--------------------------------
### Register Custom Particle Style
Source: https://github.com/rosewood-development/playerparticles/wiki/API-Custom-Styles
This class demonstrates how to register a custom particle style with the PlayerParticles plugin. It listens for the ParticleStyleRegistrationEvent and registers an instance of the custom style.
```java
public class ExamplePlugin extends JavaPlugin implements Listener {
private static final ParticleStyle EXAMPLE_STYLE = new ExampleParticleStyle();
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onParticleStyleRegistration(ParticleStyleRegistrationEvent event) {
event.registerStyle(EXAMPLE_STYLE);
}
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.