Player login event

Discussion in 'Spigot Plugin Development' started by ZevoGaems, May 23, 2017.

  1. I am working on my core plugin for my server and I need to make it so when they join it sets them back to gamemode survival. How would I make it so it sets them back to survival. Here is what I have I need the code to put for PlayerLogonEvent but I don't know what it is actually called.

    Code (Text):
        @EventHandler
        public void LogOnGMC(final PlayerJoinEvent) {
           
            }
     
  2. Hey there, Try this, If you want.

    Code (Text):
        @EventHandler
        public void LogOnGMC(PlayerJoinEvent e) {
            Player player = e.getPlayer();
            e.getPlayer().getGameMode();
            player.setGameMode(GameMode.SURVIVAL);

        }
    }
     
    #2 X_M7md_UaE, May 23, 2017
    Last edited: May 23, 2017