Alessandrv's Enchantments

Alessandrv's Enchantments

15.1k Downloads

ExplosiveEnchantment crashes due to null damage source

Linguardium opened this issue ยท 0 comments

commented

damageSource is not initialized here, so it is null. it is also private so it is not referenced by any super or child classes and must be set within this class.

super(world, entity, x, y, z, power, createFire, destructionType);
this.random = Random.create();
this.affectedBlocks = new ObjectArrayList();
this.affectedPlayers = Maps.newHashMap();
this.world = world;
this.entity = entity;
this.power = power;
this.x = x;
this.y = y;
this.z = z;
this.createFire = createFire;
this.destructionType = destructionType;

damageSource is not set in the constructor, so it will be null after object creation.

public DamageSource getDamageSource() {
return this.damageSource;
}

this.getDamageSource will always return null, because the damage source was never set

you pass the null to the damage method

This crashes https://mclo.gs/G1ly2i7