Compare commits

..

2 Commits

2 changed files with 22 additions and 16 deletions

18
pom.xml
View File

@ -6,13 +6,14 @@
<groupId>tech.sbdevelopment</groupId> <groupId>tech.sbdevelopment</groupId>
<artifactId>VehiclesPlusConverter</artifactId> <artifactId>VehiclesPlusConverter</artifactId>
<version>0.1.4</version> <version>0.1.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>VehiclesPlusConverter</name> <name>VehiclesPlusConverter</name>
<description>Conversion plugin for v2 to v3.</description> <description>Conversion plugin for v2 to v3.</description>
<properties> <properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<url>sbdevelopment.tech</url> <url>sbdevelopment.tech</url>
@ -22,15 +23,16 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version> <version>3.8.1</version>
<configuration> <configuration>
<release>11</release> <source>10</source>
<target>10</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version> <version>3.2.4</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -67,22 +69,22 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version> <version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>nl.sbdeveloper</groupId> <groupId>nl.sbdeveloper</groupId>
<artifactId>VehiclesPlus-v2</artifactId> <artifactId>VehiclesPlus-v2</artifactId>
<version>2.4.6.2</version> <version>2.4.4.1</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/src/libs/VehiclesPlus-2.4.6.2.jar</systemPath> <systemPath>${project.basedir}/src/libs/VehiclesPlus-2.4.4.1.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>nl.sbdeveloper</groupId> <groupId>nl.sbdeveloper</groupId>
<artifactId>VehiclesPlus-v3</artifactId> <artifactId>VehiclesPlus-v3</artifactId>
<version>3.0.0-SNAPSHOT</version> <version>3.0.0-SNAPSHOT</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/src/libs/VehiclesPlus-3.0.0-SNAPSHOT-Clean.jar</systemPath> <systemPath>${project.basedir}/src/libs/VehiclesPlus-3.0.0-SNAPSHOT.jar</systemPath>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -23,6 +23,7 @@ import nl.sbdeveloper.vehiclesplus.api.vehicles.settings.impl.*;
import nl.sbdeveloper.vehiclesplus.storage.db.exceptions.DataStorageException; import nl.sbdeveloper.vehiclesplus.storage.db.exceptions.DataStorageException;
import nl.sbdeveloper.vehiclesplus.utils.jackson.ColorList; import nl.sbdeveloper.vehiclesplus.utils.jackson.ColorList;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Particle;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import tech.sbdevelopment.vehiclesplusconverter.VehiclesPlusConverter; import tech.sbdevelopment.vehiclesplusconverter.VehiclesPlusConverter;
@ -212,7 +213,7 @@ public class Converter {
.horn(new Horn( .horn(new Horn(
baseVehicle.getHornSettings().getEnabled(), baseVehicle.getHornSettings().getEnabled(),
new Sounds.Sound( new Sounds.Sound(
baseVehicle.getHornSettings().getSound().parseSound().name(), baseVehicle.getHornSettings().getSound().name(),
1 1
) )
)) ))
@ -222,7 +223,7 @@ public class Converter {
baseVehicle.getExhaustSettings().getXOffset(), baseVehicle.getExhaustSettings().getXOffset(),
baseVehicle.getExhaustSettings().getYOffset(), baseVehicle.getExhaustSettings().getYOffset(),
baseVehicle.getExhaustSettings().getZOffset(), baseVehicle.getExhaustSettings().getZOffset(),
baseVehicle.getExhaustSettings().getParticle().get() Particle.valueOf(baseVehicle.getExhaustSettings().getParticleName())
)) ))
.exitWhileMoving(baseVehicle.getCanExitWhileMoving()) .exitWhileMoving(baseVehicle.getCanExitWhileMoving())
.price(baseVehicle.getPrice()) .price(baseVehicle.getPrice())
@ -239,9 +240,10 @@ public class Converter {
)) ))
.realisticSteering(baseVehicle.getSteeringType()) .realisticSteering(baseVehicle.getSteeringType())
.permissions(Permissions.builder() .permissions(Permissions.builder()
.buy(baseVehicle.getPermissions().getBuyPermission()) // this was hardcoded because if a config had no permission it produced a null pointer.
.ride(baseVehicle.getPermissions().getRidePermission()) .buy("vp.buy." + baseVehicle.getName())
.sitWithoutRidePermission(baseVehicle.getPermissions().getEnterWithoutRidePermission()) .ride("vp.ride." + baseVehicle.getName())
.sitWithoutRidePermission(false)
.adjust("vp.adjust." + baseVehicle.getName()) .adjust("vp.adjust." + baseVehicle.getName())
.spawn("vp.spawn." + baseVehicle.getName()) .spawn("vp.spawn." + baseVehicle.getName())
.build()) .build())
@ -249,6 +251,10 @@ public class Converter {
.gearbox(new Gearbox(true, 10)) .gearbox(new Gearbox(true, 10))
.build(); .build();
// Idk why but it was detecting type as "car" and it should be "cars" to work
if (model.getTypeId().equals("car"))
model.setTypeId("cars");
saveToVehiclesPlus(model, "vehicles/" + model.getTypeId(), model.getId()); saveToVehiclesPlus(model, "vehicles/" + model.getTypeId(), model.getId());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -270,9 +276,7 @@ public class Converter {
for (StorageVehicle vehicle : set.getValue()) { for (StorageVehicle vehicle : set.getValue()) {
try { try {
nl.sbdeveloper.vehiclesplus.api.vehicles.impl.StorageVehicle newVehicle = new nl.sbdeveloper.vehiclesplus.api.vehicles.impl.StorageVehicle( nl.sbdeveloper.vehiclesplus.api.vehicles.impl.StorageVehicle newVehicle = new nl.sbdeveloper.vehiclesplus.api.vehicles.impl.StorageVehicle(
UUID.randomUUID(), nl.sbdeveloper.vehiclesplus.api.VehiclesPlusAPI.getVehicleModels().values().stream().filter(v -> v.getId().equalsIgnoreCase(vehicle.getBaseVehicle())).findFirst().orElseThrow(() -> new ConversionException("No VehicleModel found for", vehicle.getUuid()))
nl.sbdeveloper.vehiclesplus.api.VehiclesPlusAPI.getVehicleModels().values().stream().filter(v -> v.getId().equalsIgnoreCase(vehicle.getBaseVehicle())).findFirst().orElseThrow(() -> new ConversionException("No VehicleModel found for", vehicle.getUuid())),
false
); );
newVehicle.forceSave(); newVehicle.forceSave();