From 8d88cfadf7153a6a75b27c2db7665dfeedd90eff Mon Sep 17 00:00:00 2001 From: SBDeveloper Date: Sat, 14 Dec 2024 10:59:22 +0100 Subject: [PATCH] Resolved sound conversion issue --- .../vehiclesplusconverter/VehiclesPlusConverter.java | 4 ++-- .../vehiclesplusconverter/handlers/Converter.java | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/tech/sbdevelopment/vehiclesplusconverter/VehiclesPlusConverter.java b/src/main/java/tech/sbdevelopment/vehiclesplusconverter/VehiclesPlusConverter.java index 17bbac4..9602116 100644 --- a/src/main/java/tech/sbdevelopment/vehiclesplusconverter/VehiclesPlusConverter.java +++ b/src/main/java/tech/sbdevelopment/vehiclesplusconverter/VehiclesPlusConverter.java @@ -30,8 +30,8 @@ public final class VehiclesPlusConverter extends JavaPlugin { } Version versionNew = Version.of(Bukkit.getPluginManager().getPlugin("VehiclesPlus").getDescription().getVersion()); - if (versionNew.isOlderThan(Version.of("3.0.1"))) { - Bukkit.getLogger().severe("Your VehiclesPlus v3 plugin is too old! Please update to at least v3.0.1!"); + if (versionNew.isOlderThan(Version.of("3.0.2"))) { + Bukkit.getLogger().severe("Your VehiclesPlus v3 plugin is too old! Please update to at least v3.0.2!"); Bukkit.getPluginManager().disablePlugin(this); return; } diff --git a/src/main/java/tech/sbdevelopment/vehiclesplusconverter/handlers/Converter.java b/src/main/java/tech/sbdevelopment/vehiclesplusconverter/handlers/Converter.java index 96e562c..c0964af 100644 --- a/src/main/java/tech/sbdevelopment/vehiclesplusconverter/handlers/Converter.java +++ b/src/main/java/tech/sbdevelopment/vehiclesplusconverter/handlers/Converter.java @@ -23,6 +23,7 @@ import nl.sbdeveloper.vehiclesplus.api.vehicles.settings.impl.*; import nl.sbdeveloper.vehiclesplus.storage.db.exceptions.DataStorageException; import nl.sbdeveloper.vehiclesplus.utils.jackson.ColorList; import org.bukkit.Bukkit; +import org.bukkit.Sound; import org.bukkit.command.CommandSender; import org.bukkit.scheduler.BukkitRunnable; import tech.sbdevelopment.vehiclesplusconverter.VehiclesPlusConverter; @@ -30,6 +31,7 @@ import tech.sbdevelopment.vehiclesplusconverter.api.ConversionException; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.UUID; import static tech.sbdevelopment.vehiclesplusconverter.utils.MainUtil.*; @@ -227,7 +229,8 @@ public class Converter { .horn(new Horn( baseVehicle.getHornSettings().getEnabled(), new Sounds.Sound( - baseVehicle.getHornSettings().getSound().parseSound().name(), + Optional.ofNullable(baseVehicle.getHornSettings().getSound().get()) + .orElse(Sound.BLOCK_NOTE_BLOCK_BASS).getKey().toString(), 1 ) )) @@ -276,7 +279,7 @@ public class Converter { saveToVehiclesPlus(model, "vehicles/" + model.getTypeId(), model.getId()); } catch (Exception e) { - e.printStackTrace(); + VehiclesPlusConverter.getInstance().getLogger().log(java.util.logging.Level.SEVERE, "Could not convert vehicle model: " + baseVehicle.getName(), e); } } }