Package com.onarandombox.multiverseinventories.api.profile

Examples of com.onarandombox.multiverseinventories.api.profile.PlayerProfile


                        }
                        String group = mvgroup.getName();
                        groups.set(group, exampleGroup);
                        MIYamlFiles.saveYamlFile(groups, "groups.yml");
                        for(OfflinePlayer player1 : Bukkit.getServer().getOfflinePlayers()) {
                            PlayerProfile playerdata = mvgroup.getPlayerData(ProfileTypes.SURVIVAL, player1);
                            if(playerdata != null && playerdata.get(Sharables.INVENTORY) != null) {
                                ItemStack[] inventory = playerdata.get(Sharables.INVENTORY);
                                ItemStack[] armor = playerdata.get(Sharables.ARMOR);
                                Integer health = playerdata.get(Sharables.HEALTH);
                                Integer hunger = playerdata.get(Sharables.FOOD_LEVEL);
                                Float saturation = playerdata.get(Sharables.SATURATION);
                                Integer totalexp = playerdata.get(Sharables.TOTAL_EXPERIENCE);
                                PotionEffect[] potioneffects = playerdata.get(Sharables.POTIONS);
                                LinkedList<PotionEffect> effects = new LinkedList<PotionEffect>();
                                if(potioneffects != null) {
                                    for(int i = 0; i < potioneffects.length; i++) {
                                        effects.add(potioneffects[i]);
                                    }
                                }
                                if(MIYamlFiles.usesql) {
                                    MIYamlFiles.con.saveInventory(player, group, new MIInventory(inventory, armor, effects), "SURVIVAL");
                                    MIYamlFiles.con.saveHealth(player, group, health);
                                    MIYamlFiles.con.saveHunger(player, group, hunger);
                                    MIYamlFiles.con.saveSaturation(player, group, saturation);
                                    MIYamlFiles.con.saveExperience(player, group, totalexp);
                                } else {
                                    MIPlayerFile config = new MIPlayerFile(player1, group);
                                    config.saveInventory(new MIInventory(inventory, armor, effects), "SURVIVAL");
                                    config.saveHealth(health);
                                    config.saveHunger(hunger);
                                    config.saveSaturation(saturation);
                                    int[] levels = plugin.getXP(totalexp);
                                    config.saveExperience(totalexp, levels[0], (float) ((float) levels[1] / (float) levels[2]));
                                }
                            }
                            PlayerProfile adventureplayerdata = mvgroup.getPlayerData(ProfileTypes.ADVENTURE, player1);
                            if(adventureplayerdata != null && adventureplayerdata.get(Sharables.INVENTORY) != null) {
                                ItemStack[] inventory = adventureplayerdata.get(Sharables.INVENTORY);
                                ItemStack[] armor = adventureplayerdata.get(Sharables.ARMOR);
                                PotionEffect[] potioneffects = adventureplayerdata.get(Sharables.POTIONS);
                                LinkedList<PotionEffect> effects = new LinkedList<PotionEffect>();
                                if(potioneffects != null) {
                                    for(int i = 0; i < potioneffects.length; i++) {
                                        effects.add(potioneffects[i]);
                                    }
                                }
                                if(MIYamlFiles.usesql) {
                                    MIYamlFiles.con.saveInventory(player, group, new MIInventory(inventory, armor, effects), "ADVENTURE");
                                } else {
                                    MIPlayerFile config = new MIPlayerFile(player1, group);
                                    config.saveInventory(new MIInventory(inventory, armor, effects), "ADVENTURE");
                                }
                            }
                        }
                    }
                    for(World world : Bukkit.getWorlds()) {
                        String worldName = world.getName();
                        if(!MIYamlFiles.getGroups().containsKey(worldName)) {
                            WorldProfile worldprofile = mvinventories.getWorldManager().getWorldProfile(worldName);
                            for(OfflinePlayer player1 : Bukkit.getServer().getOfflinePlayers()) {
                                PlayerProfile playerdata = worldprofile.getPlayerData(ProfileTypes.SURVIVAL, player1);
                                if(playerdata != null && playerdata.get(Sharables.INVENTORY) != null) {
                                    ItemStack[] inventory = playerdata.get(Sharables.INVENTORY);
                                    ItemStack[] armor = playerdata.get(Sharables.ARMOR);
                                    Integer health = playerdata.get(Sharables.HEALTH);
                                    Integer hunger = playerdata.get(Sharables.FOOD_LEVEL);
                                    Float saturation = playerdata.get(Sharables.SATURATION);
                                    Integer totalexp = playerdata.get(Sharables.TOTAL_EXPERIENCE);
                                    PotionEffect[] potioneffects = playerdata.get(Sharables.POTIONS);
                                    LinkedList<PotionEffect> effects = new LinkedList<PotionEffect>();
                                    if(potioneffects != null) {
                                        for(int i = 0; i < potioneffects.length; i++) {
                                            effects.add(potioneffects[i]);
                                        }
                                    }
                                    if(MIYamlFiles.usesql) {
                                        MIYamlFiles.con.saveInventory(player, worldName, new MIInventory(inventory, armor, effects), "SURVIVAL");
                                        MIYamlFiles.con.saveHealth(player, worldName, health);
                                        MIYamlFiles.con.saveHunger(player, worldName, hunger);
                                        MIYamlFiles.con.saveSaturation(player, worldName, saturation);
                                        MIYamlFiles.con.saveExperience(player, worldName, totalexp);
                                    } else {
                                        MIPlayerFile config = new MIPlayerFile(player1, worldName);
                                        config.saveInventory(new MIInventory(inventory, armor, effects), "SURVIVAL");
                                        config.saveHealth(health);
                                        config.saveHunger(hunger);
                                        config.saveSaturation(saturation);
                                        int[] levels = plugin.getXP(totalexp);
                                        config.saveExperience(totalexp, levels[0], (float) ((float) levels[1] / (float) levels[2]));
                                    }
                                }
                                PlayerProfile adventureplayerdata = worldprofile.getPlayerData(ProfileTypes.ADVENTURE, player1);
                                if(adventureplayerdata != null && adventureplayerdata.get(Sharables.INVENTORY) != null) {
                                    ItemStack[] inventory = adventureplayerdata.get(Sharables.INVENTORY);
                                    ItemStack[] armor = adventureplayerdata.get(Sharables.ARMOR);
                                    PotionEffect[] potioneffects = adventureplayerdata.get(Sharables.POTIONS);
                                    LinkedList<PotionEffect> effects = new LinkedList<PotionEffect>();
                                    if(potioneffects != null) {
                                        for(int i = 0; i < potioneffects.length; i++) {
                                            effects.add(potioneffects[i]);
                                        }
View Full Code Here

TOP

Related Classes of com.onarandombox.multiverseinventories.api.profile.PlayerProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.