Deny custom tag in items during check in
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
299855cc35
Commit
87a5b82551
@ -165,6 +165,8 @@ class CheckSchemType_12 {
|
|||||||
counter += item.getByte("Count");
|
counter += item.getByte("Count");
|
||||||
else if(!FLOWERS.contains(itemType) && !(blockId == CHEST && itemType.equals(Material.TNT)))
|
else if(!FLOWERS.contains(itemType) && !(blockId == CHEST && itemType.equals(Material.TNT)))
|
||||||
result.foundForbiddenItem(Material.getMaterial(blockId).name(), itemType.name(), item.getByte("Count"));
|
result.foundForbiddenItem(Material.getMaterial(blockId).name(), itemType.name(), item.getByte("Count"));
|
||||||
|
else if(item.containsKey("tag"))
|
||||||
|
result.foundItemWithTag(Material.getMaterial(blockId).name(), itemType.name(), item.getByte("Count"));
|
||||||
}
|
}
|
||||||
|
|
||||||
result.dispenserItems(counter);
|
result.dispenserItems(counter);
|
||||||
|
@ -160,6 +160,8 @@ class CheckSchemType_15 {
|
|||||||
counter += item.getByte("Count");
|
counter += item.getByte("Count");
|
||||||
else if(!FLOWERS.contains(itemType) && !(blockMaterial == Material.CHEST && itemType.equals(Material.TNT)))
|
else if(!FLOWERS.contains(itemType) && !(blockMaterial == Material.CHEST && itemType.equals(Material.TNT)))
|
||||||
result.foundForbiddenItem(blockMaterial.name(), itemType.name(), item.getByte("Count"));
|
result.foundForbiddenItem(blockMaterial.name(), itemType.name(), item.getByte("Count"));
|
||||||
|
else if(item.containsKey("tag"))
|
||||||
|
result.foundItemWithTag(blockMaterial.name(), itemType.name(), item.getByte("Count"));
|
||||||
}
|
}
|
||||||
|
|
||||||
result.dispenserItems(counter);
|
result.dispenserItems(counter);
|
||||||
|
@ -26,6 +26,7 @@ public class AutoCheckResult {
|
|||||||
private Map<String, Integer> defunctNbt = new HashMap<>(); // Anzahl an defekten NBT-Blöcken nach Materialname
|
private Map<String, Integer> defunctNbt = new HashMap<>(); // Anzahl an defekten NBT-Blöcken nach Materialname
|
||||||
private int records = 0; // Gefundene Schallplatten
|
private int records = 0; // Gefundene Schallplatten
|
||||||
private Map<String, Map<String, Integer>> forbiddenItems = new HashMap<>(); // Anzahl verbotener Items nach Inventartyp
|
private Map<String, Map<String, Integer>> forbiddenItems = new HashMap<>(); // Anzahl verbotener Items nach Inventartyp
|
||||||
|
private Map<String, Map<String, Integer>> itemsWithTag = new HashMap<>(); // Anzahl an Items mit Tag nach Inventartyp
|
||||||
private int tooManyDispenserItems = 0; // Gefundene Überschreitungen von DispenserItems
|
private int tooManyDispenserItems = 0; // Gefundene Überschreitungen von DispenserItems
|
||||||
|
|
||||||
AutoCheckResult(ICheckSchemType type){
|
AutoCheckResult(ICheckSchemType type){
|
||||||
@ -79,6 +80,9 @@ public class AutoCheckResult {
|
|||||||
for(Map.Entry<String, Map<String, Integer>> block : forbiddenItems.entrySet())
|
for(Map.Entry<String, Map<String, Integer>> block : forbiddenItems.entrySet())
|
||||||
for(Map.Entry<String, Integer> item : block.getValue().entrySet())
|
for(Map.Entry<String, Integer> item : block.getValue().entrySet())
|
||||||
errors.add("In " + block.getKey() + "s wurde das verbotene Item " + item.getKey() + " " + item.getValue() + " mal gefunden");
|
errors.add("In " + block.getKey() + "s wurde das verbotene Item " + item.getKey() + " " + item.getValue() + " mal gefunden");
|
||||||
|
for(Map.Entry<String, Map<String, Integer>> block : itemsWithTag.entrySet())
|
||||||
|
for(Map.Entry<String, Integer> item : block.getValue().entrySet())
|
||||||
|
errors.add("In " + block.getKey() + "s wurde das Item " + item.getKey() + " " + item.getValue() + " mal mit Custom-Tag gefunden");
|
||||||
if(tooManyDispenserItems == 1)
|
if(tooManyDispenserItems == 1)
|
||||||
errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
|
errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
|
||||||
else if(tooManyDispenserItems > 1)
|
else if(tooManyDispenserItems > 1)
|
||||||
@ -100,9 +104,6 @@ public class AutoCheckResult {
|
|||||||
return warnings;
|
return warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWrongVersionException(){
|
|
||||||
wrongVersionException = true;
|
|
||||||
}
|
|
||||||
void setErrorLoadingSchematic(){
|
void setErrorLoadingSchematic(){
|
||||||
errorLoadingSchematic = true;
|
errorLoadingSchematic = true;
|
||||||
}
|
}
|
||||||
@ -150,6 +151,14 @@ public class AutoCheckResult {
|
|||||||
return v;
|
return v;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
void foundItemWithTag(String material, String item, int count){
|
||||||
|
itemsWithTag.compute(material, (k1, v) -> {
|
||||||
|
if(v == null)
|
||||||
|
v = new HashMap<>();
|
||||||
|
v.compute(item, (k2, v2) -> v2 == null ? count : v2 + count);
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
}
|
||||||
void dispenserItems(int counter){
|
void dispenserItems(int counter){
|
||||||
assert type != null;
|
assert type != null;
|
||||||
if(counter > type.getMaxDispenserItems())
|
if(counter > type.getMaxDispenserItems())
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren