mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-01-08 08:08:05 +01:00
Allow metadata ID to be used in shop transaction permission
This commit is contained in:
parent
080597c515
commit
4acd3efda1
@ -12,6 +12,7 @@ import java.util.Locale;
|
||||
|
||||
import static com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome.CLIENT_DOES_NOT_HAVE_PERMISSION;
|
||||
import static com.Acrobot.ChestShop.Events.TransactionEvent.TransactionType.BUY;
|
||||
import static com.Acrobot.ChestShop.Signs.ChestShopSign.ITEM_LINE;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
@ -26,6 +27,12 @@ public class PermissionChecker implements Listener {
|
||||
Player client = event.getClient();
|
||||
TransactionEvent.TransactionType transactionType = event.getTransactionType();
|
||||
|
||||
String itemLine = event.getSign().getLine(ITEM_LINE);
|
||||
if (itemLine.contains("#") && Permission.hasPermissionSetFalse(client, (transactionType == BUY ? Permission.BUY_ID : Permission.SELL_ID) + itemLine)) {
|
||||
event.setCancelled(CLIENT_DOES_NOT_HAVE_PERMISSION);
|
||||
return;
|
||||
}
|
||||
|
||||
for (ItemStack stock : event.getStock()) {
|
||||
String matID = stock.getType().toString().toLowerCase(Locale.ROOT);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user