Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check legacy "NPC:" UUIDs in VaultEconomyProvider#hasAccount #4178

Merged
merged 2 commits into from
May 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.earth2me.essentials.api.NoLoanPermittedException;
import com.earth2me.essentials.api.UserDoesNotExistException;
import com.earth2me.essentials.utils.NumberUtil;
import com.google.common.base.Charsets;
import net.ess3.api.MaxMoneyException;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
Expand All @@ -15,6 +16,7 @@
import java.text.MessageFormat;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -74,7 +76,11 @@ public String currencyNameSingular() {
@SuppressWarnings("deprecation")
@Override
public boolean hasAccount(String playerName) {
return com.earth2me.essentials.api.Economy.playerExists(playerName);
if (com.earth2me.essentials.api.Economy.playerExists(playerName)) {
return true;
}
// We may not have the player name in the usermap, let's double check an NPC account with this name doesn't exist.
return com.earth2me.essentials.api.Economy.playerExists(UUID.nameUUIDFromBytes(("NPC:" + playerName).getBytes(Charsets.UTF_8)));
}

@Override
Expand Down