From 183c523d33e846699eefddbec502471cec1ffd95 Mon Sep 17 00:00:00 2001 From: Nelson Sexton Date: Wed, 3 Jul 2024 17:59:14 -0600 Subject: [PATCH] Fix V command exception Thanks ItsRodrigoAl! --- CHANGELOG.md | 5 +++++ Rocket.Unturned/Commands/CommandV.cs | 6 +++--- Rocket.Unturned/Properties/AssemblyInfo.cs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c852119..2202aa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes should be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 4.9.3.17 - 2024-07-03 + +### Fixed +- V command expecting `VehicleAsset` throwing an exception when encountering `VehicleRedirectorAsset`. Thanks @ItsRodrigoAl in issue #75. + ## 4.9.3.16 - 2023-10-13 ### Changed diff --git a/Rocket.Unturned/Commands/CommandV.cs b/Rocket.Unturned/Commands/CommandV.cs index 18f7a1d..64e8914 100644 --- a/Rocket.Unturned/Commands/CommandV.cs +++ b/Rocket.Unturned/Commands/CommandV.cs @@ -66,9 +66,9 @@ public void Execute(IRocketPlayer caller, string[] command) } Asset[] assets = SDG.Unturned.Assets.find(EAssetType.VEHICLE); - foreach (VehicleAsset ia in assets) + foreach (Asset ia in assets) { - if (ia != null && ia.vehicleName != null && ia.vehicleName.ToLower().Contains(itemString.ToLower())) + if (ia != null && ia.FriendlyName != null && ia.FriendlyName.ToLower().Contains(itemString.ToLower())) { id = ia.id; break; @@ -82,7 +82,7 @@ public void Execute(IRocketPlayer caller, string[] command) } Asset a = SDG.Unturned.Assets.find(EAssetType.VEHICLE, id.Value); - string assetName = ((VehicleAsset)a).vehicleName; + string assetName = a.FriendlyName; // Nelson 2024-07-03: Didn't previously check for null either. if(U.Settings.Instance.EnableVehicleBlacklist && !player.HasPermission("vehicleblacklist.bypass")) { diff --git a/Rocket.Unturned/Properties/AssemblyInfo.cs b/Rocket.Unturned/Properties/AssemblyInfo.cs index 7944f8b..52c3efd 100644 --- a/Rocket.Unturned/Properties/AssemblyInfo.cs +++ b/Rocket.Unturned/Properties/AssemblyInfo.cs @@ -6,4 +6,4 @@ [assembly: AssemblyProduct("Rocket.Unturned")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: Guid("8870d132-f877-4fbd-9e73-49c8b1af8b3f")] -[assembly: AssemblyVersion("4.9.3.16")] \ No newline at end of file +[assembly: AssemblyVersion("4.9.3.17")] \ No newline at end of file