forked from SteamWar/SteamWar
Add GameModeConfig.Schematic.MaxBlastResistance
This commit is contained in:
@@ -631,6 +631,13 @@ public final class GameModeConfig<M, W> {
|
||||
*/
|
||||
public final int MaxDispenserItems;
|
||||
|
||||
/**
|
||||
* Maximal blast resistance for the blocks
|
||||
*
|
||||
* @implSpec {@code Double.MAX_VALUE} by default
|
||||
*/
|
||||
public final double MaxBlastResistance;
|
||||
|
||||
/**
|
||||
* Maximal blast resistance for the design blocks
|
||||
*
|
||||
@@ -663,6 +670,7 @@ public final class GameModeConfig<M, W> {
|
||||
UnlimitedPrepare = loader.getBoolean("UnlimitedPrepare", false);
|
||||
MaxBlocks = loader.getInt("MaxBlocks", 0);
|
||||
MaxDispenserItems = loader.getInt("MaxDispenserItems", 128);
|
||||
MaxBlastResistance = loader.getDouble("MaxBlastResistance", Double.MAX_VALUE);
|
||||
MaxDesignBlastResistance = loader.getDouble("MaxDesignBlastResistance", Double.MAX_VALUE);
|
||||
|
||||
Map<Set<M>, Integer> Limited = new HashMap<>();
|
||||
@@ -677,6 +685,9 @@ public final class GameModeConfig<M, W> {
|
||||
Limited.put(Collections.unmodifiableSet(materials.stream().map(String::toUpperCase).map(loader.materialMapper).collect(Collectors.toSet())), amount);
|
||||
}
|
||||
}
|
||||
SQLWrapper.impl.getMaterialWithGreaterBlastResistance(MaxBlastResistance).forEach(material -> {
|
||||
Limited.put(Collections.singleton((M) material), 0);
|
||||
});
|
||||
this.Limited = Collections.unmodifiableMap(Limited);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ package de.steamwar.sql;
|
||||
import de.steamwar.ImplementationProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public interface SQLWrapper<M> {
|
||||
SQLWrapper<?> impl = ImplementationProvider.getImpl("de.steamwar.sql.SQLWrapperImpl");
|
||||
@@ -30,6 +32,10 @@ public interface SQLWrapper<M> {
|
||||
|
||||
GameModeConfig<M, String> loadGameModeConfig(File file);
|
||||
|
||||
default List<M> getMaterialWithGreaterBlastResistance(double maxBlastResistance) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
default void processSchematicType(GameModeConfig<?, String> gameModeConfig) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user