Solved How to use MemorySection for getConfig(); in a scheduleSyncRepeatingTask

Discussion in 'Plugin Development' started by TheFrieber_, Mar 9, 2022.

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

    TheFrieber_

    Sup, got a little problem where my brain shutdown..
    Im trying to use "this.getConfig()..." in a scheduleSyncRepeatingTask void, however this.getConfig(); does not exist: The method getConfig() is undefined for the type new Runnable(){}.

    Now i used "getConfig().." without "this.", it exists but doesn't work. Now im trying to use MemorySection, i dunno how i should use this for "this.getConfig();", it doesn't give any error, but tells me this in the Console:
    "java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.MemorySection.getBoolean(String)" because the return value of "Jetpack.Main$1.getConfig()" is null", sure because the MemorySection has no code in it, and the MemSection doesn't have access to the acuall this.getConfig(); too..

    Btw: I don't want to write every getConfig externally, it would cost too much time + would be annoying + the code is long.

    Code: scheduleSyncRepeatingTask void, this.getConfig().getBoolean/Double("path");
    Code:
                private MemorySection getConfig() {
                  
                    return null;
                }
    Fixed: "getConfig()..." without "this." must be under onEnable to work.
     
    Last edited: Mar 9, 2022
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    TheFrieber_

    Nope, "plugin." doesn't exist/plugin cannot be resolved
     
  4. Online

    timtower Administrator Administrator Moderator

    Need to make it first
     
Thread Status:
Not open for further replies.

Share This Page