forked from github-mirror/CoreProtect
Fixed IllegalArgumentException for lava/water in inventory rollbacks (fixes #802)
This commit is contained in:
1 parent
383caedff5
commit
e852d75264
2 files changed
+22
-1
No files matched your search
@@ -277,7 +277,11 @@ public class RollbackProcessor {
|
|||||||
int rolledBackInventory = MaterialUtils.rolledBack((Integer) row[9], true);
|
int rolledBackInventory = MaterialUtils.rolledBack((Integer) row[9], true);
|
||||||
if (rowType != null) {
|
if (rowType != null) {
|
||||||
if (inventoryRollback && ((rollbackType == 0 && rolledBackInventory == 0) || (rollbackType == 1 && rolledBackInventory == 1))) {
|
if (inventoryRollback && ((rollbackType == 0 && rolledBackInventory == 0) || (rollbackType == 1 && rolledBackInventory == 1))) {
|
||||||
Material inventoryItem = ItemUtils.itemFilter(rowType, ((Integer) row[14] == 0));
|
Material inventoryItem = ItemUtils.inventoryItemFilter(rowType, ((Integer) row[14] == 0));
|
||||||
|
if (inventoryItem == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int rowUserId = (Integer) row[2];
|
int rowUserId = (Integer) row[2];
|
||||||
String rowUser = ConfigHandler.playerIdCacheReversed.get(rowUserId);
|
String rowUser = ConfigHandler.playerIdCacheReversed.get(rowUserId);
|
||||||
if (rowUser == null) {
|
if (rowUser == null) {
|
||||||
|
|||||||
@@ -362,6 +362,23 @@ public class ItemUtils {
|
|||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Material inventoryItemFilter(Material material, boolean blockTable) {
|
||||||
|
material = itemFilter(material, blockTable);
|
||||||
|
if (material == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (material == Material.LAVA) {
|
||||||
|
return Material.LAVA_BUCKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (material == Material.WATER) {
|
||||||
|
return Material.WATER_BUCKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
return material.isItem() ? material : null;
|
||||||
|
}
|
||||||
|
|
||||||
public static ItemStack newItemStack(Material type, int amount) {
|
public static ItemStack newItemStack(Material type, int amount) {
|
||||||
return new ItemStack(type, amount);
|
return new ItemStack(type, amount);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user