Speeds up smith presets by using caching and sets
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
This commit is contained in:
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The command for displaying which materials are contained in a preset
|
||||
@@ -26,7 +27,7 @@ public class PresetCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
String presetName = args[0].toUpperCase().replace('-', '_');
|
||||
List<Material> includedMaterials;
|
||||
Set<Material> includedMaterials;
|
||||
|
||||
try {
|
||||
//Display the preset with the filter applied
|
||||
|
@@ -19,7 +19,7 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The command used for changing global blacksmith configuration options
|
||||
@@ -215,7 +215,7 @@ public class BlackSmithConfigCommand implements CommandExecutor {
|
||||
private void updateAllMatchedPrices(@NotNull GlobalBlacksmithSettings settings,
|
||||
@NotNull BlacksmithSetting blacksmithSetting,
|
||||
@NotNull String materialName, double newPrice) {
|
||||
List<Material> materials = ItemHelper.getWildcardMatch(materialName, false);
|
||||
Set<Material> materials = ItemHelper.getWildcardMatch(materialName, false);
|
||||
for (Material material : materials) {
|
||||
if (blacksmithSetting == BlacksmithSetting.BASE_PRICE) {
|
||||
settings.setBasePrice(material, newPrice);
|
||||
|
Reference in New Issue
Block a user