1.14 id support (#2403)

* Plausible fix for 1.14 support.
- Allow 1.14 blocks to be specified in LegacyBlocks, but only saved if the server version is 1.14.
- No snazzy config conversion, but it seems most people managed to figure it out on their own anyway

* Ignore the "severe" output because of new 1.13/14 blocks
This commit is contained in:
dordsor21 2019-06-23 14:17:44 +01:00 committed by GitHub
parent d6401d1638
commit 485415c551
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.BukkitMain;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
@ -126,7 +127,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
new LegacyBlock(43, 6, "double_step", "smooth_quartz"),
new LegacyBlock(43, 8, "double_step", "smooth_stone"),
new LegacyBlock(43, 9, "double_step", "smooth_sandstone"),
new LegacyBlock(44, "step", "stone_slab"),
new LegacyBlock(44, "step", "stone_slab", "smooth_stone_slab"),
new LegacyBlock(44, 1, "step", "sandstone_slab"),
new LegacyBlock(44, 2, "step", "petrified_oak_slab"),
new LegacyBlock(44, 3, "step", "cobblestone_slab"),
@ -147,7 +148,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
new LegacyBlock(58, "workbench", "crafting_table"),
new LegacyBlock(59, "crops", "wheat"), new LegacyBlock(60, "soil", "farmland"),
new LegacyBlock(61, "furnace"), new LegacyBlock(62, "burning_furnace"),
new LegacyBlock(63, "sign_post", "sign"),
new LegacyBlock(63, "sign_post", "sign", "oak_sign"),
new LegacyBlock(64, "wooden_door", "oak_door"), new LegacyBlock(65, "ladder"),
new LegacyBlock(66, "rails", "rail"), new LegacyBlock(67, "cobblestone_stairs"),
new LegacyBlock(68, "wall_sign"), new LegacyBlock(69, "lever"),
@ -688,9 +689,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
final LegacyBlock missingBlock =
new LegacyBlock(material.getId(), materialName, materialName);
missing.add(missingBlock);
} catch (Exception e) {
Bukkit.getLogger().severe(
"Error creating legacy block: " + materialName + ". Possibly a new block.");
} catch (Exception ignored) {
}
}
}
@ -713,8 +712,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
try {
material = Material.getMaterial(legacyBlock.getLegacyName(), true);
} catch (NoSuchMethodError error) {
PlotSquared.log(
"You can't use this version of PlotSquared on a server "
PlotSquared.log("You can't use this version of PlotSquared on a server "
+ "less than Minecraft 1.13.2");
Bukkit.shutdown();
break;
@ -831,6 +829,20 @@ public final class BukkitLegacyMappings extends LegacyMappings {
this(numericalId, dataValue, legacyName, legacyName);
}
LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName,
@NonNull final String newName, @NonNull final String new14Name) {
this(numericalId, dataValue, legacyName,
PlotSquared.get().IMP.getServerVersion()[1] == 13 ? newName : new14Name);
}
LegacyBlock(final int numericalId, @NonNull final String legacyName,
@NonNull final String newName, @NonNull final String new14Name) {
this(numericalId, 0, legacyName,
Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1].equals("13") ?
newName :
new14Name);
}
LegacyBlock(final int numericalId, @NonNull final String legacyName,
@NonNull final String newName) {
this(numericalId, 0, legacyName, newName);