[still unsolved]using ArrayList's to boost server performance?

Discussion in 'Plugin Development' started by Heirteir, Jan 31, 2014.

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

    Heirteir

    Alright so i want to make it so that when they do a command /setspawn that it will set all the information that it needs to an arraylist() and that arraylist will save the infomation to the config file so that way the plugin is not always scanning the config file to boost the performance of the server. So please someone give me an example of how i could do this and maybe send me a link to where i could learn more about using arraylist's in bukkit plugins.

    Thanks guys!
    Heirteir
     
  2. Offline

    cakenggt

    One place you could learn more about the configuration is on the configuration API reference wiki page. Here I have linked to the section that talks about getting values from a config. You could load up your config from the file in the onEnable method, save the new spawn to a list in the FileConfiguration object (this is what you get when you call getConfig() ), and then save that to the config.yml in the onDisable method.

    I would suggest reading that whole page, as it has priceless information on how the configuration API works, which could really help your plugin.
     
  3. Offline

    RawCode

  4. Offline

    Heirteir

    RawCode
    This doesn't exactly points to an example on arraylist it only points to array's and when i read there is no information on arraylists
     
  5. Offline

    CubieX

    The config.yml is loaded from disk into RAM when the configuration is loaded for the first time.
    So read access via getConfig() should not be a performance issue.
    Only saving changed contents to file is expensive - depending on the size of the file.
    If write access is not a frequent action in your plugin, you usually do not need to have a special handling for the config file.
    There are other actions plugins do which causes performance issues.
    For eample unoptimized or unneeded loops, bad SQL implementations or ineffcient task handling.
    Better worry about these.
     
  6. Offline

    d0mov0i

    getConfigurationSection, save it to a variable. use variable for future preferences?
     
Thread Status:
Not open for further replies.

Share This Page