mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Moving getBlockFormats from FModel to GameFormat.Collection
getBlockFormat becomes also getBlockList, inline with other methods in GameFormat.Collection. DeckManager and CardManager have been updated accordingly. Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
This commit is contained in:
@@ -468,6 +468,19 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
return coreList;
|
return coreList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterable<GameFormat> getBlockList() {
|
||||||
|
List<GameFormat> blockFormats = new ArrayList<>();
|
||||||
|
for (GameFormat format : this.getHistoricList()){
|
||||||
|
if (format.getFormatSubType() != GameFormat.FormatSubType.BLOCK)
|
||||||
|
continue;
|
||||||
|
if (!format.getName().endsWith("Block"))
|
||||||
|
continue;
|
||||||
|
blockFormats.add(format);
|
||||||
|
}
|
||||||
|
Collections.sort(blockFormats); // GameFormat will be sorted by Index!
|
||||||
|
return blockFormats;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, List<GameFormat>> getHistoricMap() {
|
public Map<String, List<GameFormat>> getHistoricMap() {
|
||||||
Map<String, List<GameFormat>> coreList = new HashMap<>();
|
Map<String, List<GameFormat>> coreList = new HashMap<>();
|
||||||
for (GameFormat format: naturallyOrdered){
|
for (GameFormat format: naturallyOrdered){
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ public class CardManager extends ItemManager<PaperCard> {
|
|||||||
|
|
||||||
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_HISTORIC_FORMATS)) {
|
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_HISTORIC_FORMATS)) {
|
||||||
JMenu blocks = GuiUtils.createMenu(localizer.getMessage("lblBlock"));
|
JMenu blocks = GuiUtils.createMenu(localizer.getMessage("lblBlock"));
|
||||||
final List<GameFormat> blockFormats = FModel.getBlockFormats();
|
final Iterable<GameFormat> blockFormats = FModel.getFormats().getBlockList();
|
||||||
for (final GameFormat f : blockFormats) {
|
for (final GameFormat f : blockFormats) {
|
||||||
GuiUtils.addMenuItem(blocks, f.getName(), null, new Runnable() {
|
GuiUtils.addMenuItem(blocks, f.getName(), null, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
|||||||
|
|
||||||
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_HISTORIC_FORMATS)) {
|
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_HISTORIC_FORMATS)) {
|
||||||
JMenu blocks = GuiUtils.createMenu(localizer.getMessage("lblBlock"));
|
JMenu blocks = GuiUtils.createMenu(localizer.getMessage("lblBlock"));
|
||||||
final List<GameFormat> blockFormats = FModel.getBlockFormats();
|
final Iterable<GameFormat> blockFormats = FModel.getFormats().getBlockList();
|
||||||
for (final GameFormat f : blockFormats) {
|
for (final GameFormat f : blockFormats) {
|
||||||
GuiUtils.addMenuItem(blocks, f.getName(), null, new Runnable() {
|
GuiUtils.addMenuItem(blocks, f.getName(), null, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -463,19 +463,6 @@ public final class FModel {
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<GameFormat> getBlockFormats(){
|
|
||||||
List<GameFormat> blockFormats = new ArrayList<>();
|
|
||||||
for (GameFormat format : FModel.getFormats().getHistoricList()){
|
|
||||||
if (format.getFormatSubType() != GameFormat.FormatSubType.BLOCK)
|
|
||||||
continue;
|
|
||||||
if (!format.getName().endsWith("Block"))
|
|
||||||
continue;
|
|
||||||
blockFormats.add(format);
|
|
||||||
}
|
|
||||||
Collections.sort(blockFormats); // GameFormat will be sorted by Index!
|
|
||||||
return blockFormats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static QuestPreferences getQuestPreferences() {
|
public static QuestPreferences getQuestPreferences() {
|
||||||
return questPreferences;
|
return questPreferences;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user