use of org.cubeengine.module.itemduct.DuctFilterCarrier in project modules-extra by CubeEngine.
the class ItemDuctFilterListener method openFilter.
private void openFilter(Player player, DuctData ductData, Direction dir, Location<World> loc) {
if (!player.hasPermission(viewFilterPerm.getId())) {
i18n.send(ChatTypes.ACTION_BAR, player, NEGATIVE, "You are not allowed to edit filters");
return;
}
List<ItemStack> list = ductData.get(dir).get();
DuctFilterCarrier carrier = new DuctFilterCarrier(ductData, loc, dir);
boolean canEdit = player.hasPermission(editFilterPerm.getId());
Inventory inventory = Inventory.builder().property(InventoryTitle.PROPERTY_NAME, InventoryTitle.of(canEdit ? i18n.translate(player, TextFormat.NONE, "ItemDuct Filters") : i18n.translate(player, TextFormat.NONE, "View ItemDuct Filters"))).withCarrier(carrier).build(plugin);
carrier.init(((CarriedInventory<?>) inventory));
for (ItemStack itemStack : list) {
inventory.offer(itemStack);
}
Sponge.getCauseStackManager().pushCause(player);
if (canEdit) {
player.openInventory(inventory);
} else {
igf.prepareInv(inventory, player.getUniqueId()).blockPutInAll().blockTakeOutAll().submitInventory(Itemduct.class, true);
}
player.getProgress(module.filters).grant();
}
Aggregations