[SPIGOT-7633] NPE When Creating A Particle Created: 25/Apr/24 Updated: 25/Dec/24 Resolved: 25/Apr/24 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Metallic Goat | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Fedora 39 |
||
| Version: | 1.20.5 |
| Guidelines Read: | Yes |
| Description |
|
I cannot provide a jar to test at this moment, if it is required (though I think it shouldn't be) I can send one sometime tomorrow.
Spawn a particle like so: loc.getWorld().spawnParticle( // Line 1150 this.particle, loc, this.count, this.offsetX, this.offsetY, this.offsetZ, this.extra, this.data ); You may receive an error like: [22:52:28] [MBedwars: ARENA_TICKER/WARN]: java.lang.NullPointerException: Cannot invoke "org.bukkit.Color.asARGB()" because "color" is null [22:52:28] [MBedwars: ARENA_TICKER/WARN]: at org.bukkit.craftbukkit.v1_20_R4.CraftParticle$CraftParticleRegistry$9.createParticleParam(CraftParticle.java:180) [22:52:28] [MBedwars: ARENA_TICKER/WARN]: at org.bukkit.craftbukkit.v1_20_R4.CraftParticle$CraftParticleRegistry$9.createParticleParam(CraftParticle.java:177) [22:52:28] [MBedwars: ARENA_TICKER/WARN]: at org.bukkit.craftbukkit.v1_20_R4.CraftParticle.createParticleParam(CraftParticle.java:70) [22:52:28] [MBedwars: ARENA_TICKER/WARN]: at org.bukkit.craftbukkit.v1_20_R4.CraftWorld.spawnParticle(CraftWorld.java:1884) [22:52:28] [MBedwars: ARENA_TICKER/WARN]: at org.bukkit.craftbukkit.v1_20_R4.CraftWorld.spawnParticle(CraftWorld.java:1868) [22:52:28] [MBedwars: ARENA_TICKER/WARN]: at org.bukkit.craftbukkit.v1_20_R4.CraftWorld.spawnParticle(CraftWorld.java:1863) [22:52:28] [MBedwars: ARENA_TICKER/WARN]: at de.marcely.bedwars.tools.VarParticle$TypeV9Particle.play(VarParticle.java:1150)
I believe a null check for color just needs to be added here in CraftParticle
BiFunction<NamespacedKey, ParticleType<?>, CraftParticle<?>> colorFunction = (name, particle) -> {
return new CraftParticle<Color>(name, particle, Color.class) {
public ParticleOptions createParticleParam(Color color) {
return ColorParticleOption.create(particle, color.asARGB());
}
};
};
Its late, I apologize for the limited info and no test jar. I can create one in the morning if needed. |
| Comments |
| Comment by md_5 [ 25/Apr/24 ] |
|
The error message is now clearer |
| Comment by md_5 [ 25/Apr/24 ] |
|
Sounds like you're not providing data for a particle which requires it |