1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Different gamemodes on different worlds.

Discussion in 'General discussion' started by GeistFan, Aug 14, 2020.

  1. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Hi guys,
    I have the problem that I wanted to make a server on which there is one
    Survival City Build and a Creative City Build
    gives. But I don't want to rent another server.
    Does anyone know a plugin with which you can have different game modes on different worlds?
    best regards
    GeistFan
     
  2. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    sorry, what do you mean?
    you want players just change their gamemode to 1 in world Creative Build?

    there isnt plugin i think, but you can create it your self, there is a function by:
    PlayerGameModeChangeEvent

    you can cancell it on special worlds.
     
  3. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Can you give me a Tutorial for the Event?
    GeistFan!
     
  4. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    sure

    PHP:
    public function onGamemode(PlayerGameModeChangeEvent $event)
    {
    if (
    $event->getPlayer()->getLevel()->getFolderName() === "CITYBUILD") { //set name to your folder name of CotyBuild
          
    $event->setCancelled(true);
          
    $event->getPlayer()->sendMessage("You Can't Change Your Gamemode To Creative mod in CityBuild");
       }
    }
    now when player is in CityBuild World, can change his gamemode, but he can change it in CreativeCityBuild. Helped? drop a like ;)
     
    max1245 likes this.
  5. esh123cookie

    esh123cookie Baby Zombie

    Messages:
    104
    GitHub:
    esh123cookie
    you could also do it on EntityLevelChangeEvent and use setGamemode for the user
     
  6. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    there is'nt diffrence btwn.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.