BucketsInInventorys #141
@ -107,11 +107,14 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Material, EnumSet<Material>> itemsInInv = new EnumMap<>(Material.class);
|
private static final Map<Material, Set<Material>> itemsInInv = new EnumMap<>(Material.class);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
||||||
itemsInInv.put(Material.TNT, EnumSet.of(Material.CHEST, Material.BARREL));
|
itemsInInv.put(Material.TNT, EnumSet.of(Material.CHEST, Material.BARREL));
|
||||||
|
itemsInInv.put(Material.FIRE_CHARGE, EnumSet.of(Material.DISPENSER));
|
||||||
|
itemsInInv.put(Material.ARROW, EnumSet.of(Material.DISPENSER));
|
||||||
|
FLOWERS.forEach(material -> itemsInInv.put(material, INVENTORY));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) {
|
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) {
|
||||||
@ -142,11 +145,12 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
|||||||
if(itemType == null) //Leere Slots
|
if(itemType == null) //Leere Slots
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(material == Material.DISPENSER && (itemType.equals(Material.FIRE_CHARGE) || itemType.equals(Material.ARROW))) {
|
if (!itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(material)) {
|
||||||
counter += item.getByte("Count");
|
|
||||||
}else if (!FLOWERS.contains(itemType) && !itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(material)) {
|
|
||||||
result.getForbiddenItems().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
result.getForbiddenItems().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
||||||
} else if (item.containsKey("tag")) {
|
} else if(material == Material.DISPENSER && (itemType == Material.ARROW || itemType == Material.FIRE_CHARGE)) {
|
||||||
|
counter += item.getByte("Count");
|
||||||
|
}
|
||||||
|
if (item.containsKey("tag")) {
|
||||||
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import de.steamwar.schematicsystem.CheckSchemType;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
||||||
@ -93,6 +94,9 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
|||||||
static {
|
static {
|
||||||
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
||||||
itemsInInv.put(Material.TNT, EnumSet.of(Material.CHEST));
|
itemsInInv.put(Material.TNT, EnumSet.of(Material.CHEST));
|
||||||
|
itemsInInv.put(Material.FIREBALL, EnumSet.of(Material.DISPENSER));
|
||||||
|
itemsInInv.put(Material.ARROW, EnumSet.of(Material.DISPENSER));
|
||||||
|
FLOWERS.forEach(material -> itemsInInv.put(material, INVENTORY.stream().map(Material::getMaterial).collect(Collectors.toCollection(() -> EnumSet.noneOf(Material.class)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, int blockId, BlockPos pos) {
|
private static void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, int blockId, BlockPos pos) {
|
||||||
@ -128,12 +132,13 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
|||||||
if(itemType == null) //Leere Slots
|
if(itemType == null) //Leere Slots
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(blockId == DISPENSER && (itemType.equals(Material.FIREBALL) || itemType.equals(Material.ARROW)))
|
|
||||||
counter += item.getByte("Count");
|
if(!itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(Material.getMaterial(blockId))) {
|
||||||
else if(!FLOWERS.contains(itemType) && !itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(Material.getMaterial(blockId))) {
|
|
||||||
result.getForbiddenItems().computeIfAbsent(pos, blockPos -> new HashSet<>()).add(Material.getMaterial(blockId));
|
result.getForbiddenItems().computeIfAbsent(pos, blockPos -> new HashSet<>()).add(Material.getMaterial(blockId));
|
||||||
|
} else if(blockId == DISPENSER && (itemType.equals(Material.FIREBALL) || itemType.equals(Material.ARROW))) {
|
||||||
|
counter += item.getByte("Count");
|
||||||
}
|
}
|
||||||
else if(item.containsKey("tag")) {
|
if(item.containsKey("tag")) {
|
||||||
result.getForbiddenNbt().computeIfAbsent(pos, blockPos -> new HashSet<>()).add(Material.getMaterial(blockId));
|
result.getForbiddenNbt().computeIfAbsent(pos, blockPos -> new HashSet<>()).add(Material.getMaterial(blockId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren