/*     */   @EventHandler
/*     */   public void onPlayerQuit(PlayerQuitEvent event)
/*     */   {
/*  61 */     if (Main.getAPI().isSpectating(event.getPlayer()))
/*     */     {
/*  63 */       Main.getAPI().stopSpectating(event.getPlayer(), true);
/*  64 */       return;
/*     */     }
/*  66 */     if (Main.getAPI().isBeingSpectated(event.getPlayer()))
/*     */     {
/*  68 */       for (Player p : Main.getAPI().getSpectators(event.getPlayer()))
/*     */       {
/*  70 */         if ((Main.getAPI().getSpectateMode(p) == SpectateMode.SCROLL) || (Main.getAPI().isScanning(p)))
/*     */         {
/*  72 */           SpectateScrollEvent scrollEvent = new SpectateScrollEvent(p, Main.getAPI().getSpectateablePlayers(), ScrollDirection.RIGHT);
/*  73 */           Bukkit.getServer().getPluginManager().callEvent(scrollEvent);
/*     */ 
/*  75 */           ArrayList<Player> playerList = scrollEvent.getSpectateList();
/*     */ 
/*  77 */           playerList.remove(p);
/*  78 */           playerList.remove(event.getPlayer());
/*     */ 
/*  80 */           p.sendMessage(ChatColor.GRAY + "The person you were previously spectating has disconnected.");
/*     */ 
/*  82 */           if (!Main.getAPI().scrollRight(p, playerList))
/*     */           {
/*  84 */             Main.getAPI().stopSpectating(p, true);
/*  85 */             p.sendMessage(ChatColor.GRAY + "You were forced to stop spectating because there is nobody left to spectate.");
/*     */           }
/*     */ 
/*     */         }
/*     */         else
/*     */         {
/*  91 */           Main.getAPI().stopSpectating(p, true);
/*  92 */           p.sendMessage(ChatColor.GRAY + "You were forced to stop spectating because the person you were spectating disconnected.");
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/*  98 */       return;
/*     */     }
/*     */   }