Removed pointless placeholders

This commit is contained in:
Auxilor 2021-04-03 15:16:37 +01:00
parent 846db531f8
commit bca7461101
4 changed files with 4 additions and 71 deletions

View File

@ -174,8 +174,6 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
Bukkit.getPluginManager().addPermission(permission); Bukkit.getPluginManager().addPermission(permission);
} }
//WorldguardManager.registerFlag(this.getPermissionName() + "-enabled", true);
if (type.getRequiredToExtend() != null && !type.getRequiredToExtend().isInstance(this)) { if (type.getRequiredToExtend() != null && !type.getRequiredToExtend().isInstance(this)) {
return; return;
} }

View File

@ -1,10 +1,7 @@
package com.willfp.ecoenchants.enchantments.meta; package com.willfp.ecoenchants.enchantments.meta;
import com.willfp.eco.util.NumberUtils;
import com.willfp.eco.util.StringUtils; import com.willfp.eco.util.StringUtils;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater; import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.util.integrations.placeholder.PlaceholderEntry;
import com.willfp.eco.util.integrations.placeholder.PlaceholderManager;
import com.willfp.ecoenchants.config.EcoEnchantsConfigs; import com.willfp.ecoenchants.config.EcoEnchantsConfigs;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -86,27 +83,6 @@ public class EnchantmentRarity {
Optional<EnchantmentRarity> matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst(); Optional<EnchantmentRarity> matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst();
matching.ifPresent(REGISTERED::remove); matching.ifPresent(REGISTERED::remove);
PlaceholderManager.registerPlaceholder(new PlaceholderEntry(
"rarity_" + this.getName() + "_probability",
player -> NumberUtils.format(this.tableProbability)
));
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
));
REGISTERED.add(this); REGISTERED.add(this);
} }

View File

@ -8,7 +8,6 @@ import com.willfp.eco.util.integrations.placeholder.PlaceholderEntry;
import com.willfp.eco.util.integrations.placeholder.PlaceholderManager; import com.willfp.eco.util.integrations.placeholder.PlaceholderManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -70,45 +69,5 @@ public class EnchantmentUtils {
) )
); );
}); });
if (enchantment.getConfig().getRaw(EcoEnchants.CONFIG_LOCATION + "chance-per-level") != null) {
PlaceholderManager.registerPlaceholder(
new PlaceholderEntry(
enchantment.getPermissionName() + "_" + "chance_per_level",
player -> NumberUtils.format(enchantment.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level"))
)
);
}
if (enchantment.getConfig().getRaw(EcoEnchants.CONFIG_LOCATION + "multiplier") != null) {
PlaceholderManager.registerPlaceholder(
new PlaceholderEntry(
enchantment.getPermissionName() + "_" + "multiplier",
player -> NumberUtils.format(enchantment.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"))
)
);
PlaceholderManager.registerPlaceholder(
new PlaceholderEntry(
enchantment.getPermissionName() + "_" + "multiplier_percentage",
player -> NumberUtils.format(enchantment.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * 100)
)
);
}
if (enchantment instanceof Spell) {
PlaceholderManager.registerPlaceholder(
new PlaceholderEntry(
enchantment.getPermissionName() + "_" + "cooldown",
player -> NumberUtils.format(Spell.getCooldown((Spell) enchantment, player)),
true
)
);
PlaceholderManager.registerPlaceholder(
new PlaceholderEntry(
enchantment.getPermissionName() + "_" + "cooldown_total",
player -> NumberUtils.format(((Spell) enchantment).getCooldownTime())
)
);
}
} }
} }

View File

@ -17,10 +17,10 @@ public class FastTrig {
/** /**
* Sin lookup table. * Sin lookup table.
*/ */
private static final double[] sin = new double[modulus]; private static final double[] SIN_LOOKUP = new double[modulus];
private static double sinLookup(final int a) { private static double sinLookup(final int a) {
return a >= 0 ? sin[a % modulus] : -sin[-a % modulus]; return a >= 0 ? SIN_LOOKUP[a % modulus] : -SIN_LOOKUP[-a % modulus];
} }
/** /**
@ -45,8 +45,8 @@ public class FastTrig {
static { static {
for (int i = 0; i < sin.length; i++) { for (int i = 0; i < SIN_LOOKUP.length; i++) {
sin[i] = Math.sin((i * Math.PI) / (precision * 180)); SIN_LOOKUP[i] = Math.sin((i * Math.PI) / (precision * 180));
} }
} }
} }