@@ -142,27 +142,28 @@ public Object getParticleData(MCLocation l, Object data) {
142
142
}
143
143
case TRAIL :
144
144
if (Static .getServer ().getMinecraftVersion ().gte (MCVersion .MC1_21_4 )) {
145
+ if (data instanceof MCParticleData .Trail trail ) {
146
+ return new Particle .Trail ((Location ) trail .location ().getHandle (),
147
+ BukkitMCColor .GetColor (trail .color ()), trail .duration ());
148
+ } else {
149
+ return new Particle .Trail ((Location ) l .getHandle (), Color .fromRGB (252 , 120 , 18 ),
150
+ new Random ().nextInt (40 ) + 10 );
151
+ }
152
+ } else {
153
+ // 1.21.3 only
154
+ Class clazz = null ;
145
155
try {
146
- Class clazz = Class .forName ("org.bukkit.Particle$Trail " );
147
- Constructor constructor = clazz .getConstructor (Location .class , Color .class , int . class );
156
+ clazz = Class .forName ("org.bukkit.Particle$TargetColor " );
157
+ Constructor constructor = clazz .getConstructor (Location .class , Color .class );
148
158
constructor .setAccessible (true );
149
159
if (data instanceof MCParticleData .Trail trail ) {
150
160
return constructor .newInstance ((Location ) trail .location ().getHandle (),
151
- BukkitMCColor .GetColor (trail .color ()), trail . duration () );
161
+ BukkitMCColor .GetColor (trail .color ()));
152
162
} else {
153
- return constructor .newInstance ((Location ) l .getHandle (), Color .fromRGB (252 , 120 , 18 ),
154
- new Random ().nextInt (40 ) + 10 );
163
+ return constructor .newInstance ((Location ) l .getHandle (), Color .fromRGB (252 , 120 , 18 ));
155
164
}
156
165
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException
157
166
| IllegalAccessException | InvocationTargetException ignore ) {}
158
- } else {
159
- // 1.21.3 only
160
- if (data instanceof MCParticleData .Trail trail ) {
161
- return new Particle .TargetColor ((Location ) trail .location ().getHandle (),
162
- BukkitMCColor .GetColor (trail .color ()));
163
- } else {
164
- return new Particle .TargetColor ((Location ) l .getHandle (), Color .fromRGB (252 , 120 , 18 ));
165
- }
166
167
}
167
168
}
168
169
return null ;
0 commit comments