public boolean addCustomBiome(Window parent, CustomBiome customBiome) { if (isBiomePresent(customBiome.getId())) { JOptionPane.showMessageDialog( parent, "The specified ID (" + customBiome.getId() + ") is already a regular biome (named " + Minecraft1_7Biomes.BIOME_NAMES[customBiome.getId()] + ")", "ID Already In Use", JOptionPane.ERROR_MESSAGE); return false; } if (customBiomes == null) { customBiomes = new ArrayList<>(); } for (CustomBiome existingCustomBiome : customBiomes) { if (existingCustomBiome.getId() == customBiome.getId()) { JOptionPane.showMessageDialog( parent, "You already configured a custom biome with that ID (named " + existingCustomBiome.getName() + ")", "ID Already In Use", JOptionPane.ERROR_MESSAGE); return false; } } customBiomes.add(customBiome); for (CustomBiomeListener listener : listeners) { listener.customBiomeAdded(customBiome); } return true; }
public void setCustomBiomes(List<CustomBiome> customBiomes) { List<CustomBiome> oldCustomBiomes = this.customBiomes; this.customBiomes = customBiomes; if (oldCustomBiomes != null) { for (CustomBiome customBiome : oldCustomBiomes) { for (CustomBiomeListener listener : listeners) { listener.customBiomeRemoved(customBiome); } } } if (customBiomes != null) { for (CustomBiome customBiome : customBiomes) { for (CustomBiomeListener listener : listeners) { listener.customBiomeAdded(customBiome); } } } }