PerWorldInventory
PerWorldInventory copied to clipboard
Saving location of players per world, /mvtp to previous player location
Hi there, I was previously using MV-INV, and there was a way to allow it to save a player's location so you don't always appear at the world spawn location when entering.
ie:
1: I'm playing survival, and want to test something. I warp to the creative world with /mvtp creative 2: I test out my build, and want to resume in survival. I /mvtp survival 3: It spawns me at the survival world's main spawn point, not my previous location.
Is there a way to change this behavior? Are there plans to add the functionality in?
Yeah, this should be pretty simple to add in now.
Has there been any progress on this? I am setting up a new server and really want this feature. I don't want to install MV-INV as it is no longer supported, but having tp default to spawn is a deal breaker for us.
I second @podari, I'd also like this feature. :)
I would like to add my vote for this enhancement as well. That would be very useful!
How prioritized is this? I'd like this for my own server which I'm setting up. If it'll take a long time to get done I may consider forking the project and give it a go myself. But if you're about to start working on it within a few weeks I'll rather wait.
Ugh, why can't the PlayerTeleport event know which world is being teleported to during a world-change?
Anyone else have any brilliant ideas besides inducing a teleport event after world-changed event? Which would, mean it teleports in two steps, and, as a side-effect, trigger a second world-change as I was thinking of adding a setting for enforcing teleport into the same world you were in last when traveling between groups.
If it really is "teleport again on spawning in new world" that is the solution, I'll probably omit the "enforce last world in group"-thing.
EDIT: I'M A MORON! It does work. Nvm, working on it.
@MrOpposite Is there a reason you are not using the MVTeleportEvent? I created my own standalone plugin just to handle this issue and using that event was the easiest way. Took me 1 listener to implement this solution. (But I may have forgotten some edge cases)
@Taronyuu do you mind sharing your plugin?
@Taronyuu I looked into it, and it looks promising. But there's one big flaw in using that:
It will make PWI depend on MultiVerse2. Currently this plugin is completely standalone from any other plugins. Besides Bukkit/Spigot. (Although, it soft-requires a plugin which adds more worlds to the game. But this may be any plugin, not just MV2)
I don't want to be the guy who makes PWI incompatible with anything not MV2. Unless @Gnat008 thinks this is the best thing since sliced bread, I think I'll go with native bukkit events, rather than MV2 specific events.
@MrOpposite Fair enough, I don't know why but I always assumed PWI is already dependent on MultiVerse which is not true. If you are able to use native events that is always better.
@raskulous I'll try to put it up in the Spigot resource section soon, however it isn't quite ready for other servers because there are a few things hardcoded.
Yeah, I'm quite against having to depend on any specific multi world plugin because I want PWI to work with any of them.
Does the TeleportEvent not have a To location? Cuz that would be logical. I'll look it up in a few mins.
The TeleportEvent do have a To location. That's what I'm using in my fork/PR. My PR works, it just needs to be refactored into using the PWIPlayer object, which I'll get going with once I'm done bingewatching a series... Using the MV2 plugin would give us more access to how/when a TP was initiated, and by whom, not just who gets teleported. But since I didn't want to use MV2 specific things if I didn't have to I never looked deeper into it than that. I feel we'd be able to do just fine with bukkits teleportevent.
I suppose if we absolutely need to, we could check if MultiVerse is running on the server when PWI starts (and listen to the plugin enable event, maybe soft-depend MV?), and if it is enable event listeners that are for MV events. Also have to listen to plugin disable events to un-register the listeners in case for some reason it is disabled.
I don't really see why we NEED to, as the from/to location on the teleport-event actually did contain the world. It was just lazy-loaded, and I used the to-string method on the location object during my testing which yielded "World: null". But the getWorld-method returned the correct world and all was dandy!
So the way this is currently implemented is after a world change to a world in a different group, PWI will teleport the player to their last location if their last location in the group was in the same world. So it's less of a last location per world, and more of a last location per group. I'm not sure if this distinction is big enough to warrant the added complexity of doing it more per each world.
@Gnat008 It'd be nice to be able to just have it literally remember where the player was in the last world. For example, I'm in a world called "Survival", and I mvtp to a world called "Creative". When I am in my house in Survival and I mvtp back to Creative, I get put at the spawn of the survival world instead of my previous position. Tbh this should just be implemented into Multiverse itself, but sadly it's not, so please, we need this so badly.
PWI will teleport the player to their last location if their last location in the group was in the same world.
Does this currently work in PWI version 1.11.5? I Set up 2 worlds "world" and "world2" and put each of them in their own group. But when I teleport between them I always get teleported to the world spawn location instead of where I left.