public void SetEntityRestriction(EntityRestrictionEnum restriction, bool value) { if (value) { if (!HasEntityRestriction(restriction)) { EntityRestriction |= (int)restriction; } } else { if (HasEntityRestriction(restriction)) { EntityRestriction ^= (int)restriction; } } }