Solved Read prefix from config

Discussion in 'Plugin Development' started by Mauzuk, Jul 18, 2020.

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


    Hi, I need help.
    I need to read the prefix entered by the user from the config.

    I tried this code:
    public FileConfiguration cfg = this.getLang();
    public String prefix = cfg.getString("JoinMessage.prefix");
    But I'm still getting an error in the console after turning it on.
    Caused by: java.lang.NullPointerException
        at me.Mauzuk.JoinMessage.Main.<init>( ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_261]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_261]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_261]
        at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_261]
        at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_261]
        at<init>( ~[spigot-1.16.1.jar:git-Spigot-0287a20-7560f5f]
        at ~[spigot-1.16.1.jar:git-Spigot-0287a20-7560f5f]
        ... 24 more
  2. Offline


    can i see your full code and the config file?
Thread Status:
Not open for further replies.

Share This Page