mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Added rarity placeholders
This commit is contained in:
parent
fede492f11
commit
1e8d93269e
@ -149,6 +149,12 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Regist
|
||||
}
|
||||
|
||||
private void updatePlaceholders() {
|
||||
PlaceholderManager.registerPlaceholder(
|
||||
new PlaceholderEntry(this.getPermissionName() + "_" + "enabled", (player) -> {
|
||||
return String.valueOf(this.isEnabled());
|
||||
})
|
||||
);
|
||||
|
||||
if(this.getConfig().config.get(EcoEnchants.CONFIG_LOCATION + "chance-per-level") != null) {
|
||||
PlaceholderManager.registerPlaceholder(
|
||||
new PlaceholderEntry(this.getPermissionName() + "_" + "chance_per_level", (player) -> {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.willfp.ecoenchants.enchantments.meta;
|
||||
|
||||
import com.willfp.ecoenchants.config.ConfigManager;
|
||||
import com.willfp.ecoenchants.integrations.placeholder.PlaceholderEntry;
|
||||
import com.willfp.ecoenchants.integrations.placeholder.PlaceholderManager;
|
||||
import com.willfp.ecoenchants.util.NumberUtils;
|
||||
import com.willfp.ecoenchants.util.StringUtils;
|
||||
import com.willfp.ecoenchants.util.interfaces.Registerable;
|
||||
|
||||
@ -44,6 +47,27 @@ public class EnchantmentRarity implements Registerable {
|
||||
Optional<EnchantmentRarity> matching = rarities.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst();
|
||||
matching.ifPresent(rarities::remove);
|
||||
|
||||
PlaceholderManager.registerPlaceholder(new PlaceholderEntry(
|
||||
"rarity_" + this.getName() + "_probability",
|
||||
(player) -> NumberUtils.format(this.probability)
|
||||
));
|
||||
PlaceholderManager.registerPlaceholder(new PlaceholderEntry(
|
||||
"rarity_" + this.getName() + "_minlevel",
|
||||
(player) -> NumberUtils.format(this.minimumLevel)
|
||||
));
|
||||
PlaceholderManager.registerPlaceholder(new PlaceholderEntry(
|
||||
"rarity_" + this.getName() + "_villagerprobability",
|
||||
(player) -> NumberUtils.format(this.villagerProbability)
|
||||
));
|
||||
PlaceholderManager.registerPlaceholder(new PlaceholderEntry(
|
||||
"rarity_" + this.getName() + "_lootprobability",
|
||||
(player) -> NumberUtils.format(this.lootProbability)
|
||||
));
|
||||
PlaceholderManager.registerPlaceholder(new PlaceholderEntry(
|
||||
"rarity_" + this.getName() + "_color",
|
||||
(player) -> this.customColor
|
||||
));
|
||||
|
||||
rarities.add(this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user