BucketsInInventorys #141
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
This file is a part of the SteamWar software.
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
Copyright (C) 2022 SteamWar.de-Serverteam
|
Copyright (C) 2023 SteamWar.de-Serverteam
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
@ -26,10 +26,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import de.steamwar.schematicsystem.CheckSchemType;
|
import de.steamwar.schematicsystem.CheckSchemType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
||||||
private static final Set<Material> INVENTORY = EnumSet.of(
|
private static final Set<Material> INVENTORY = EnumSet.of(
|
||||||
@ -110,6 +107,13 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Map<Material, EnumSet<Material>> itemsInInv = new EnumMap<>(Material.class);
|
||||||
|
|
||||||
|
static {
|
||||||
|
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
||||||
|
itemsInInv.put(Material.TNT, EnumSet.of(Material.CHEST, Material.BARREL));
|
||||||
|
}
|
||||||
|
|
||||||
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) {
|
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) {
|
||||||
CompoundTag nbt = block.getNbtData();
|
CompoundTag nbt = block.getNbtData();
|
||||||
if(nbt == null) {
|
if(nbt == null) {
|
||||||
@ -140,11 +144,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
|||||||
|
|
||||||
if(material == Material.DISPENSER && (itemType.equals(Material.FIRE_CHARGE) || itemType.equals(Material.ARROW))) {
|
if(material == Material.DISPENSER && (itemType.equals(Material.FIRE_CHARGE) || itemType.equals(Material.ARROW))) {
|
||||||
counter += item.getByte("Count");
|
counter += item.getByte("Count");
|
||||||
}else if (!FLOWERS.contains(itemType) && !((material == Material.CHEST || material == Material.BARREL) && itemType.equals(Material.TNT))) {
|
}else if (!FLOWERS.contains(itemType) && !itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(material)) {
|
||||||
|
|
||||||
if(material == Material.DISPENSER && itemType.equals(Material.BUCKET))
|
|
||||||
return;
|
|
||||||
|
|
||||||
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 (item.containsKey("tag")) {
|
||||||
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
This file is a part of the SteamWar software.
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
Copyright (C) 2022 SteamWar.de-Serverteam
|
Copyright (C) 2023 SteamWar.de-Serverteam
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
@ -27,9 +27,7 @@ import com.sk89q.worldedit.regions.Region;
|
|||||||
import de.steamwar.schematicsystem.CheckSchemType;
|
import de.steamwar.schematicsystem.CheckSchemType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
||||||
@ -90,6 +88,13 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Map<Material, EnumSet<Material>> itemsInInv = new EnumMap<>(Material.class);
|
||||||
|
|
||||||
|
static {
|
||||||
|
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
||||||
|
itemsInInv.put(Material.TNT, EnumSet.of(Material.CHEST));
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
CompoundTag nbt = block.getNbtData();
|
CompoundTag nbt = block.getNbtData();
|
||||||
if(nbt == null){
|
if(nbt == null){
|
||||||
@ -125,7 +130,7 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
|||||||
|
|
||||||
if(blockId == DISPENSER && (itemType.equals(Material.FIREBALL) || itemType.equals(Material.ARROW)))
|
if(blockId == DISPENSER && (itemType.equals(Material.FIREBALL) || itemType.equals(Material.ARROW)))
|
||||||
counter += item.getByte("Count");
|
counter += item.getByte("Count");
|
||||||
else if(!FLOWERS.contains(itemType) && !(blockId == CHEST && itemType.equals(Material.TNT))) {
|
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(item.containsKey("tag")) {
|
else if(item.containsKey("tag")) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren