} else if(command.equalsIgnoreCase("miimport")) {
Plugin p = plugin.getServer().getPluginManager().getPlugin("WorldInventories");
if(p == null) {
sender.sendMessage(ChatColor.DARK_RED + "I'm sorry, WorldInventories isn't loaded... Import aborted.");
} else {
WorldInventories mvinventories;
try {
mvinventories = (WorldInventories) p;
} catch(Exception e) {
MultiInv.log.severe("Unable to import inventories from WorldInventories.");
sender.sendMessage(ChatColor.DARK_RED + "I'm sorry, something funky happened... Import aborted.");
return;
}
ArrayList<Group> mvgroups = WorldInventories.groups;
YamlConfiguration groups = new YamlConfiguration();
MIYamlFiles.getGroups().clear();
for(Group mvgroup : mvgroups) {
List<String> mvworlds = mvgroup.getWorlds();
ArrayList<String> exampleGroup = new ArrayList<String>();
for(String world : mvworlds) {
exampleGroup.add(world);
MIYamlFiles.getGroups().put(world, mvgroup.getName());
}
String group = mvgroup.getName();
groups.set(group, exampleGroup);
MIYamlFiles.saveYamlFile(groups, "groups.yml");
for(OfflinePlayer player1 : Bukkit.getServer().getOfflinePlayers()) {
plugin.getLogger().info("Importing player " + player1.getName() + "'s inventory from group " + mvgroup.getName());
HashMap<Integer, ItemStack[]> pinventory = mvinventories.loadPlayerInventory(player1.getName(), mvgroup, InventoryLoadType.INVENTORY);
HashMap<Integer, ItemStack[]> playerenderchest = mvinventories.loadPlayerInventory(player1.getName(), mvgroup, InventoryLoadType.ENDERCHEST);
PlayerStats playerstats = mvinventories.loadPlayerStats(player1.getName(), mvgroup);
if(pinventory != null) {
ItemStack[] inventory = pinventory.get(InventoryStoredType.INVENTORY);
ItemStack[] armor = pinventory.get(InventoryStoredType.ARMOUR);
double health = 20;
int hunger = 20;