Fix Vault-Accountcheck for renamed player (#106)

This commit is contained in:
Tim222 2018-01-27 17:12:34 +01:00 committed by Max Lee
parent c5c9e96b13
commit 21815197c6
2 changed files with 8 additions and 3 deletions

View File

@ -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!";

View File

@ -139,15 +139,19 @@ public class PlayerInteract implements Listener {
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));