# Solved Creating a circle around a location without packets/libs?

Discussion in 'Spigot Plugin Development' started by danablend, May 14, 2016.

1. ### danablend

I have tried doing following thing but I think im messing with the offsets because when i play the effect it splatters everywhere around the location instead of in the circle i want. This is my current code:
Code (Text):
public void createCircle(Location loc) {
for (double y = 0; y <= 50; y += 0.5) {
double x = radius * Math.cos(y);
double z = radius * Math.sin(y);
Location circle = new Location(loc.getWorld(), (float) (loc.getX() + x) + 0.5f, (float) loc.getY() + 0.3f, (float) (loc.getZ() + z) + 0.5f);
loc.getWorld().spigot().playEffect(circle, Effect.FLAME, 1, 1, 0f, 0f, 0f, 1, 50, 1);
}
}
Note that I have done this with packets and it worked, so the formular is working and all. Reason for me not sticking to packets is because its causing massive lags on servers.

2. ### danablend

Bump, still not resolved.

Bump

4. ### finnbon

EDIT: Also, to create a full circle, don't use your current for-loop. Use
Code (Java):

/* increase 10 for a smaller space between the particles */
for (double a = 0; a < Math.PI * 2; a += Math.PI / 10) {
// ...
}

5. ### danablend

@finnbon Thanks, but the particles still jump all over the location. Also I can't use world.spawnParticles() as this plugin is for 1.8.8 and World.spawnParticle is 1.9+

#5
Last edited: May 16, 2016
6. ### finnbon

Make sure you set all the offsets to 0, as well as the speed.

7. ### danablend

Thank you allot! I had speed set to 0.75, I actually thought that speed was the speed for the particles to dissapear, but apparently not, thanks bro it works now!

• Friendly x 1
8. ### Leniency

Can I use this too?

9. ### finnbon

Of course, it's not mine