Fixed more uses of deprecated methods

This commit is contained in:
Auxilor 2022-01-13 12:34:27 +00:00
parent c3f049c424
commit aedb2154b4
4 changed files with 6 additions and 8 deletions

View File

@ -1,6 +1,5 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.eco.util.NumberUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
@ -28,7 +27,7 @@ public class Oxygenate extends EcoEnchant {
int oxygenLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "oxygen-per-level");
int oxygen = level * oxygenLevel;
int newOxygen = player.getRemainingAir() + oxygen;
newOxygen = NumberUtils.equalIfOver(newOxygen, player.getMaximumAir());
newOxygen = Math.min(newOxygen, player.getMaximumAir());
player.setRemainingAir(newOxygen);
}

View File

@ -49,7 +49,7 @@ public class StoneSwitcher extends EcoEnchant {
double random = NumberUtils.randFloat(0, 1);
double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size();
int selectedIndex = (int) Math.floor(random / band);
selectedIndex = NumberUtils.equalIfOver(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1);
selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1);
String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex);
material = Material.getMaterial(materialName.toUpperCase());

View File

@ -1,7 +1,6 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
import com.willfp.eco.util.NumberUtils;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
@ -60,7 +59,7 @@ public class Aiming extends EcoEnchant {
double distance = level * multiplier;
double force = arrow.getVelocity().clone().length() / 3;
force = NumberUtils.equalIfOver(force, 1);
force = Math.min(force, 1);
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "require-full-force") && force < 0.9) {
return;

View File

@ -188,7 +188,7 @@ public class EnchantingListeners extends PluginDependent<EcoPlugin> implements L
level = (int) Math.ceil(enchantlevel2 / enchantlevel3);
}
level = NumberUtils.equalIfOver(level, enchantment.getMaxLevel());
level = Math.min(level, enchantment.getMaxLevel());
toAdd.put(enchantment, level);
if (this.getPlugin().getConfigYml().getBool("enchanting-table.cap-amount.enabled") && toAdd.size() >= this.getPlugin().getConfigYml().getInt("enchanting-table.cap-amount.limit")) {
@ -285,7 +285,7 @@ public class EnchantingListeners extends PluginDependent<EcoPlugin> implements L
int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level");
try {
event.getOffers()[2].setCost(NumberUtils.equalIfOver(event.getOffers()[2].getCost(), maxLevel));
event.getOffers()[2].setCost(Math.min(event.getOffers()[2].getCost(), maxLevel));
} catch (ArrayIndexOutOfBoundsException | NullPointerException ignored) {
}
@ -315,7 +315,7 @@ public class EnchantingListeners extends PluginDependent<EcoPlugin> implements L
midEnchantLevel *= (int) Math.ceil((double) maxLevel / 30);
topEnchantLevel *= (int) Math.ceil((double) maxLevel / 30);
bottomEnchantLevel = NumberUtils.equalIfOver(bottomEnchantLevel, maxLevel);
bottomEnchantLevel = Math.min(bottomEnchantLevel, maxLevel);
int midUnbreakingLevel = NumberUtils.randInt(1, 3);
if (midUnbreakingLevel < 2) {