Skip to content

Commit

Permalink
fix: Make xp cost display in creative but be free
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Dec 20, 2023
1 parent 7090572 commit d360cba
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public static int getExperienceLevelCost(Entity entity, IWaystone waystone, Warp
return 0;
}

boolean enableXPCost = !player.getAbilities().instabuild;

int xpForLeashed = WaystonesConfig.getActive().xpCost.xpCostPerLeashed * context.getLeashedEntities().size();

double xpCostMultiplier = warpMode.getXpCostMultiplier();
Expand All @@ -98,7 +96,7 @@ public static int getExperienceLevelCost(Entity entity, IWaystone waystone, Warp
xpLevelCost = minimumXpCost;
}

return enableXPCost ? (int) Math.round((xpLevelCost + xpForLeashed) * xpCostMultiplier) : 0;
return (int) Math.round((xpLevelCost + xpForLeashed) * xpCostMultiplier);
}


Expand Down Expand Up @@ -274,7 +272,7 @@ public static Either<List<Entity>, WaystoneTeleportError> tryTeleport(IWaystoneT
}
}

if (entity instanceof Player player && !context.getExperienceCost().canAfford(player)) {
if (entity instanceof Player player && !context.getExperienceCost().canAfford(player) && !player.getAbilities().instabuild) {
return Either.right(new WaystoneTeleportError.NotEnoughXp());
}

Expand Down

0 comments on commit d360cba

Please sign in to comment.