#I keep getting this error : "org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentExce

1 messages · Page 1 of 1 (latest)

visual marten
#

Here is my main class: https://pastebin.com/BACHPiN5 and here is my tpa class: https://pastebin.com/7Ls9MTKX . Can someone help me because I cannot seem to use DI as my main class

lime rock
#

private static final Teleportationutils instance = new Teleportationutils();
public static Teleportationutils getInstance() {
return instance;
}

#

You can remove all that if you are using DI

#

Which should also fix your issue

jagged niche
#
public final class Teleportationutils extends JavaPlugin {
 
    private static Teleportationutils instance;
    public static Teleportationutils getInstance() {
        return instance;
    }
    @Override
    public void onEnable() {

        instance = this;
        // Plugin startup logic
        getCommand("up").setExecutor(new up());
        getCommand("tpa").setExecutor(new tpa(this));
    }
 
    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
lime rock
#

Instance can’t be final

#

Other than that, yeah that works too

jagged niche
#

'this' refers to this instance of the class

#

and you're taking the instance that gets created and throwing it into the instance var

#

this class gets initialised by spigot and then the onEnable() gets called first

visual marten
#

okay

jagged niche
#

let us know if it works

#

I mean it should lol

visual marten
visual marten
#

Ah! The timings system is turned off is that why?

jagged niche
#

Timings has nothing to do with this. Timings is used to debug server performance

#

Going to need some code from the PluginCommand class

#
    at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.handle(CraftScheduler.java:533) ~[folia-1.20.1.jar:git-Folia-"edafbce"]
    at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:257) ~[folia-1.20.1.jar:git-Folia-"edafbce"]
    at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:199) ~[folia-1.20.1.jar:git-Folia-"edafbce"]
    at travis.limified.com.teleportationutils.commands.tpa.onCommand(tpa.java:45) ~[teleportationutils-1.20.1.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
    ... 14 more```
lime rock
#

Sir this is spigot

#

That’s folia, folia makes a ton of changes regarding schedulers

jagged niche
#

oh shit it is xD

#

Yeah uh, run your code using a spigot jar and then get back to us, otherwise you'll have to seek help in the papermc discord I guess

lime rock
#

If you want to use folia you have to use their scheduler system

visual marten
#

Sorry about that