Beispiel #1
0
 @EventHandler(priority = EventPriority.HIGH)
 public void onSSPreTransactionEvent(SSPreTransactionEvent event) {
   if (event.isCancelled() || !event.canBeCancelled()) return;
   List<String> operation = SignShopConfig.getBlocks(event.getOperation());
   if (!hasPermit(event.getOwner(), operation, event.getPlayer().getWorld())) {
     event.getPlayer().sendMessage(SignShopConfig.getError("no_permit_owner", null));
     event.setCancelled(true);
   }
 }
 @EventHandler(priority = EventPriority.HIGH)
 public void onSSPreTransactionEvent(SSPreTransactionEvent event) {
   if (event.isCancelled() || !event.canBeCancelled()) return;
   String sOperation = event.getOperation();
   SignShopPlayer ssPlayer = event.getPlayer();
   if (ssPlayer.hasPerm(("SignShop.DenyUse." + sOperation), false)
       && !ssPlayer.hasPerm(("SignShop.Signs." + sOperation), false)
       && !ssPlayer.hasPerm(("SignShop.Admin." + sOperation), true)) {
     ssPlayer.sendMessage(SignShopConfig.getError("no_permission_use", null));
     event.setCancelled(true);
   }
 }
 @EventHandler(priority = EventPriority.HIGH)
 public void onSSBuildEvent(SSCreatedEvent event) {
   if (event.isCancelled() || !event.canBeCancelled()) return;
   List<String> operation = SignShopConfig.getBlocks(event.getOperation());
   String sOperation = event.getOperation();
   if (!operation.contains("playerIsOp")
       && !event.getPlayer().hasPerm(("SignShop.Signs." + sOperation), false)
       && !event.getPlayer().hasPerm(("SignShop.Signs.*"), false)) {
     event.getPlayer().sendMessage(SignShopConfig.getError("no_permission", null));
     event.setCancelled(true);
   }
 }
Beispiel #4
0
  @Override
  public Boolean setupOperation(SignShopArguments ssArgs) {
    if (ssArgs.getContainables().isEmpty()) {
      ssArgs
          .getPlayer()
          .get()
          .sendMessage(SignShopConfig.getError("chest_missing", ssArgs.getMessageParts()));
      return false;
    }
    ItemStack[] isTotalItems = getRecords(ssArgs.getContainables().get());

    if (isTotalItems.length == 0) {
      ssArgs
          .getPlayer()
          .get()
          .sendMessage(SignShopConfig.getError("chest_empty", ssArgs.getMessageParts()));
      return false;
    }
    ssArgs.getItems().set(isTotalItems);
    ssArgs.setMessagePart("!items", itemUtil.itemStackToString(ssArgs.getItems().get()));
    return true;
  }
Beispiel #5
0
  @Override
  public Boolean checkRequirements(SignShopArguments ssArgs, Boolean activeCheck) {
    ItemStack[] isTotalItems = getRecords(ssArgs.getContainables().get());

    if (isTotalItems.length == 0) {
      ssArgs
          .getPlayer()
          .get()
          .sendMessage(SignShopConfig.getError("chest_empty", ssArgs.getMessageParts()));
      return false;
    }

    return true;
  }