EssentialsX

EssentialsX

2M Downloads

Starting-balance is always zero for new players

BoomEaro opened this issue · 1 comments

commented

Type of bug

Data loss, Other unexpected behaviour

/ess version output

Server версия: 1.12.2-R0.1-SNAPSHOT git-Paper-1615 (MC: 1.12.2)
Brand версия: Paper
EssentialsX версия: 2.19.0-dev+161-3fe279e
LuckPerms версия: 5.3.45
Vault версия: 1.5.6-b49
EssentialsXChat версия: 2.19.0-dev+161-3fe279e
EssentialsXSpawn версия: 2.19.0-dev+161-3fe279e
Citizens версия: 2.0.27-SNAPSHOT

Server startup log

none

EssentialsX config files

The starting-balance section is exactly specified with the desired value in the config.

Error log (if applicable)

none

Bug description

It looks like starting-balance is not working as expected after a recent update of the configuration logic.

The starting-balance value is returned correct, but it does not apply to new players.

It looks like the problem is with these lines:

if (holder.money() != null) {
result = holder.money();
}

The money() method never returns null. As a result, it is considered that this player already has a balance from his personal config.

Although, the variable money is declared null by default:

private @MonotonicNonNull BigDecimal money;
public BigDecimal money() {
return money;
}
public void money(final BigDecimal value) {
this.money = value;
}

But for some reason, the money() method will never return null.

It is not clear why this is happening and how to fix it.

Steps to reproduce

Very easy to repeat.

  1. Set the starting-balance to 100000
  2. Log in to the server as a player who has never been in the game
  3. Enter the command /money
  4. The command returns zero balance.

Expected behaviour

Balance must be set according to configuration.

Actual behaviour

The balance is always set to zero.

commented

Has been fixed in latest dev build, thanks for catching this!