Compare commits
No commits in common. "master" and "0.1.3" have entirely different histories.
20
pom.xml
20
pom.xml
|
@ -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.3.5</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.3.5.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-PRE3</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-PRE3.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
|
||||||
}
|
|
|
@ -21,8 +21,8 @@ import nl.sbdeveloper.vehiclesplus.api.vehicles.VehicleModel;
|
||||||
import nl.sbdeveloper.vehiclesplus.api.vehicles.settings.UpgradableSetting;
|
import nl.sbdeveloper.vehiclesplus.api.vehicles.settings.UpgradableSetting;
|
||||||
import nl.sbdeveloper.vehiclesplus.api.vehicles.settings.impl.*;
|
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 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;
|
||||||
|
@ -100,11 +100,11 @@ public class Converter {
|
||||||
private static void convertVehicleModels() {
|
private static void convertVehicleModels() {
|
||||||
for (BaseVehicle baseVehicle : VehiclesPlusAPI.getVehicleManager().getBaseVehicleMap().values()) {
|
for (BaseVehicle baseVehicle : VehiclesPlusAPI.getVehicleManager().getBaseVehicleMap().values()) {
|
||||||
try {
|
try {
|
||||||
VehicleModel.Builder vehicleModelBuilder = VehicleModel.builder()
|
VehicleModel.VehicleModelBuilder vehicleModelBuilder = VehicleModel.builder()
|
||||||
.id(baseVehicle.getName())
|
.id(baseVehicle.getName())
|
||||||
.displayName(baseVehicle.getName())
|
.displayName(baseVehicle.getName())
|
||||||
.typeId(getTypeIdByClass(baseVehicle.getName(), getClassByFullName(baseVehicle.getVehicleType())))
|
.typeId(getTypeIdByClass(baseVehicle.getName(), getClassByFullName(baseVehicle.getVehicleType())))
|
||||||
.availableColors(new ColorList(baseVehicle.getBaseColorList()));
|
.availableColors(baseVehicle.getBaseColorList());
|
||||||
|
|
||||||
for (Part part : baseVehicle.getPartList()) {
|
for (Part part : baseVehicle.getPartList()) {
|
||||||
if (part instanceof BikeSeat) {
|
if (part instanceof BikeSeat) {
|
||||||
|
@ -175,9 +175,8 @@ public class Converter {
|
||||||
wheel.getXOffset(),
|
wheel.getXOffset(),
|
||||||
wheel.getYOffset(),
|
wheel.getYOffset(),
|
||||||
wheel.getZOffset(),
|
wheel.getZOffset(),
|
||||||
nl.sbdeveloper.vehiclesplus.api.VehiclesPlusAPI.getRimDesign(VehiclesPlus.getVehicleManager().getRimDesignHashMap().values().stream().findFirst().orElseThrow(() -> new ConversionException("No RimDesign found while loading Wheel in file", baseVehicle.getName())).getName()).orElseThrow(() -> new ConversionException("No matching RimDesign found while loading Wheel in file", baseVehicle.getName())),
|
VehiclesPlus.getVehicleManager().getRimDesignHashMap().values().stream().findFirst().orElseThrow(() -> new ConversionException("No RimDesign found while loading Wheel in file", baseVehicle.getName())).getName(),
|
||||||
wheel.getColor(),
|
wheel.getColor(),
|
||||||
HolderItemPosition.HEAD,
|
|
||||||
wheel.getSteering(),
|
wheel.getSteering(),
|
||||||
wheel.getRotationOffset()
|
wheel.getRotationOffset()
|
||||||
));
|
));
|
||||||
|
@ -189,32 +188,29 @@ public class Converter {
|
||||||
baseVehicle.getSpeedSettings().getBase(),
|
baseVehicle.getSpeedSettings().getBase(),
|
||||||
baseVehicle.getSpeedSettings().getMax(),
|
baseVehicle.getSpeedSettings().getMax(),
|
||||||
baseVehicle.getSpeedSettings().getStep(),
|
baseVehicle.getSpeedSettings().getStep(),
|
||||||
baseVehicle.getSpeedSettings().getUpgradeCost(), "km/h"
|
baseVehicle.getSpeedSettings().getUpgradeCost()
|
||||||
))
|
))
|
||||||
.fuelTank(new UpgradableSetting(
|
.fuelTank(new UpgradableSetting(
|
||||||
baseVehicle.getFuelTankSettings().getBase(),
|
baseVehicle.getFuelTankSettings().getBase(),
|
||||||
baseVehicle.getFuelTankSettings().getMax(),
|
baseVehicle.getFuelTankSettings().getMax(),
|
||||||
baseVehicle.getFuelTankSettings().getStep(),
|
baseVehicle.getFuelTankSettings().getStep(),
|
||||||
baseVehicle.getFuelTankSettings().getUpgradeCost(), "L"
|
baseVehicle.getFuelTankSettings().getUpgradeCost()
|
||||||
))
|
))
|
||||||
.turningRadius(new UpgradableSetting(
|
.turningRadius(new UpgradableSetting(
|
||||||
baseVehicle.getTurningRadiusSettings().getBase(),
|
baseVehicle.getTurningRadiusSettings().getBase(),
|
||||||
baseVehicle.getTurningRadiusSettings().getMax(),
|
baseVehicle.getTurningRadiusSettings().getMax(),
|
||||||
baseVehicle.getTurningRadiusSettings().getStep(),
|
baseVehicle.getTurningRadiusSettings().getStep(),
|
||||||
baseVehicle.getTurningRadiusSettings().getUpgradeCost(), ""
|
baseVehicle.getTurningRadiusSettings().getUpgradeCost()
|
||||||
))
|
))
|
||||||
.acceleration(new UpgradableSetting(
|
.acceleration(new UpgradableSetting(
|
||||||
baseVehicle.getAccelerationSettings().getBase(),
|
baseVehicle.getAccelerationSettings().getBase(),
|
||||||
baseVehicle.getAccelerationSettings().getMax(),
|
baseVehicle.getAccelerationSettings().getMax(),
|
||||||
baseVehicle.getAccelerationSettings().getStep(),
|
baseVehicle.getAccelerationSettings().getStep(),
|
||||||
baseVehicle.getAccelerationSettings().getUpgradeCost(), ""
|
baseVehicle.getAccelerationSettings().getUpgradeCost()
|
||||||
))
|
))
|
||||||
.horn(new Horn(
|
.horn(new Horn(
|
||||||
baseVehicle.getHornSettings().getEnabled(),
|
baseVehicle.getHornSettings().getEnabled(),
|
||||||
new Sounds.Sound(
|
baseVehicle.getHornSettings().getSound().name()
|
||||||
baseVehicle.getHornSettings().getSound().parseSound().name(),
|
|
||||||
1
|
|
||||||
)
|
|
||||||
))
|
))
|
||||||
.drift(baseVehicle.getDrift())
|
.drift(baseVehicle.getDrift())
|
||||||
.exhaust(new Exhaust(
|
.exhaust(new Exhaust(
|
||||||
|
@ -222,7 +218,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())
|
||||||
|
@ -246,7 +242,6 @@ public class Converter {
|
||||||
.spawn("vp.spawn." + baseVehicle.getName())
|
.spawn("vp.spawn." + baseVehicle.getName())
|
||||||
.build())
|
.build())
|
||||||
.sounds(defaultSounds)
|
.sounds(defaultSounds)
|
||||||
.gearbox(new Gearbox(true, 10))
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
saveToVehiclesPlus(model, "vehicles/" + model.getTypeId(), model.getId());
|
saveToVehiclesPlus(model, "vehicles/" + model.getTypeId(), model.getId());
|
||||||
|
@ -261,7 +256,7 @@ public class Converter {
|
||||||
UUID ownerUUID = set.getKey();
|
UUID ownerUUID = set.getKey();
|
||||||
String ownerName = Bukkit.getOfflinePlayer(ownerUUID).getName();
|
String ownerName = Bukkit.getOfflinePlayer(ownerUUID).getName();
|
||||||
if (ownerName == null) {
|
if (ownerName == null) {
|
||||||
Bukkit.getLogger().severe("Could not convert vehicles for player with UUID " + ownerUUID + ", the player name is unknown!");
|
Bukkit.getLogger().severe("Could not convert vehicle for player with UUID " + ownerUUID + ", the player name is unknown!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,24 +265,22 @@ 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.save();
|
||||||
garage.addVehicle(newVehicle.getUuid());
|
garage.addVehicle(newVehicle.getUuid());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Bukkit.getLogger().severe("Could not convert vehicles for player with UUID " + ownerUUID + ", could not save the vehicle!");
|
Bukkit.getLogger().severe("Could not convert vehicle for player with UUID " + ownerUUID + ", could not save the vehicle!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
garage.forceSave();
|
garage.save();
|
||||||
} catch (DataStorageException e) {
|
} catch (DataStorageException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Bukkit.getLogger().severe("Could not convert vehicles for player with UUID " + ownerUUID + ", could not save the garage!");
|
Bukkit.getLogger().severe("Could not convert vehicle for player with UUID " + ownerUUID + ", could not save the garage!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,17 +27,17 @@ public class MainUtil {
|
||||||
public static String getTypeIdByClass(String baseVehicle, String type) throws ConversionException {
|
public static String getTypeIdByClass(String baseVehicle, String type) throws ConversionException {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "BikeType":
|
case "BikeType":
|
||||||
return "bikes";
|
return "bike";
|
||||||
case "BoatType":
|
case "BoatType":
|
||||||
return "boats";
|
return "boat";
|
||||||
case "CarType":
|
case "CarType":
|
||||||
return "cars";
|
return "car";
|
||||||
case "HelicopterType":
|
case "HelicopterType":
|
||||||
return "helicopters";
|
return "helicopter";
|
||||||
case "HovercraftType":
|
case "HovercraftType":
|
||||||
return "hovercrafts";
|
return "hovercraft";
|
||||||
case "PlaneType":
|
case "PlaneType":
|
||||||
return "planes";
|
return "plane";
|
||||||
default:
|
default:
|
||||||
throw new InvalidConversionException("vehicleType", baseVehicle);
|
throw new InvalidConversionException("vehicleType", baseVehicle);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue