11package vg .civcraft .mc .civmodcore .particles ;
22
3- import org .bukkit .Effect ;
43import org .bukkit .Location ;
4+ import org .bukkit .Particle ;
55
66public class ParticleEffect {
77
8- private Effect effect ;
9-
10- private int id ;
11-
12- private int data ;
8+ private Particle particle ;
139
1410 private float offsetX ;
1511
@@ -21,40 +17,20 @@ public class ParticleEffect {
2117
2218 private int particleCount ;
2319
24- private int viewDistance ;
25-
26- public ParticleEffect (Effect effect , int id , int data , float offsetX , float offsetY , float offsetZ , float speed ,
27- int particleCount , int viewDistance ) {
28- this .effect = effect ;
29- this .id = id ;
30- this .data = data ;
20+ public ParticleEffect (Particle particle , float offsetX , float offsetY , float offsetZ , float speed , int particleCount ) {
21+ this .particle = particle ;
3122 this .offsetX = offsetX ;
3223 this .offsetY = offsetY ;
3324 this .offsetZ = offsetZ ;
3425 this .speed = speed ;
3526 this .particleCount = particleCount ;
36- this .viewDistance = viewDistance ;
3727 }
3828
3929 /**
4030 * @return the type of particle used in this effect
4131 */
42- public Effect getEffect () {
43- return effect ;
44- }
45-
46- /**
47- * @return the item/block/data id for the effect
48- */
49- public int getId () {
50- return id ;
51- }
52-
53- /**
54- * @return the data value of the block/item for the effect
55- */
56- public int getData () {
57- return data ;
32+ public Particle getParticle () {
33+ return particle ;
5834 }
5935
6036 /**
@@ -92,30 +68,20 @@ public int getParticleCount() {
9268 return particleCount ;
9369 }
9470
95- /**
96- * @return the distance from which players will be able to see the effect.
97- */
98- public int getViewDistance () {
99- return viewDistance ;
100- }
101-
10271 /**
10372 * Display an effect defined in the config around a reinforcement.
10473 *
10574 * @param location
10675 * the location of the reinforcement.
10776 */
10877 public void playEffect (Location location ) {
109- location .getWorld ().spigot ()
110- .playEffect (location , effect , id , data , offsetX , offsetY , offsetZ , speed , particleCount , viewDistance );
78+ location .getWorld ().spawnParticle (particle , location , particleCount , offsetX , offsetY , offsetZ , speed , null );
11179 }
11280
11381 @ Override
11482 public String toString () {
115- return String .format (
116- " type: %s \n id: %d \n data: %d \n offsetX: %f \n offsetY: %f \n offsetZ: %f \n speed:"
117- + " " + "%f \n particleCount: %d \n viewDistance: %d" , effect , id , data , offsetX , offsetY ,
118- offsetZ , speed , particleCount , viewDistance );
83+ return String .format (" type: %s \n offsetX: %f \n offsetY: %f \n offsetZ: %f \n speed:"
84+ + " " + "%f \n particleCount: %d" , particle , offsetX , offsetY , offsetZ , speed , particleCount );
11985 }
12086
12187}
0 commit comments