From f8f1facf43afdb960e87e07ec6e5e55701cacecc Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Mon, 31 May 2021 11:12:06 -0400 Subject: [PATCH] Check legacy "NPC:" UUIDs in VaultEconomyProvider#hasAccount (#4178) --- .../essentials/economy/vault/VaultEconomyProvider.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/economy/vault/VaultEconomyProvider.java b/Essentials/src/main/java/com/earth2me/essentials/economy/vault/VaultEconomyProvider.java index 273f8b410..a29074496 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/economy/vault/VaultEconomyProvider.java +++ b/Essentials/src/main/java/com/earth2me/essentials/economy/vault/VaultEconomyProvider.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.EssentialsUserConf; 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; @@ -15,6 +16,7 @@ import java.math.BigDecimal; 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; @@ -74,7 +76,11 @@ public class VaultEconomyProvider implements Economy { @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