use of com.gmail.stefvanschiedev.buildinggame.utils.particle.Particle in project buildinggame by stefvanschie.
the class ParticlesMenu method particleClick.
/**
* Called whenever a user clicks on a particle item
*
* @param event the event called when clicking
* @since 5.6.0
*/
public void particleClick(InventoryClickEvent event, org.bukkit.Particle particleType) {
var player = (Player) event.getWhoClicked();
var arena = ArenaManager.getInstance().getArena(player);
if (arena == null)
return;
Location location = player.getLocation();
Plot plot = arena.getPlot(player);
if (particleType == org.bukkit.Particle.FALLING_DUST) {
Particle particle;
if (event.getCursor() == null) {
particle = new FallingDustParticle(location, Bukkit.createBlockData(Material.SAND));
} else {
particle = new FallingDustParticle(location, Bukkit.createBlockData(event.getCursor().getType()));
}
plot.addParticle(particle, player);
} else if (particleType == org.bukkit.Particle.REDSTONE) {
plot.addParticle(new RedstoneParticle(location), player);
} else {
plot.addParticle(new Particle(location, particleType), player);
}
event.setCancelled(true);
}
Aggregations