13
0

Solved #49 #54

Zusammengeführt
Lixfel hat 3 Commits von zeanon nach master 2020-04-09 21:00:29 +02:00 zusammengeführt
5 geänderte Dateien mit 26 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ class CheckSchemType_12 {
private static final int OBSIDIAN = Material.OBSIDIAN.getId();
private static final int BEDROCK = Material.BEDROCK.getId();
private static final int DISPENSER = Material.DISPENSER.getId();
private static final int AIR = Material.AIR.getId();
private static final int JUKEBOX = Material.JUKEBOX.getId();
private static final int CHEST = Material.CHEST.getId();
private static final Set<Integer> INVENTORY;
@ -89,6 +90,7 @@ class CheckSchemType_12 {
int tnt = 0;
int slime = 0;
int blocks = 0;
int dispenser = 0;
for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
@ -106,6 +108,9 @@ class CheckSchemType_12 {
if(blockId == DISPENSER)
dispenser++;
if (blockId != AIR)
blocks++;
if(INVENTORY.contains(blockId)){
checkInventory(result, block, blockId, type);
}
@ -118,6 +123,7 @@ class CheckSchemType_12 {
result.setTNT(tnt);
result.setSlime(slime);
result.setDispenser(dispenser);
result.setBlocks(blocks);
return result;
}

Datei anzeigen

@ -90,6 +90,7 @@ class CheckSchemType_15 {
int tnt = 0;
int slime = 0;
int dispenser = 0;
int blocks = 0;
for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
for(int y = min.getBlockY(); y <= max.getBlockY(); y++){
@ -110,6 +111,9 @@ class CheckSchemType_15 {
if(blockMaterial == Material.DISPENSER)
dispenser++;
if(blockMaterial != Material.AIR)
blocks++;
if(INVENTORY.contains(blockMaterial))
checkInventory(result, block, blockMaterial);
}
@ -119,6 +123,7 @@ class CheckSchemType_15 {
result.setTNT(tnt);
result.setSlime(slime);
result.setDispenser(dispenser);
result.setBlocks(blocks);
return result;
}

Datei anzeigen

@ -19,6 +19,7 @@ public class AutoCheckResult {
private int tnt = 0;
private int slime = 0;
private int dispenser = 0;
private int blocks = 0;
private Map<String, Integer> forbiddenMaterials = new HashMap<>(); // Anzahl verbotener Blöcke nach Material
@ -66,6 +67,9 @@ public class AutoCheckResult {
errors.add("Zu viele Werfer (" + dispenser + " > " + type.getMaxDispenser() + ")");
if(type.getMaxTNTSlime() != 0 && errorTNTSlime > type.getMaxTNTSlime())
errors.add("Zu viel Schleim+TNT" + errorTNTSlime + " > " + type.getMaxTNTSlime() + ")");
if(type.getMaxBlocks() != 0 && blocks > type.getMaxBlocks()) {
errors.add("Zu viele Blöcke (" + blocks + " > " + type.getMaxBlocks() + ")");
}
for(Map.Entry<String, Integer> block : forbiddenMaterials.entrySet())
errors.add("Der Block " + block.getKey() + " ist verboten (" + block.getValue() + " verbaut)");
@ -122,6 +126,9 @@ public class AutoCheckResult {
void setDispenser(int dispenser){
this.dispenser = dispenser;
}
void setBlocks(int blocks) {
this.blocks = blocks;
}
void checkMaterial(String name){
assert type != null;

Datei anzeigen

@ -13,6 +13,7 @@ interface ICheckSchemType {
int getMaxTNT();
int getMaxTNTSlime();
int getMaxSlime();
int getMaxBlocks();
List<String> getForbidden();
}

Datei anzeigen

@ -23,6 +23,7 @@ public class CheckSchemType implements ICheckSchemType {
private final int maxSlime;
private final int maxTNTSlime;
private final int maxDispenser;
private final int maxBlocks;
private final LinkedList<String> checkList;
CheckSchemType(ConfigurationSection section) {
@ -36,6 +37,7 @@ public class CheckSchemType implements ICheckSchemType {
maxTNTSlime = section.getInt("maxTNTSlime");
maxDispenser = section.getInt("maxDispenser");
maxDispenserItems = section.getInt("maxDispenserItems");
maxBlocks = section.getInt("maxBlocks");
forbiddenMaterials = section.getStringList("forbiddenMaterials");
checkList = new LinkedList<>(section.getStringList("checkList"));
@ -117,6 +119,11 @@ public class CheckSchemType implements ICheckSchemType {
return maxSlime;
}
@Override
public int getMaxBlocks(){
return maxBlocks;
}
@Override
public List<String> getForbidden() {
return forbiddenMaterials;