Add support for 1.13 blocks

This commit is contained in:
sauilitired 2018-12-21 17:49:04 +01:00
parent 130274de86
commit dff64c5c68

View File

@ -670,7 +670,21 @@ public class BukkitLegacyMappings extends LegacyMappings {
private static final Map<String, PlotBlock> OLD_STRING_TO_STRING_PLOT_BLOCK = new HashMap<>();
public BukkitLegacyMappings() {
for (final LegacyBlock legacyBlock : BLOCKS) {
this.addAll(Arrays.asList(BLOCKS));
// Make sure to add new blocks as well
final List<LegacyBlock> missing = new ArrayList<>();
for (final Material material : Material.values()) {
final String materialName = material.name().toLowerCase(Locale.ENGLISH);
if (OLD_STRING_TO_STRING_PLOT_BLOCK.get(materialName) == null) {
final LegacyBlock missingBlock = new LegacyBlock(material.getId(), materialName, materialName);
missing.add(missingBlock);
}
}
addAll(missing);
}
private void addAll(@NonNull final Collection<LegacyBlock> blocks) {
for (final LegacyBlock legacyBlock : blocks) {
LEGACY_ID_TO_STRING_PLOT_BLOCK
.put(legacyBlock.getNumericalId(), legacyBlock.toStringPlotBlock());
if (legacyBlock.getDataValue() != 0) {