Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/mv clone command #780

Closed
wants to merge 6 commits into from

Conversation

Projects
None yet
4 participants
@mathphreak
Copy link
Contributor

commented Jul 19, 2012

Adding /mv clone per #779

@mathphreak mathphreak referenced this pull request Jul 19, 2012

Closed

/mv clone command #779

@FernFerret

This comment has been minimized.

Copy link
Member

commented Jul 19, 2012

Brief read is looking good, will test on or before this weekend and pull, thanks!

@mathphreak

This comment has been minimized.

Copy link
Contributor Author

commented Jul 19, 2012

My code doesn't copy over world properties set with /mv modify, and I can't figure out how to copy those in bulk, but it shouldn't be too hard.

@FernFerret

This comment has been minimized.

Copy link
Member

commented Jul 19, 2012

Ideally it would just make an in memory copy of one of the MVWorld objects, then save that object to disk (yaml).

EDIT: In addition to what you're doing with the filesystem.

@dumptruckman

This comment has been minimized.

Copy link
Member

commented Jul 20, 2012

Before we pull this I'd like to see the file copy method moved from Multiverse-Adventure's FileUtil to cores.

@dumptruckman

This comment has been minimized.

Copy link
Member

commented Jul 20, 2012

And here it is: 085c7a1
Please work with the new code base. Make sure to "git pull -r" to replay your commits on top of the new codebase and avoid a nasty merge message.

@dumptruckman

This comment has been minimized.

Copy link
Member

commented Jul 20, 2012

Hmm, and it would appear if you use our method you'll have to delete the uid.dat afterwards. I still think that would be the better course of action.

@FernFerret

This comment has been minimized.

Copy link
Member

commented Jul 20, 2012

Maybe modifying the utils method to allow deletion of the uid as a parameter?

@mathphreak

This comment has been minimized.

Copy link
Contributor Author

commented Jul 21, 2012

Now using FileUtils.copyFolder().

}

private void deleteUID(File worldFolder) throws IOException {
File uidFile = new File(worldFolder, "uid.dat");

This comment has been minimized.

Copy link
@main--

main-- Jul 21, 2012

Member

Wrong indentation


Command.broadcastCommandMessage(sender, String.format("Copying data for world '%s'...", oldWorldName));
try {
FileUtils.copyFolder(oldWorldFile, newWorldFile, Logger.getLogger("Minecraft"));

This comment has been minimized.

Copy link
@main--

main-- Jul 21, 2012

Member

Wrong indentation


// Make sure the new world doesn't exist outside of multiverse.
if (newWorldFile.exists()) {
sender.sendMessage(String.format("Something called '%s' already exists.", newWorldName));

This comment has been minimized.

Copy link
@main--

main-- Jul 21, 2012

Member

Wrong indentation

MVWorld oldWorld = (MVWorld) this.worldManager.getMVWorld(oldWorldName);
newWorld.copyValues(oldWorld);
try {
// don't keep the alias the same -- that would be useless

This comment has been minimized.

Copy link
@main--

main-- Jul 21, 2012

Member

Wrong indentation

// don't keep the alias the same -- that would be useless
newWorld.setPropertyValue("alias", newWorldName);
} catch (PropertyDoesNotExistException e) {
// this should never happen

This comment has been minimized.

Copy link
@main--

main-- Jul 21, 2012

Member

Wrong indentation

@FernFerret

This comment has been minimized.

Copy link
Member

commented Jul 25, 2012

Sorry @mathphreak had a busy weekend (read: slacker playing the Guild Wars 2 beta...) I'll see about looking at it sometime this week, won't be tonight. It looks as if @main-- and @dumptruckman have already given their input, and you've fixed all they've asked.

@dumptruckman

This comment has been minimized.

Copy link
Member

commented Jul 25, 2012

So... After more careful review I've decided that the world copy will have to be asynchronous or else copying a huge world folder will lag out your server. As a side effect of being asynchronous, you would have to kick everyone out of the fromWorld and unload it BEFORE you copy it. Since this is kind of a "what???" procedure, it would probably be best to require and /mvconfirm first that warns them what is going to happen.

@mathphreak

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2012

As a side effect of requiring /mvconfirm, I've had to move the cloning logic from CloneCommand to WorldManager. But that's probably a better place for it anyways.

@FernFerret

This comment has been minimized.

Copy link
Member

commented Jul 27, 2012

Nice move @mathphreak I agree entirely. We try to keep a lot of the logic out of the actual command class as it keeps those cleaner.

I'll look at it tonight or tomorrow; test and pull.

@FernFerret

This comment has been minimized.

Copy link
Member

commented Jul 27, 2012

Also @main-- I appreciate your critique of tabbing, but I'll just have IntelliJ zap all the imported files :P

@FernFerret

This comment has been minimized.

Copy link
Member

commented Aug 4, 2012

What's this @mathphreak? I'm actually looking at this PR now?!?! Blasphemy! Seriously. Sorry for the delay.

  • Slight issue with the clone command help formatting,
  • Added alias /mvcl and /mv cl for the command.

More to come as I continue to test and merge.

@FernFerret

This comment has been minimized.

Copy link
Member

commented Aug 4, 2012

Overall, works great!

@ghost ghost assigned FernFerret Aug 4, 2012

@FernFerret

This comment has been minimized.

Copy link
Member

commented Aug 4, 2012

Merged in f574681. Closes #779. Thanks!

@FernFerret FernFerret closed this Aug 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.