Multiverse-Core

Multiverse-Core

6M Downloads

Multiverse Gamemode Enforcement - Bypass only in certain cases (When other Plugins handle Gamemode switch)

Waterman1001 opened this issue ยท 16 comments

commented

Feature request

Often what happens currently with some plugins I am using is that if a player joins a certain world by using a certain plugin which teleports it to that world and changes the players gamemode... Multiverse directly changes the players gamemode as well and this causes problems.

I am aware of the fact that it is possible to add bypass permissions for having multiverse not changing gamemode, but I would like to still be able to use this.

Let me give a better description of what is happening now for example on my server:
I have a world in which I put some Minigames.

  • The player is in world A and clicks a Hungergames Sign to join the game.
  • This game is located in world B.
  • The player is teleported to world B and the Hungergames plugin sets the gamemode of the player to Adventure mode.
  • The default mode of world B is SURVIVAL, so Multiverse changes after the teleportations directly the gamemode of the player to Survival.
  • Now the Hungergames plugin assumes the player is in adventure and cannot break any blocks for example, but multiverse changed it afterwards to survival.
  • If the player is going to join a different Minigame in world B or simply gets teleported there, I still would want the player to be enforced in Survival gamemode, so adding a bypass permission is no option.

Hopefully this scenario is clear, haha.

What would be really usefull for me, would be some kind of way in which I could still enforce a certain gamemode to a player that joins a world, but only if the teleportation cause is for example a normal TP. (Or one of essentials or something.)
And that, if a different plugin, like for example the HungerGames plugin from my example, teleports a player.
Then the enforcegamemode should not be active.
Maybe this could work with some permission node like mv.bypass.gamemode.otherplugins

I really hope what I am saying is clear, because it might be a bit vague, while I do struggle with it sometimes.
Since I really would like to keep the enforcement of the Survival gamemode, but just not in certain cases.
(Cases where other plugins set your gamemode like... a few ticks before multiverse does so. (Maybe you could check for the time since the last gamemode change? Or look at teleportation cause.)

(Hungergames was just 1 example, but other Minigames sometimes also struggle with it using e.g. Creative Gamemode)

Thank you so much already for your understanding.
This would really help me very much if something like this would be possible.
Keep up the good work with Multiverse, since it is an epic plugin which I am using already for over 8 years now.
Good job!

[13:40:03] [Server thread/INFO]: [HungerGames-Test] Player should now be in Adventure Mode.
[13:40:03] [Server thread/INFO]: [Multiverse-Core-Debug] Got teleport event for player 'waterman1001' with cause 'PLUGIN'
[13:40:03] [Server thread/INFO]: [Multiverse-Core-Debug] Inferred sender 'null' from name 'null', fetched from name 'waterman1001'
[13:40:03] [Server thread/INFO]: [Multiverse-Core-Debug] Player 'waterman1001' is teleporting to the same world.
[13:40:03] [Server thread/INFO]: [Multiverse-Core-Debug] MV-Core is allowing Player 'waterman1001' to go to 'Minigames'.
[13:40:04] [Server thread/INFO]: [Multiverse-Core-Debug] Handling gamemode for player: waterman1001, Changing to SURVIVAL

Here you see how I got changed my gamemode twice in about 1 second.

commented

So from what I read, different minigames require players to be in different gamemodes?

commented

Btw, there is no feasible way in bukkit api for mv just know "oh its xxx plugin using xxx command that did the teleport", so I don't see a clear implementation for your suggestion.

What is possible is allow customisable event priority for PlayerWorldChangedEvent and idk why we have a 1 tick delay after world change then gamemode is applied, maybe can remove that.

commented

Aah, I see.
Thanks for your explanation and fast replies.
Really, that's amazing.

I am curious whether that would help. It might, actually.
It does sound interesting :)

commented

Sometimes yes.
Hunger games puts players into Adventure mode before the game starts. Because then they are not able to destroy anything. However, once the starting counter is finished and the game starts, they will be put in survival mode.

For BuildBattle, players are put into Creative mode for example. To be able to build.

commented

Then shouldn't that be controlled by your minigame plugin?

commented

Yes. They do. But then after they handle it, multiverse just comes into play and enforces the survival gamemode after these minigames have done their thing

commented

It's only a problem on world switch though.
So say the join sign is in world A
The arena is in world B
Player TP's to arena from A to B
Minigame plugin changes gamemode
Multiverse changes gamemode again

commented

Minigame plugins are only one example.
Any plugin that changes a players gamemode would have a problem because of this.

commented

So.... I'm not seeing why just setting mv to bypass game mode enforcement is not an option, since what you describe shows your Minigame plugin fully handling game mode changes.

commented

Yes true, but then if players get to the world without doing a minigame. Like for example a Parkour map which is in the world, they should be forced into Survival mode by Multiverse

commented

Then id assume that "Parkour map" or something else is a different world right? So the permission node mv.bypass.gamemode.WORLDNAME, as such you just bypass for that minigame world while that "Parkour map" world is still game mode enforced.

commented

There are also some lobbies with warps in the world.
So say player is in creative world in creative mode
Player warps to lobby warp inside Minigame world
Player should be enforced to survival by Multiverse

commented

Then id assume that "Parkour map" or something else is a different world right? So the permission node mv.bypass.gamemode.WORLDNAME, as such you just bypass for that minigame world while that "Parkour map" world is still game mode enforced.

So that's the problem. I'd have to make a separate world for everything and also lobbies should be in different worlds.
Some minigames don't have plugins in my server. They rely on multiverse enforcement
So that's why my suggestion would be to be more in control of the enforcement

commented

I'm sorry for my vagueness though.
I can try to modify every plugin to add a delayed task timer of 2 ticks which sets gamemode. Such that the change comes after multiverse handling
But it would require to decompile every plugin

commented

After all, this is just a suggestion. Since it would add more controlling over the game mode enforcement of multiverse.
It would make my life as server owner a bit more easy. However after all you are the developer of course. So it is up to you to decide ;)
I just thought and hoped it would be a very nice and welcome adjustment and nice addition to this amazing project.

commented

so basically if mv has an option for when to enforce gamemode in ms there will be no more problem right?