How to Use Causes D:

Hey there!

Just for testing purposes, I’m trying to get a certain area to turn to redstone blocks. However, whenever I try to do this, I’m given an error that I don’t quite understand how to fix.

Here’s the error:

Here’s the class where that code is called:

And lastly, my main plugin class:

In my mind, it should be working because Avatar.INSTANCE is set before I even call that code.

Thanks for any help! :smiley:

Your code is almost correct. The root cause detection only checks for instances of PluginContainer (a class that wraps your main class).
You can obtain your plugin container from INSTANCE using the plugin manager:

PluginContainer container = Sponge.getPluginManager().fromInstance(Avatar.INSTANCE).get();

Alternatively you can use @Inject PluginContainer container in the main class (the same way you inject the logger) to obtain the container.

1 Like

Perfect. Thank you!