mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-17 04:41:21 +01:00
Revert "Fixed Intellect and Wisdom sometimes giving more exp than they should"
This reverts commit f164b76c62
.
This commit is contained in:
parent
84e57fb2d6
commit
d9d9e0a40b
@ -9,13 +9,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Wisdom extends EcoEnchant {
|
public class Wisdom extends EcoEnchant {
|
||||||
|
|
||||||
private static final List<Player> toPrevent = new ArrayList<>();
|
|
||||||
|
|
||||||
public Wisdom() {
|
public Wisdom() {
|
||||||
super(
|
super(
|
||||||
"wisdom", EnchantmentType.NORMAL
|
"wisdom", EnchantmentType.NORMAL
|
||||||
@ -30,13 +24,7 @@ public class Wisdom extends EcoEnchant {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.areRequirementsMet(player)) {
|
if (!EnchantChecks.mainhand(player, this)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int level = EnchantChecks.getMainhandLevel(player, this);
|
|
||||||
|
|
||||||
if (level == 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,18 +32,8 @@ public class Wisdom extends EcoEnchant {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newValue = toPrevent.contains(player) ? event.getExpChangeEvent().getAmount() :
|
int level = EnchantChecks.getMainhandLevel(player, this);
|
||||||
(int) Math.ceil(event.getExpChangeEvent().getAmount() *
|
|
||||||
(1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point"))));
|
|
||||||
|
|
||||||
event.getExpChangeEvent().setAmount(newValue);
|
event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));
|
||||||
|
|
||||||
if (newValue > player.getExpToLevel()) {
|
|
||||||
if (!toPrevent.contains(player)){
|
|
||||||
toPrevent.add(player);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
toPrevent.remove(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,9 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
|||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Intellect extends EcoEnchant {
|
public class Intellect extends EcoEnchant {
|
||||||
|
|
||||||
private static final List<Player> toPrevent = new ArrayList<>();
|
|
||||||
|
|
||||||
public Intellect() {
|
public Intellect() {
|
||||||
super(
|
super(
|
||||||
"intellect", EnchantmentType.SPECIAL
|
"intellect", EnchantmentType.SPECIAL
|
||||||
@ -45,18 +38,6 @@ public class Intellect extends EcoEnchant {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newValue = toPrevent.contains(player) ? event.getExpChangeEvent().getAmount() :
|
event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point")))));
|
||||||
(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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user