Minor fixes
This commit is contained in:
parent
4dd6792276
commit
11f0b489a5
@ -153,7 +153,13 @@ public class EnchantRegistry {
|
||||
private void register(@NotNull String id, @NotNull Supplier<ExcellentEnchant> supplier) {
|
||||
if (Config.ENCHANTMENTS_DISABLED.get().contains(id)) return;
|
||||
|
||||
|
||||
ExcellentEnchant enchant = supplier.get();
|
||||
if (Enchantment.getByKey(enchant.getKey()) != null) {
|
||||
this.plugin.error("Could not register '" + enchant.getId() + "': Such enchantment already registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
Enchantment.registerEnchantment(enchant);
|
||||
REGISTRY_MAP.put(enchant.getKey(), enchant);
|
||||
enchant.loadSettings();
|
||||
|
@ -11,7 +11,6 @@ import su.nightexpress.excellentenchants.enchantment.type.ObtainType;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TierManager extends AbstractManager<ExcellentEnchants> {
|
||||
|
||||
@ -91,7 +90,9 @@ public class TierManager extends AbstractManager<ExcellentEnchants> {
|
||||
|
||||
@Nullable
|
||||
public Tier getTierByChance(@NotNull ObtainType obtainType) {
|
||||
Map<Tier, Double> map = this.getTiers().stream().collect(Collectors.toMap(k -> k, v -> v.getChance(obtainType)));
|
||||
Map<Tier, Double> map = new HashMap<>();
|
||||
this.getTiers().forEach(tier -> map.put(tier, tier.getChance(obtainType)));
|
||||
map.values().removeIf(chance -> chance <= 0D);
|
||||
return Rnd.getByWeight(map);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user