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

Fix Vault-Accountcheck for renamed player #106

Merged
merged 4 commits into from Jan 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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