Maven repo for SpongeCommon

Hey guys,
today I tried to use the (Dimension Manager).
Problem is, that it seems like the package common is not included, so I can’t use the DimensionManager class.

I added SpongeAPI like this:

            <name>Sponge maven repo</name>

            <!-- Update this with the most recent version -->

How can I add SpongeCommon (maven)?

You are still using Sponge 2.1. You should change for that.

1 Like

What do you need to use DimensionManager for? That’s implementation code that plugins shouldn’t use unless there’s a legitimate use-case.

However, you should not depend on SpongeCommon, instead use SpongeForge or SpongeVanilla if you want to tie your plugin to a specific implementation.

Just curious, why do you suggest depending on a specific implementation rather then supporting both by depending on SpongeCommon? Or is it not possible to support both in this manner?

SpongeCommon is really just a source-set component of both implementations, it’s not a separate dependency and should not be seen as such. If you only use org.spongepowered.common in your usage of SpongeForge/Vanilla then yes it will work on both but again this is all very implementation specific and I don’t recommend using.

I was looking at the code of ProjectWorlds. To register a new (sponge) config (convert bukkit worlds to sponge worlds with /load), i need the dimension manager.
This is the code, where I need to use the manager. (code by @TrenTech - ProjectWorlds)

public void createNewConfig(String dimType) throws IOException{
		int dimId = DimensionManager.getNextFreeDimId();
		DimensionManager.registerDimension(dimId, 0);

		CompoundTag compoundTag = new CompoundTag("SpongeData", null);	
		compoundTag.put(new IntegerTag("dimensionId", dimId));
		compoundTag.put(new LongTag("uuid_least", -6732046318667659594L));
		compoundTag.put(new LongTag("uuid_most", 9143053678590905554L));
		compoundTag.put(new StringTag("dimensionType", dimType));

		CompoundTag compoundPlayerId = new CompoundTag("", null);
		compoundPlayerId.put(new LongTag("uuid_least", -7628444587550319768L));
		compoundPlayerId.put(new LongTag("uuid_most", 4244735002832685980L));

		List<NBTTag> listPlayerId = new ArrayList<>();
		compoundTag.put(new ListTag("PlayerIdTable", listPlayerId));

		CompoundTag compoundRoot = new CompoundTag("", null);


		List<NBTTag> list = new ArrayList<>();

		XNBT.saveTags(list, dataFile);
		this.compoundTag = compoundTag;
		WorldData worldData = new WorldData(worldName);

That code is outdated. You do not need to create data files to import bukkit worlds.

Hmm, strange thing… I cloned your git repo, so do you use this code in your plugin (now) or not? :smiley:

No. That was used as a workaround while some issues were being worked out in Sponge. It’s no longer needed.

1 Like

Sponge has its own worldmigrator now :wink:

I’d still try to depend on SpongeAPI only, not the implementation…

I think all the migrator does is move bukkit worlds to Sponges respected locations unless things have changed since I last looked. WorldProperties still needs to be created.

1 Like