use of dte.employme.config.ConfigFile in project EmployMe by DavidTheExplorer.
the class SimplePlayerContainerService method loadContainers.
private static void loadContainers(ConfigFile containersConfig, Map<UUID, Inventory> containersMap, Supplier<Inventory> containerCreator) {
containersConfig.getConfig().getKeys(false).stream().map(UUID::fromString).forEach(playerUUID -> {
Map<Integer, ItemStack> playerItems = containersConfig.getConfig().getConfigurationSection(playerUUID.toString()).getKeys(false).stream().map(Integer::parseInt).collect(toMap(Function.identity(), index -> containersConfig.getConfig().getItemStack(playerUUID + "." + index)));
Inventory container = containerCreator.get();
playerItems.forEach(container::setItem);
containersMap.put(playerUUID, container);
});
}
Aggregations