Skip to content

Commit

Permalink
Fix Vault-Accountcheck for renamed player (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPanic authored and Phoenix616 committed Jan 27, 2018
1 parent c5c9e96 commit 2181519
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Expand Up @@ -20,6 +20,7 @@ public class Messages {
@PrecededBySpace
public static String CLIENT_DEPOSIT_FAILED = "Money deposit to your account failed!";
public static String SHOP_DEPOSIT_FAILED = "Money deposit to shop owner failed!";
public static String NO_ECONOMY_ACCOUNT = "Economy account from shop owner doesn't exist!";

@PrecededBySpace
public static String NO_BUYING_HERE = "You can't buy here!";
Expand Down
Expand Up @@ -139,15 +139,19 @@ private static PreTransactionEvent preparePreTransactionEvent(Sign sign, Player
String prices = sign.getLine(PRICE_LINE);
String material = sign.getLine(ITEM_LINE);

Account account = NameManager.getAccountFromShortName(name);
if (account == null)
Account account = NameManager.getLastAccountFromShortName(name);
if (account == null) {
player.sendMessage(Messages.prefix(Messages.PLAYER_NOT_FOUND));
return null;
}

boolean adminShop = ChestShopSign.isAdminShop(sign);

// check if player exists in economy
if(!adminShop && !VaultListener.getProvider().hasAccount(account.getName()))
if(!adminShop && !VaultListener.getProvider().hasAccount(account.getName())) {
player.sendMessage(Messages.prefix(Messages.NO_ECONOMY_ACCOUNT));
return null;
}

Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));
Expand Down

0 comments on commit 2181519

Please sign in to comment.