mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-24 12:16:36 +01:00
Fixed inventory rollbacks not always returning correct item for placed blocks
This commit is contained in:
parent
c95bf3cc30
commit
4445c3c4a7
@ -873,7 +873,8 @@ public class LookupCommand {
|
||||
int amount = Integer.parseInt(data[10]);
|
||||
String rbd = ((Integer.parseInt(data[8]) == 2 || Integer.parseInt(data[8]) == 3) ? Color.STRIKETHROUGH : "");
|
||||
String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
|
||||
String dname = Util.nameFilter(Util.getType(Integer.parseInt(dtype)).name().toLowerCase(Locale.ROOT), ddata);
|
||||
Material blockType = Util.itemFilter(Util.getType(Integer.parseInt(dtype)));
|
||||
String dname = Util.nameFilter(blockType.name().toLowerCase(Locale.ROOT), ddata);
|
||||
|
||||
String selector = Selector.FIRST;
|
||||
String tag = Color.WHITE + "-";
|
||||
|
@ -1037,6 +1037,7 @@ public class Rollback extends Queue {
|
||||
int rolledBackInventory = Util.rolledBack((Integer) row[9], true);
|
||||
if (rowType != null) {
|
||||
if (inventoryRollback && ((rollbackType == 0 && rolledBackInventory == 0) || (rollbackType == 1 && rolledBackInventory == 1))) {
|
||||
Material inventoryItem = Util.itemFilter(rowType);
|
||||
int rowUserId = (Integer) row[2];
|
||||
String rowUser = ConfigHandler.playerIdCacheReversed.get(rowUserId);
|
||||
if (rowUser == null) {
|
||||
@ -1065,7 +1066,7 @@ public class Rollback extends Queue {
|
||||
}
|
||||
|
||||
int action = rollbackType == 0 ? (inventoryAction ^ 1) : inventoryAction;
|
||||
ItemStack itemstack = new ItemStack(rowType, rowAmount, (short) rowData);
|
||||
ItemStack itemstack = new ItemStack(inventoryItem, rowAmount, (short) rowData);
|
||||
Object[] populatedStack = populateItemStack(itemstack, rowMetadata);
|
||||
if (rowAction == ItemLogger.ITEM_REMOVE_ENDER || rowAction == ItemLogger.ITEM_ADD_ENDER) {
|
||||
modifyContainerItems(containerType, player.getEnderChest(), (Integer) populatedStack[0], ((ItemStack) populatedStack[2]).clone(), action ^ 1);
|
||||
|
@ -1105,6 +1105,18 @@ public class Util extends Queue {
|
||||
Chat.sendComponent(consoleSender, Color.RESET + "[CoreProtect] " + string + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP + "| | " + Chat.COMPONENT_TAG_CLOSE);
|
||||
}
|
||||
|
||||
public static Material itemFilter(Material material) {
|
||||
if (material == null) {
|
||||
return material;
|
||||
}
|
||||
|
||||
if (!material.isItem() && material.name().contains("WALL_")) {
|
||||
material = Material.valueOf(material.name().replace("WALL_", ""));
|
||||
}
|
||||
|
||||
return material;
|
||||
}
|
||||
|
||||
public static String nameFilter(String name, int data) {
|
||||
if (name.equals("stone")) {
|
||||
switch (data) {
|
||||
|
Loading…
Reference in New Issue
Block a user