Make auto-fill check both buy and sell permission separately (#325)

Also slightly changes how the auto fill message is sent to not send two
 messages (autofill and no-permission)
This commit is contained in:
Phoenix616 2020-06-19 18:58:00 +01:00
parent 7161c0bfdf
commit 0b39fd1a5e
3 changed files with 5 additions and 2 deletions

View File

@ -62,6 +62,9 @@ public class ErrorMessageSender implements Listener {
case NOT_ENOUGH_MONEY:
message = Messages.NOT_ENOUGH_MONEY;
break;
case ITEM_AUTOFILL:
message = Messages.CLICK_TO_AUTOFILL_ITEM;
break;
default:
break;
}

View File

@ -52,7 +52,6 @@ public class ItemChecker implements Listener {
if (item == null) {
event.setSignLine(ITEM_LINE, ChatColor.BOLD + ChestShopSign.AUTOFILL_CODE);
event.setOutcome(ITEM_AUTOFILL);
event.getPlayer().sendMessage(Messages.prefix(Messages.CLICK_TO_AUTOFILL_ITEM));
return;
}
} else {

View File

@ -35,7 +35,8 @@ public class PermissionChecker implements Listener {
ItemStack item = parseEvent.getItem();
if (item == null) {
if (!Permission.has(player, SHOP_CREATION)) {
if ((PriceUtil.hasBuyPrice(priceLine) && !Permission.has(player, SHOP_CREATION_BUY))
|| (PriceUtil.hasSellPrice(priceLine) && !Permission.has(player, SHOP_CREATION_SELL))) {
event.setOutcome(NO_PERMISSION);
}
return;