Fixed broken migration for old storage versions.

This commit is contained in:
Tobias Ottenweller 2014-01-06 17:28:59 +01:00
parent a613b1933a
commit 2bd8b0ff03

View File

@ -31,8 +31,26 @@ public class MigrationUtil
{
public static boolean performMigration(int storageVersion, int currentVersion, List<Gate> gates)
{
if (storageVersion == 0 && currentVersion >= 1) {
if (storageVersion == 0 && currentVersion >= 2) {
removePortalBlocks(gates);
updateAllowVehicles(gates);
return true;
}
else if (storageVersion == 1 && currentVersion >= 2) {
updateAllowVehicles(gates);
return true;
}
else {
Plugin.log(Level.SEVERE, "Supplied storage version is currently not supported! Make sure you have the latest version of Craft Inc. Gates installed. Plugin will be disabled!");
return false;
}
}
protected static void removePortalBlocks(List<Gate> gates)
{
for (Gate g : gates) {
for (Location l : g.getGateBlockLocations()) {
@ -43,21 +61,14 @@ public class MigrationUtil
}
}
}
return true;
}
else if (storageVersion == 1 && currentVersion >= 2) {
protected static void updateAllowVehicles(List<Gate> gates)
{
for (Gate g : gates) {
g.setAllowsVehicles(true);
}
return true;
}
else {
Plugin.log(Level.SEVERE, "Supplied storage version is currently not supported! Make sure you have the latest version of Craft Inc. Gates installed. Plugin will be disabled!");
return false;
}
}
}