mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-12-28 17:47:41 +01:00
Fixed inventory lookups not returning correct item for planted seeds
This commit is contained in:
parent
ddb804ce99
commit
900cad643f
@ -875,7 +875,7 @@ 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);
|
||||
Material blockType = Util.itemFilter(Util.getType(Integer.parseInt(dtype)));
|
||||
Material blockType = Util.itemFilter(Util.getType(Integer.parseInt(dtype)), (Integer.parseInt(data[13]) == 0));
|
||||
String dname = Util.nameFilter(blockType.name().toLowerCase(Locale.ROOT), ddata);
|
||||
|
||||
String selector = Selector.FIRST;
|
||||
|
@ -234,10 +234,8 @@ public class Lookup extends Queue {
|
||||
resultData = results.getInt("data");
|
||||
resultAmount = results.getInt("amount");
|
||||
resultMeta = results.getBytes("metadata");
|
||||
if (!lookup) {
|
||||
resultTable = results.getInt("tbl");
|
||||
hasTbl = true;
|
||||
}
|
||||
resultTable = results.getInt("tbl");
|
||||
hasTbl = true;
|
||||
}
|
||||
else {
|
||||
resultData = results.getInt("data");
|
||||
|
@ -1053,7 +1053,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);
|
||||
Material inventoryItem = Util.itemFilter(rowType, ((Integer) row[14] == 0));
|
||||
int rowUserId = (Integer) row[2];
|
||||
String rowUser = ConfigHandler.playerIdCacheReversed.get(rowUserId);
|
||||
if (rowUser == null) {
|
||||
|
@ -1105,12 +1105,29 @@ 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) {
|
||||
// This filter is only used for a:inventory
|
||||
public static Material itemFilter(Material material, boolean blockTable) {
|
||||
if (material == null || (!blockTable && material.isItem())) {
|
||||
return material;
|
||||
}
|
||||
|
||||
if (!material.isItem() && material.name().contains("WALL_")) {
|
||||
switch (material) {
|
||||
case WHEAT:
|
||||
material = Material.WHEAT_SEEDS;
|
||||
break;
|
||||
case PUMPKIN_STEM:
|
||||
material = Material.PUMPKIN_SEEDS;
|
||||
break;
|
||||
case MELON_STEM:
|
||||
material = Material.MELON_SEEDS;
|
||||
break;
|
||||
case BEETROOTS:
|
||||
material = Material.BEETROOT_SEEDS;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if (material.name().contains("WALL_")) {
|
||||
material = Material.valueOf(material.name().replace("WALL_", ""));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user