How do you get the plugin object and why?
I don’t know if this is a bug that needs to be reported but I been reading this Provided object is not a plugin instance?. There is a solution to that but it’s only applicable if its in the main class.
I tried:
Sponge.getScheduler().createTaskBuilder()
.execute(() -> player.sendMessage(Text.of("Teleporting...")))
.delay(5, TimeUnit.SECONDS)
.name("Delay Task")
.submit(Sponge.getPluginManager().getPlugin("my.plugin"));
I received the error : Provided object is not a plugin instance
EDIT: Plugin is the reference to the main class.