Problem with "getString()" from config file

Discussion in 'Plugin Development' started by ice374, Aug 23, 2013.

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

    ice374

    Hey, i'm getting an error on line 149 that is stopping my plugin from booting up, im not getting an errors in Eclipse but yeah, it wont boot the plugin, here is my error:
    http://pastebin.com/XDfpVU5c

    I believe that its the "getString(" part that is causing the problem

    Here is my code, line for line up to where you should need to see:
    http://pastebin.com/Xagvx0v0

    I will like and follow anyone that solves my problem :)
    Thankyou <3
     
  2. Offline

    AoH_Ruthless

    ice374
    Are you getting the string from config? If so it needs to be:

    Code:
    String worldName1 = arena.getConfig().getString("p1spawn.world");
    I think. Try that.
     
  3. Offline

    ice374

    here is the error i get in eclipse when i do that: http://i.imgur.com/ZE39HFN.png :-(
     
  4. Offline

    AoH_Ruthless

    ice374
    Where are you getting arena exactly? Is it arena.yml?
    If it is, I may have given you bad information by using .getConfig();, I will take another look at the code.

    ice374
    Can you paste your arena.yml? There might be an issue in that.
    It looks like this somewhere, correct?

    Code:
    p1spawn:
      world: 'Some Code goes here'
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  5. Offline

    ice374

    here is it exactly how i have it:
    Code:
    p1spawn:
      world: Dev
      x: 34.77150089578042
      y: 92.0
      z: 1134.583495710399
      yaw: -228.59993
      pitch: 18.600044
     
  6. Offline

    AoH_Ruthless

    ice374
    You may need ' ' around Dev, I'm not sure what the requirements are for quotations around a string, sometimes you need them and sometimes not. It would be worth a try though.
    Also, make sure you didn't accidentally use TAB in the arena.yml
     
  7. Offline

    ice374

    if you mean like this:
    Code:
    p1spawn:
      world: 'Dev'
      x: 34.77150089578042
      y: 92.0
      z: 1134.583495710399
      yaw: -228.59993
      pitch: 18.600044
    then its still not working, also there wont be tabs because i had the locations saved by a command

    chasechocolate EcMiner Digi
    do either of you three know whats going on? you have all been of great assistance in the past

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

    Mang0eZPvP

    MAke an instance of the class first
     
    ice374 likes this.
  9. Offline

    ice374

    please show how
     
  10. Offline

    Mang0eZPvP


    in the arena class u do
    Code:java
    1. static Arena instance = new Arena();
    2.  
    3. public static Arena getInstance() {
    4. return instance;
    5. }


    in the class u r trying to access the config from u do
    Code:java
    1. Arena arena = Arena.getInstance();


    welcome
     
  11. Offline

    ice374

    oh, you mean like that, at the moment its all one class
     
  12. Offline

    EcMiner

    Maybe you can try arena.addDefault("p1spawn.world", "Dev"); and so on instead of trying to copy the file from your project, then use arena.options.copyDefaults(true);

    Actually i found a way to fix this: http://pastebin.com/fGkgQ9t9 if you have any further question feel free to ask them

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page