private void loadGlobalChest() {
ConfigurationSection inventorySection = items.getConfigurationSection("inventory");
if (inventorySection != null) {
globalChestInventory.setContents(((List<ItemStack>) inventorySection.getList("items")).toArray(ItemStack[]::new));
}
}
Can anyone tell me why when I try to cast List it gives me a warning? (which is Type safety: Unchecked cast from List<capture#1-of ?> to List)
It throws an error in the console, telling me that could not pass the InventoryOpenEvent because the return value of ConfigurationSection.getList(String) is null.
I think that probably the error is in the file where I store the items of the chest, because when there are no items, all the lines are null.