diff --git a/src/de/steamwar/spectatesystem/listener/JoinListener.java b/src/de/steamwar/spectatesystem/listener/JoinListener.java index 5ecef40..64715d6 100644 --- a/src/de/steamwar/spectatesystem/listener/JoinListener.java +++ b/src/de/steamwar/spectatesystem/listener/JoinListener.java @@ -29,23 +29,27 @@ import de.steamwar.sql.SteamwarUser; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; public class JoinListener extends BasicListener { @EventHandler - public void onJoin(PlayerJoinEvent e){ - e.setJoinMessage(null); + public void onLogin(PlayerLoginEvent e){ Player player = e.getPlayer(); if(InspectCommand.inspecting){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); if(!SpectateSystem.allowedGroups.contains(user.getUserGroup())){ - player.sendMessage("§eSteam§8War» §cDerzeit ist das Zuschauen nicht gestattet."); - player.kickPlayer(null); - return; + e.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "§eSteam§8War» §cDerzeit ist das Zuschauen nicht gestattet."); } } + } + + @EventHandler + public void onJoin(PlayerJoinEvent e){ + e.setJoinMessage(null); + Player player = e.getPlayer(); player.teleport(Config.SpecSpawn); REntity.playerJoins(player);