Fixed IllegalArgumentException when processing corrupt data

This commit is contained in:
Intelli 2022-03-24 17:11:37 -06:00
parent 1974838f74
commit 070c5139e1
2 changed files with 13 additions and 7 deletions

View File

@ -1914,7 +1914,7 @@ public class Rollback extends Queue {
}
itemstack.setItemMeta(meta);
}
else if ((rowType == Material.MAP)) {
else if (rowType == Material.MAP || rowType == Material.FILLED_MAP) {
for (Map<String, Object> colorData : map) {
MapMeta meta = (MapMeta) itemstack.getItemMeta();
org.bukkit.Color color = org.bukkit.Color.deserialize(colorData);

View File

@ -1386,12 +1386,16 @@ public class Util extends Queue {
}
public static BlockData createBlockData(Material material) {
BlockData result = material.createBlockData();
if (result instanceof Waterlogged) {
((Waterlogged) result).setWaterlogged(false);
try {
BlockData result = material.createBlockData();
if (result instanceof Waterlogged) {
((Waterlogged) result).setWaterlogged(false);
}
return result;
}
catch (Exception e) {
return null;
}
return result;
}
public static void prepareTypeAndData(Map<Block, BlockData> map, Block block, Material type, BlockData blockData, boolean update) {
@ -1413,7 +1417,9 @@ public class Util extends Queue {
blockData = createBlockData(type);
}
block.setBlockData(blockData, update);
if (blockData != null) {
block.setBlockData(blockData, update);
}
}
public static boolean successfulQuery(Connection connection, String query) {