Revert "Fixed Intellect and Wisdom sometimes giving more exp than they should"

This reverts commit f164b76c62.
This commit is contained in:
_OfTeN_ 2022-01-24 23:15:46 +03:00
parent 84e57fb2d6
commit d9d9e0a40b
2 changed files with 4 additions and 45 deletions

View File

@ -9,13 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class Wisdom extends EcoEnchant {
private static final List<Player> toPrevent = new ArrayList<>();
public Wisdom() {
super(
"wisdom", EnchantmentType.NORMAL
@ -30,13 +24,7 @@ public class Wisdom extends EcoEnchant {
return;
}
if (!this.areRequirementsMet(player)) {
return;
}
int level = EnchantChecks.getMainhandLevel(player, this);
if (level == 0) {
if (!EnchantChecks.mainhand(player, this)) {
return;
}
@ -44,18 +32,8 @@ public class Wisdom extends EcoEnchant {
return;
}
int newValue = toPrevent.contains(player) ? event.getExpChangeEvent().getAmount() :
(int) Math.ceil(event.getExpChangeEvent().getAmount() *
(1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point"))));
int level = EnchantChecks.getMainhandLevel(player, this);
event.getExpChangeEvent().setAmount(newValue);
if (newValue > player.getExpToLevel()) {
if (!toPrevent.contains(player)){
toPrevent.add(player);
}
} else {
toPrevent.remove(player);
}
event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));
}
}

View File

@ -7,16 +7,9 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class Intellect extends EcoEnchant {
private static final List<Player> toPrevent = new ArrayList<>();
public Intellect() {
super(
"intellect", EnchantmentType.SPECIAL
@ -45,18 +38,6 @@ public class Intellect extends EcoEnchant {
return;
}
int newValue = toPrevent.contains(player) ? event.getExpChangeEvent().getAmount() :
(int) Math.ceil(event.getExpChangeEvent().getAmount() *
(1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point"))));
event.getExpChangeEvent().setAmount(newValue);
if (newValue > player.getExpToLevel()) {
if (!toPrevent.contains(player)){
toPrevent.add(player);
}
} else {
toPrevent.remove(player);
}
event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));
}
}