Interact with other plugin: WorldEdit

I’d like to know how to interact with other plugins, specifically I would like to have the selection of worldedit.

You can check for another plugin/mod in sponge with Sponge.getPluginManager().getPlugin("modid") - in this case you’d use “worldedit” to get the PluginContainer for WorldEdit.

If the Optional is present then you can go ahead and use the WorldEdit API such as WorldEdit.getInstance().

Note that WorldEdit has an platform-agnostic API, so things like blocks, entities, etc will need to be “converted” if you want to use them in the Sponge API or vice versa.

The other option to using WorldEdit.getInstance() (and one that will work for all plugins) is to cast the result of PluginContainer#getInstance() to that plugin’s main class.

Yes but worldedit is a forge mod not a plugin.

With SpongeForge, mods are treated as plugins, so both have PluginContainers. And from Forge’s point of view, plugins are treated as mods. They’re pretty much one and the same once SpongeForge is installed, except for Sponge’s @Plugin annotation and the tweaks made in SpongeModPluginContainer.

There is a version of WorldEdit for SpongeVanilla, so it isn’t necessarily a Forge mod.

Ah, I understand.
So to me just see if it is present and take the static WorldEdit class.
I’m just wondering how to interface the sponge API with those of worldedit (LocalWorld, Localplayer, ecc).