Merge pull request 'Deny custom tag in items during check in' (#65) from noCustomTags into master
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
fed7e4c95c
@ -165,6 +165,8 @@ class CheckSchemType_12 {
|
||||
counter += item.getByte("Count");
|
||||
else if(!FLOWERS.contains(itemType) && !(blockId == CHEST && itemType.equals(Material.TNT)))
|
||||
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);
|
||||
|
@ -160,6 +160,8 @@ class CheckSchemType_15 {
|
||||
counter += item.getByte("Count");
|
||||
else if(!FLOWERS.contains(itemType) && !(blockMaterial == Material.CHEST && itemType.equals(Material.TNT)))
|
||||
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);
|
||||
|
@ -26,6 +26,7 @@ public class AutoCheckResult {
|
||||
private Map<String, Integer> defunctNbt = new HashMap<>(); // Anzahl an defekten NBT-Blöcken nach Materialname
|
||||
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>> itemsWithTag = new HashMap<>(); // Anzahl an Items mit Tag nach Inventartyp
|
||||
private int tooManyDispenserItems = 0; // Gefundene Überschreitungen von DispenserItems
|
||||
|
||||
AutoCheckResult(ICheckSchemType type){
|
||||
@ -79,6 +80,9 @@ public class AutoCheckResult {
|
||||
for(Map.Entry<String, Map<String, Integer>> block : forbiddenItems.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");
|
||||
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)
|
||||
errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
|
||||
else if(tooManyDispenserItems > 1)
|
||||
@ -100,9 +104,6 @@ public class AutoCheckResult {
|
||||
return warnings;
|
||||
}
|
||||
|
||||
void setWrongVersionException(){
|
||||
wrongVersionException = true;
|
||||
}
|
||||
void setErrorLoadingSchematic(){
|
||||
errorLoadingSchematic = true;
|
||||
}
|
||||
@ -150,6 +151,14 @@ public class AutoCheckResult {
|
||||
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){
|
||||
assert type != null;
|
||||
if(counter > type.getMaxDispenserItems())
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren