mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
fix: wrong cube id saved as LAST_IMPORTED_CUBE_ID
This commit is contained in:
@@ -50,7 +50,7 @@ public class CubeImporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CustomLimited parseFromURL(final URL url) {
|
private CustomLimited parseFromURL(final URL url) {
|
||||||
// Use a generic 15-cards booster template with no rarity slots
|
// Use a generic 15-cards booster template with no rarity slots
|
||||||
// Nice to have: Infos about the slots and the draft format can be found on the platform and imported via JSON api.
|
// Nice to have: Infos about the slots and the draft format can be found on the platform and imported via JSON api.
|
||||||
List<Pair<String, Integer>> slots = SealedTemplate.genericNoSlotBooster.getSlots();
|
List<Pair<String, Integer>> slots = SealedTemplate.genericNoSlotBooster.getSlots();
|
||||||
@@ -70,7 +70,7 @@ public class CubeImporter {
|
|||||||
cd.setCardPool(deckCube.getMain());
|
cd.setCardPool(deckCube.getMain());
|
||||||
|
|
||||||
// Save the cube ID in preferences as the last imported cube
|
// Save the cube ID in preferences as the last imported cube
|
||||||
FModel.getPreferences().setPref(ForgePreferences.FPref.LAST_IMPORTED_CUBE_ID, deckCube.getName());
|
FModel.getPreferences().setPref(ForgePreferences.FPref.LAST_IMPORTED_CUBE_ID, parseCubeId(url.toString()));
|
||||||
FModel.getPreferences().save();
|
FModel.getPreferences().save();
|
||||||
|
|
||||||
return cd;
|
return cd;
|
||||||
@@ -83,7 +83,7 @@ public class CubeImporter {
|
|||||||
* "https://cubecobra.com/cube/list/cubeid",
|
* "https://cubecobra.com/cube/list/cubeid",
|
||||||
* it returns "cubeid".
|
* it returns "cubeid".
|
||||||
* Otherwise, it returns the string as is considering it as a plain cube ID.
|
* Otherwise, it returns the string as is considering it as a plain cube ID.
|
||||||
* @param inputStr
|
* @param inputStr the input string which can be a cube ID or a URL
|
||||||
* @return string representing the cube ID
|
* @return string representing the cube ID
|
||||||
*/
|
*/
|
||||||
private String parseCubeId(String inputStr) {
|
private String parseCubeId(String inputStr) {
|
||||||
@@ -92,10 +92,8 @@ public class CubeImporter {
|
|||||||
String[] parts = inputStr.trim().split("/");
|
String[] parts = inputStr.trim().split("/");
|
||||||
yield parts[parts.length - 1];
|
yield parts[parts.length - 1];
|
||||||
}
|
}
|
||||||
case CUBEARTISAN -> {
|
case CUBEARTISAN -> // Not implemented yet, but could be similar to CubeCobra
|
||||||
// Not implemented yet, but could be similar to CubeCobra
|
null;
|
||||||
yield null;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if parsedStr is alphanumeric only, allow hyphens as well since full Cube IDs can contain them
|
// Check if parsedStr is alphanumeric only, allow hyphens as well since full Cube IDs can contain them
|
||||||
|
|||||||
Reference in New Issue
Block a user