Skip to content

Conversation

@wlritchi
Copy link
Contributor

@wlritchi wlritchi commented Jan 25, 2022

Spigot-family servers put the Nether and End dimensions into separate world directories. Previously, the start-setupWorld script could only accept this layout when passing it to a Spigot-family jar.

This PR adjusts the approach for detecting the Spigot world layout, so that it can be applied when loading any server jar. It also adjusts the logic for world copying so that the extra dimensions will be loaded into the correct place. If the script finds both a Spigot-style and a vanilla-style Nether (or End), the Spigot-style one will take precedence. This matches the default behaviour of Spigot-family jars.

  • Unit tests added
  • Manually tested on real worlds

Fixes #1290

Spigot-family servers put the nether and end dimensions into separate
world directories. Previously, the start-setupWorld script only had
support for this layout when loading a Spigot-family jar. This commit
adjusts the approach for detecting the Spigot layout, so that even when
loading a vanilla jar, the correct world can be identified.

Note that this commit does *not* fix actually loading Spigot nether and
end dimensions on vanilla jars; it merely improves the detection for the
main world directory.
@wlritchi wlritchi changed the title Adjust special case for Spigot world layout Support Spigot-style and vanilla-style world zips, for any server type Jan 31, 2022
@wlritchi wlritchi marked this pull request as ready for review January 31, 2022 01:16
Copy link
Contributor

@shotah shotah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excited to see all the tests! Only real question I have is about the Paper vs Spigot.

EULA: "TRUE"
SETUP_ONLY: "TRUE"
VERSION: ${MINECRAFT_VERSION:-LATEST}
TYPE: "PAPER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed in the folder name you called out spigot, but see you are using Paper. Probably just a typo or me not knowing enough about what is going on. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm mostly protecting against the possibility of a future refactor accidentally making the Spigot logic conditional on TYPE (i.e. apply only to Spigot itself) instead of FAMILY (apply to all Spigot-style jars). It felt like overkill to write a whole separate test for it, but might as well catch it here.

EULA: "TRUE"
SETUP_ONLY: "TRUE"
VERSION: ${MINECRAFT_VERSION:-LATEST}
TYPE: "PAPER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to know more of why we are using paper instead of spigot when that is declared in the folder name.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spigot is effectively a dead release stream; however, it lives on as a "family" designation where Paper is a member of that family.

@@ -0,0 +1,5 @@
mc-image-helper assert fileExists world/level.dat && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excited to see these, will need to go back and add for forge api and vanilla tweaks.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'm so happy to see others already using the new assertions I just added

[ -d "${baseDir}_the_end" ] && rsync --remove-source-files --recursive --delete "${baseDir}_the_end/" "${worldDest}_the_end"
if [ -d "${baseDir}_nether" ]; then
log "Copying Spigot Nether..."
rsync --remove-source-files --recursive --delete "${baseDir}_nether/" "${worldDest}_nether"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, curious if we couldn't make all these rsync's a single method that takes in "${baseDir}_nether" and "${worldDest}_nether". It really may clean up these lines 82 - 107. Either way this is great stuff and it doesn't need to happen, just thought it may make it easier to read and troubleshoot.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an FYI, I am gradually converting rsync usage over to sync subcommand of mc-image-helper, which takes a subset of the arguments here

https://github.com/itzg/mc-image-helper#sync-and-interpolate

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great. I'll wait to merge until I hear back if there's any final tweaks you want to make based on review.

rm -r "$baseDir/DIM-1"
fi
fi
if [ -d "${baseDir}_the_end/DIM1" ]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got love their consistency 😊

@@ -0,0 +1,5 @@
mc-image-helper assert fileExists world/level.dat && \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'm so happy to see others already using the new assertions I just added

