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:
parent
7161c0bfdf
commit
0b39fd1a5e
|
@ -62,6 +62,9 @@ public class ErrorMessageSender implements Listener {
|
||||||
case NOT_ENOUGH_MONEY:
|
case NOT_ENOUGH_MONEY:
|
||||||
message = Messages.NOT_ENOUGH_MONEY;
|
message = Messages.NOT_ENOUGH_MONEY;
|
||||||
break;
|
break;
|
||||||
|
case ITEM_AUTOFILL:
|
||||||
|
message = Messages.CLICK_TO_AUTOFILL_ITEM;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ public class ItemChecker implements Listener {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
event.setSignLine(ITEM_LINE, ChatColor.BOLD + ChestShopSign.AUTOFILL_CODE);
|
event.setSignLine(ITEM_LINE, ChatColor.BOLD + ChestShopSign.AUTOFILL_CODE);
|
||||||
event.setOutcome(ITEM_AUTOFILL);
|
event.setOutcome(ITEM_AUTOFILL);
|
||||||
event.getPlayer().sendMessage(Messages.prefix(Messages.CLICK_TO_AUTOFILL_ITEM));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -35,7 +35,8 @@ public class PermissionChecker implements Listener {
|
||||||
ItemStack item = parseEvent.getItem();
|
ItemStack item = parseEvent.getItem();
|
||||||
|
|
||||||
if (item == null) {
|
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);
|
event.setOutcome(NO_PERMISSION);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue