HashMap

Discussion in 'Plugin Development' started by wiedzmin137, May 2, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    wiedzmin137

    Hello. I have problem with usage HashMap.

    I have diagnosed issues with HashMaps on plugin start and... it works but it doesn't. Methodes are properly executed, HashMap have good values for... time of executing method.

    Code:java
    1. for (Player player : Bukkit.getServer().getOnlinePlayers()) {
    2. Hero hero = heroes.getCharacterManager().getHero(player);
    3. HeroesSkillTree hst = new HeroesSkillTree();
    4. hst.loadPlayerConfig(player.getName());
    5. hst.recalcPlayerPoints(hero, hero.getHeroClass());
    6. }


    But this is not the most strange thing. I have created /st HashMap command which loadPlayerFile and recalcPlayerPoints. Only difference between onEnable method and this is that the /st HashMap works PROPER.

    Code:java
    1. case "hashmap": HST.loadPlayerConfig(sender.getName());
    2. HST.recalcPlayerPoints(WAddonCore.heroes.getCharacterManager().getHero((Player)sender),
    3. WAddonCore.heroes.getCharacterManager().getHero((Player)sender).getHeroClass());
    4. sender.sendMessage(HST.playerSkills.values().toString());
    5. sender.sendMessage(HST.playerSkills.toString());
    6. sender.sendMessage(HST.playerClasses.values().toString()); break;


    Class extending JavaPlugin: click.
    Class with HashMaps: click.

    Also, how I can copy text from one *.yml file and paste in another *.yml file?
     
  2. Offline

    bramhaag

    wiedzmin137

    I know the answere to your .yml problem I think. Just open the file with a program like Notepad++ , than select the text you want to copy, press ctrl+c on Windows and cmd+c on Mac. Than open your other .yml file where you want to past the text in, press crtl+v or cmd+v and your done.
     
  3. Offline

    wiedzmin137

    Just no comment... I need do it by my PLUGIN, automatic.
     
  4. Offline

    bramhaag

    Nevermind than :p

    wiedzmin137
    I thought about a solution for the .yml problem, and I think I got one. Get the text that you want and make a String variable for it. Than add the String variable to the other .yml file where you want to paste it in.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  5. Offline

    wiedzmin137

    But how is the method for printing new line of text into .yml File (this will do all I need)?

    EDIT: I have repaired problem with HashMap.
    Code:java
    1. HeroesSkillTree hst = new HeroesSkillTree();

    This instance was awful.
     
Thread Status:
Not open for further replies.

Share This Page