Set exp level for /npc command expcost rather than exp %

This commit is contained in:
fullwall 2022-01-12 02:01:30 +08:00
parent dad74a3279
commit 23c4779404

View File

@ -102,11 +102,11 @@ public class CommandTrait extends Trait {
} }
} }
if (experienceCost > 0) { if (experienceCost > 0) {
if (player.getExp() < experienceCost) { if (player.getLevel() < experienceCost) {
sendErrorMessage(player, CommandTraitMessages.MISSING_EXPERIENCE, null, experienceCost); sendErrorMessage(player, CommandTraitMessages.MISSING_EXPERIENCE, null, experienceCost);
return false; return false;
} }
player.setExp(player.getExp() - experienceCost); player.setLevel((int) (player.getLevel() - experienceCost));
} }
if (itemRequirements.size() > 0) { if (itemRequirements.size() > 0) {
List<ItemStack> req = Lists.newArrayList(itemRequirements); List<ItemStack> req = Lists.newArrayList(itemRequirements);