Multiverse teleport restrictions

Discussion in 'Spigot Plugin Help' started by Mint35, May 17, 2020.

  1. Hi all,

    I just started using multiverse to add creative mode worlds (an Overworld, Nether, and End) to my primarily survival server. Since I want the survival and creative sides of the server to be separate, is there a way to prevent mvtp commands being used to travel between survival worlds and force players to use the vanilla portals for that purpose?

    For example, if a player is in any of the survival worlds (overworld/nether/end), I want them to be able to teleport to any of the creative worlds, but for them to return to the survival side I want them to only be able to return to the exact world and location they were last in on the survival side, rather than using mvtp to teleport to a different survival world. So if someone is in the survival nether and mvtps to a creative world, the only way they should be able to return to the survival worlds is through where they left off in the survival nether.

    Is there a way for multiverse to remember which world of a "group" of worlds the player was last in?

    tl;dr I want my players to be able to use multiverse teleport commands to get from a survival world to creative worlds and back but never to move between different survival worlds. How?

    Thanks in advance,

    Mint
     
  2. I was trying to do the exact same thing for my survival/creative server. It used to be possible with the Multiverse-TeleportFilter plugin. But since that one is outdated i don't think it's possible anymore so i created a workaround for my server.

    Worldnames are Survival, Survival_nether, Survival_the_end, Creative, Creative_nether and Creative_the_end.
    To take away the option for players to teleport to the nether/end dimensions i changed the spawnpoint of all '..._nether' or '..._the_end' worlds to 0, -100, 0 so they instantly die when teleporting. By doing this the only way for them to go to the dimension is through the normal portals. I of course also warned my players of it so they don't lose their items on accident. Then to prevent players from teleporting to the overworld from the nether or end i have only given them the permission to use /mvtp in the worlds 'Survival' and 'Creative' wich are the overworlds. This works but is annoying if you want to quickly swap over to the creative world or back but first need to go to the overworld. But at least it works.

    I know the thread is old and this response will very likely not be used by Mint35 but it could still help someone else with the same problem who accidentaly stumbles upon this thread.

    good luck,
    dodosoldier
     
  3. Howdy everyone. It's been most of a year but I've finally found a solution that satisfies all my preferences using the ConditionalEvents plugin https://www.spigotmc.org/resources/...om-actions-for-certain-events-1-8-1-16.82271/

    My worlds are as follows: worldname - alias_name

    world - survival_overworld
    world_nether - survival_nether
    world_the_end - survival_end
    creative - creative_overworld
    creative_nether
    creative_end
    creative_superflat

    In LuckPerms my default group has multiverse.access.world, multiverse.access.world_nether, and multiverse.access.world_the_end set to false and all the creative worlds set to true. The admin group has multiverse.access.* and multiverse.restrictionexempt set to true

    My config.yml for ConditionalEvents is as follows:

    Code (YAML):

    Messages
    :
      prefix
    : '&4[&bConditionalEvents&4] '
      commandReload
    : '&aConfig Reloaded.'
      commandNoPermissions
    : '&cYou don''t have permissions to use this command.'
      commandResetError
    : '&cUse &7/ce reset <player> <event>'
      eventDoesNotExists
    : '&cThat event doesn''t exists on the config.'
      cooldownReset
    : '&aCooldown was reset for player &e%player% &aon event &e%event%&a!'
      seconds
    : s
      minutes
    : m
      hours
    : h
      days
    : d
    Events
    :
      mvtp_survival_to_creative
    :
        type
    : player_command
        conditions
    :
       - '%command% startsWith /mv'
        - '%arg_1% equals tp'
        - '%arg_2% equals creative or %arg_2% equals creative_overworld or %arg_2% equals creative_nether or %arg_2% equals creative_end or %arg_2% equals creative_superflat'
        - '%player_world% equals world execute overworld'
        - '%player_world% equals world_nether execute nether'
        - '%player_world% equals world_the_end execute end'
        actions
    :
          overworld
    :
          - 'console_command
    : lp user %player% permission set multiverse.access.world true'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_nether false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_the_end false'
          - 'message
    : When done with creative, you must return to the survival overworld. (/mv tp survival_overworld)'
          nether
    :
          - 'console_command
    : lp user %player% permission set multiverse.access.world false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_nether true'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_the_end false'
          - 'message
    : When done with creative, you must return to the survival nether. (/mv tp survival_nether)'
          end
    :
          - 'console_command
    : lp user %player% permission set multiverse.access.world false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_nether false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_the_end true'
          - 'message
    : When done with creative, you must return to the survival end. (/mv tp survival_end)'
        ignore_with_permission
    : multiverse.restrictionexempt
      mvtp_creative_to_survival_overworld
    :
        type
    : player_command
        conditions
    :
       - '%command% startsWith /mv'
        - '%arg_1% equals tp'
        - '%arg_2% equals world or %arg_2% equals survival_overworld'
        - '%player_world% equals creative or %player_world% equals creative_nether or %player_world% equals creative_end or %player_world% equals creative_superflat'
        actions
    :
          default
    :
          - 'cancel_event
    : true'
          - 'console_command
    : mv tp %player% world'
          - 'console_command
    : lp user %player% permission set multiverse.access.world false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_nether false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_the_end false'
        permission
    : multiverse.access.world
        ignore_with_permission
    : multiverse.restrictionexempt
      mvtp_creative_to_survival_nether
    :
        type
    : player_command
        conditions
    :
       - '%command% startsWith /mv'
        - '%arg_1% equals tp'
        - '%arg_2% equals world_nether or %arg_2% equals survival_nether'
        - '%player_world% equals creative or %player_world% equals creative_nether or %player_world% equals creative_end or %player_world% equals creative_superflat'
        actions
    :
          default
    :
          - 'cancel_event
    : true'
          - 'console_command
    : mv tp %player% world_nether'
          - 'console_command
    : lp user %player% permission set multiverse.access.world false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_nether false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_the_end false'
        permission
    : multiverse.access.world_nether
        ignore_with_permission
    : multiverse.restrictionexempt
      mvtp_creative_to_survival_end
    :
        type
    : player_command
        conditions
    :
       - '%command% startsWith /mv'
        - '%arg_1% equals tp'
        - '%arg_2% equals world_the_end or %arg_2% equals survival_end'
        - '%player_world% equals creative or %player_world% equals creative_nether or %player_world% equals creative_end or %player_world% equals creative_superflat'
        actions
    :
          default
    :
          - 'cancel_event
    : true'
          - 'console_command
    : mv tp %player% world_the_end'
          - 'console_command
    : lp user %player% permission set multiverse.access.world false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_nether false'
          - 'console_command
    : lp user %player% permission set multiverse.access.world_the_end false'
        permission
    : multiverse.access.world_the_end
        ignore_with_permission
    : multiverse.restrictionexempt

    Voila, player can always teleport to creative worlds but must return to whichever survival world they were most recently in. This is quite clunky due to some limitations of the plugin (no logical 'and' in conditions, the triggering command can only execute after the custom actions, can't check for permissions in the 'conditions' section) but it does the trick. The 3 separate events to return to survival worlds are only necessary because of the individual access permission checks. Note that I disabled the alias /mvtp in commands.yml to avoid having to parse 2 versions of the command.

    Forgive me for reviving a dead thread, I just hoped I might save a future googler some grief. All the best to y'all :)
     
    #3 Mint35, Dec 23, 2020
    Last edited: Dec 23, 2020