Issue:
The permissions "vehiclelicence.nodamage" and "vehiclelicence.nocollisiondamage" do not work when the global setting "Vehicle No Decay" is set to "false" in the configuration, even when individual vehicles have "No Damage": true and "No Collision Damage": true enabled.
Root Cause:
In the OnServerInitialized method, the OnEntityTakeDamage hook is only subscribed when configData.global.noDecay is true:
if (configData.global.noDecay)
{
Subscribe(nameof(OnEntityTakeDamage));
}This means that if "Vehicle No Decay": false, the hook is never called, and the damage protection logic in OnEntityTakeDamage never executes, regardless of whether players have the appropriate permissions or vehicles have damage protection enabled.
Proposed Fix:
The hook should also be subscribed when any vehicle has NoDamage or NoCollisionDamage enabled in the configuration:
if (configData.global.noDecay || allVehicleSettings.Any(x => x.Value.NoDamage || x.Value.NoCollisionDamage))
{
Subscribe(nameof(OnEntityTakeDamage));
}Version:
Vehicle Licence 1.8.8