mc-image-helper assert fileExists world/level.dat && \
mc-image-helper assert fileExists world_nether/DIM-1/some_spigot_nether_file && \
mc-image-helper assert fileExists world_the_end/DIM1/some_spigot_end_file && \
! mc-image-helper assert fileExists world_nether/DIM-1/some_vanilla_nether_file && \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I don't even need to add the "not" versions of assertions now that I see this technique.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might still be nice to have "not" versions so that the output can be silent when the test passes and explanatory when it fails, like we get for the non-negated case. Not a huge deal though.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point. Assertions are easy to add, so I'll get that queued up.

@@ -0,0 +1,5 @@
mc-image-helper assert fileExists world/level.dat && \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to test the test, but it should be executing these will fail-fast so probably don't even need to chain these together with &&

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not; I tested without && and with some of the asserts negated and it passed, even when it shouldn't have.

We could also add a set -e at the top of each verify script rather than &&-chaining, or we could source the verify scripts from a shell with set -e.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the latter was the case, so I need to look into that.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found and fixed the missing -e

26809ef

EULA: "TRUE"
SETUP_ONLY: "TRUE"
VERSION: ${MINECRAFT_VERSION:-LATEST}
TYPE: "PAPER"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spigot is effectively a dead release stream; however, it lives on as a "family" designation where Paper is a member of that family.

@wlritchi
Copy link
Contributor Author

From my perspective the review suggestions here are all good, but I don't see any of them as blockers to this PR; unless you feel strongly about them I'd be inclined to leave them for a future cleanup. Personally I'd still like to do some real-world testing, but if you think the unit tests are good enough that works for me too.

@itzg
Copy link
Owner

itzg commented Jan 31, 2022

No expectations on my part for any changes that are needed. I'm good with merging at this point or waiting until you have done more real world testing. Just let me know when you're ready.

itzg added a commit that referenced this pull request Feb 1, 2022
@itzg
Copy link
Owner

itzg commented Feb 5, 2022

Hi @wlritchi , just wanted to check in and see how testing was going.

@wlritchi
Copy link
Contributor Author

wlritchi commented Feb 5, 2022

Sorry for the lack of activity with this; I've been on call for my day job over the last week so I haven't had a chance to put much time into side projects. I've got some time today, so I'm planning to do a few tests of this PR on my infra within the next 24 hours; I'll update you with the results. Thanks for checking in!

@itzg
Copy link
Owner

itzg commented Feb 6, 2022

No problem at all. I did my oncall rotation just a couple of weeks ago, so I hear ya.

@wlritchi
Copy link
Contributor Author

wlritchi commented Feb 6, 2022

Manual testing failed; Spigot zips fail to load the overworld correctly (on either server type). I'm still determining what went wrong, but will update with a fix and tests that cover the oversight.

Edit: retracted; I was seeing unexpected behaviour with portals, but the world was in fact loading correctly.

@wlritchi
Copy link
Contributor Author

wlritchi commented Feb 6, 2022

Update to my above comment: for reasons unknown, Spigot zips are failing to retain links from portals in the nether to portals in the overworld, but only on first load. I've seen this same behaviour with the existing implementation, so it's not a regression nor a problem with this PR (still worth opening a ticket to look at though).

Since I had logged out in the nether on my testing worlds, this led me to arrive at a new, unrecognized location when I returned to the overworld on the final servers. I incorrectly believed that the overworld was being regenerated; in fact I was just somewhat far from where I expected to be.

Apologies for the false alarm above, but I wanted to block this PR from being merged while there was any doubt. I now assess that this PR passes manual tests, and can be merged safely.

@itzg
Copy link
Owner

itzg commented Feb 6, 2022

Apologies for the false alarm above, but I wanted to block this PR from being merged while there was any doubt. I now assess that this PR passes manual tests, and can be merged safely.

Thanks for being thorough. Merge is on the way!

@itzg itzg merged commit b7bbe1b into itzg:master Feb 6, 2022
@itzg
Copy link
Owner

itzg commented Feb 6, 2022

@wlritchi wlritchi deleted the fix-spigot-layout-zips branch February 6, 2022 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support loading Spigot-family world zips on non-Spigot servers

3 participants