Java Code Examples for org.bukkit.event.player.PlayerQuitEvent

The following are top voted examples for showing how to use org.bukkit.event.player.PlayerQuitEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Warzone   File: BlitzModule.java   Source Code and License 6 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onQuit(PlayerQuitEvent event) {
    if ((teamManagerModule.getTeam(event.getPlayer()) != null && teamManagerModule.getTeam(event.getPlayer()).isSpectator())) return;
    updateScoreboardTeamLine(teamManagerModule.getTeam(event.getPlayer()), getAlivePlayers(teamManagerModule.getTeam(event.getPlayer())).size() - 1);

    if (!TGM.get().getMatchManager().getMatch().getMatchStatus().equals(MatchStatus.MID)) return;

    if (lastTeamAlive()) {
        MatchTeam winnerTeam = teamManagerModule.getTeams().stream().filter(matchTeam -> !matchTeam.isSpectator()).filter(matchTeam -> getAlivePlayers(matchTeam).size() > 0).findFirst().get();
        if (winnerTeam == null) {
            winnerTeam = teamManagerModule.getTeams().get(1);
        }
        TGM.get().getMatchManager().endMatch(winnerTeam);
        return;
    }
}
 
Example 2
Project: helper   File: Metadata.java   Source Code and License 6 votes vote down vote up
private static void ensureSetup() {
    if (SETUP.get()) {
        return;
    }

    if (!SETUP.getAndSet(true)) {

        // remove player metadata when they leave the server
        Events.subscribe(PlayerQuitEvent.class, EventPriority.MONITOR)
                .handler(e -> StandardMetadataRegistries.PLAYER.remove(e.getPlayer().getUniqueId()));

        // cache housekeeping task
        Scheduler.builder()
                .async()
                .afterAndEvery(1, TimeUnit.MINUTES)
                .run(() -> {
                    for (MetadataRegistry<?> registry : StandardMetadataRegistries.values()) {
                        registry.cleanup();
                    }
                });
    }
}
 
Example 3
Project: helper   File: PacketScoreboard.java   Source Code and License 6 votes vote down vote up
private void handlePlayerQuit(PlayerQuitEvent event) {
    Player player = event.getPlayer();

    teams.values().forEach(t -> {
        t.unsubscribe(player, true);
        t.removePlayer(player);
    });
    objectives.values().forEach(o -> o.unsubscribe(player, true));

    Map<String, PacketScoreboardObjective> playerObjectives = this.playerObjectives.remove(player.getUniqueId());
    if (playerObjectives != null) {
        playerObjectives.values().forEach(o -> o.unsubscribe(player, true));
    }

    Map<String, PacketScoreboardTeam> playerTeams = this.playerTeams.remove(player.getUniqueId());
    if (playerTeams != null) {
        playerTeams.values().forEach(t -> {
            t.unsubscribe(player, true);
            t.removePlayer(player);
        });
    }
}
 
Example 4
Project: VanillaPlus   File: PlayerManager.java   Source Code and License 6 votes vote down vote up
@EventHandler
public void playerLeave(PlayerQuitEvent event){
	event.setQuitMessage("");
	VPPlayer player = getPlayer(event.getPlayer());
	player.setMenu(null);
	VPPLeaveEvent e = new  VPPLeaveEvent(player);
	if(getMsgPerm().has(player))
		e.setMessage(leave);
	e.save(player.save());
	player.setOffline();
	Bukkit.getServer().getPluginManager().callEvent(e);
	//TODO send removed event
	if(e.getMessage() != null)
		e.getMessage().addSReplacement(PlaceH.SENDER.get(), player).send();
	if(e.save())
		save(player, false);
}
 
Example 5
Project: AsgardAscension   File: PlayerListener.java   Source Code and License 6 votes vote down vote up
@EventHandler
public void onQuit(PlayerQuitEvent event) {
	// Removing Speed Miner effect
	if(speedMiner.get(event.getPlayer().getName()) != null) {
		speedMiner.get(event.getPlayer().getName()).removeEnchantment(Enchantment.DIG_SPEED);
		event.getPlayer().removePotionEffect(PotionEffectType.FAST_DIGGING);
		event.getPlayer().removePotionEffect(PotionEffectType.SPEED);
		speedMiner.remove(event.getPlayer().getName());
	}
	// Removing Rainbow Miner effect
	if(rainbowMiner.get(event.getPlayer().getName()) != null) {
		rainbowMiner.get(event.getPlayer().getName()).removeEnchantment(Enchantment.LOOT_BONUS_BLOCKS);
		event.getPlayer().removePotionEffect(PotionEffectType.FAST_DIGGING);
		rainbowMiner.remove(event.getPlayer().getName());
	}
	// Removing Diamond Miner effect
	if(diamondMiner.get(event.getPlayer().getName()) != null) {
		diamondMiner.remove(event.getPlayer().getName());
	}
	// Quiting challenge in case player is doing it
	if(plugin.getChallenges().getChallenge(event.getPlayer()) > 0){
		plugin.getChallenges().quitChallenge(event.getPlayer());
	}
	plugin.getPlayerManager().saveData(event.getPlayer());
}
 
Example 6
Project: AlphaLibary   File: FakeEventListener.java   Source Code and License 6 votes vote down vote up
@EventHandler
public void onQuit(PlayerQuitEvent e) {
    Player p = e.getPlayer();
    if (FakeAPI.getFakeEntities().containsKey(p.getName())) {
        PlayerFakeUtil.unFollowPlayer(p);
        PlayerFakeUtil.normalizeLook(p);
        PlayerFakeUtil.cancelAllSplittedTasks(p);

        ArmorstandFakeUtil.unFollowArmorstand(p);
        ArmorstandFakeUtil.cancelAllSplittedTasks(p);

        EndercrystalFakeUtil.cancelAllSplittedTasks(p);

        MobFakeUtil.unFollowPlayer(p);
        MobFakeUtil.normalizeLook(p);
        MobFakeUtil.cancelAllSplittedTasks(p);

        BigItemFakeUtil.cancelAllSplittedTasks(p);

        FakeAPI.getFakeEntities().remove(p.getName());
    }
}
 
Example 7
Project: mczone   File: GameEvents.java   Source Code and License 6 votes vote down vote up
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
	event.setQuitMessage(null);
	if (SurvivalGames.getWinner() != null)
		return;
	
	Player p = event.getPlayer();
	Gamer t = Gamer.get(event.getPlayer());
	
	if (!Game.getTributes().contains(t))
		return;

	Hive.getInstance().kill(p, "quit", SurvivalGames.getGame().getGameID());
	t.setVariable("death-location", event.getPlayer().getLocation());
	Chat.server("&4[SG &6" + Gamer.get(p).getPrefix()  + t.getName() + " &6has quit the game!");
	Chat.server("&4[SG] &6There are " + (Game.getTributes().size() - 1) + " tributes remaining");
}
 
Example 8
Project: CraftyProfessions   File: CoreListener.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onPlayerLogout (PlayerQuitEvent event)
{
    Player eventPlayer = event.getPlayer ();

    PlayerManager.Instance ().removePlayer (eventPlayer.getUniqueId ());
}
 
Example 9
Project: HCFCore   File: FactionListener.java   Source Code and License 5 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
    Player player = event.getPlayer();
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
    if (playerFaction != null) {
        playerFaction.broadcast(prefix + ChatColor.GRAY + "Your faction member " + ChatColor.GOLD  + playerFaction.getMember(player).getRole().getAstrix() + player.getName() + ChatColor.GRAY + " has " + ChatColor.RED + "disconnected.");
    }
}
 
Example 10
Project: UltimateTs   File: TypeYesOrNo.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onQuit(PlayerQuitEvent e){
	Player p = e.getPlayer();
	if(PlayerManager.confirmationReady.contains(p)){
		PlayerManager.confirmationReady.remove(p); 
	}
}
 
Example 11
Project: Warzone   File: InfectionModule.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onPlayerLeave(PlayerQuitEvent event) {
    if (teamManager.getTeamById("infected").getMembers().size() == 0 && match.getMatchStatus().equals(MatchStatus.MID)) {
        PlayerContext player = teamManager.getTeamById("humans").getMembers().get(teamManager.getTeamById("humans").getMembers().size() - 1);
        broadcastMessage(String.format("&2&l%s &7has been infected!", player.getPlayer().getName()));

        infect(player.getPlayer());
    }
}
 
Example 12
Project: HCFCore   File: WallBorderListener.java   Source Code and License 5 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
    if (!this.useTaskInstead)
        return;
    BukkitTask task = wallBorderTask.remove(event.getPlayer().getUniqueId());
    if (task != null) {
        task.cancel();
    }
}
 
Example 13
Project: NetworkAnalytics   File: AnalyticsListener.java   Source Code and License 5 votes vote down vote up
@Override
public void setup(@Nonnull TerminableConsumer consumer) {
    Events.subscribe(PlayerLoginEvent.class, EventPriority.MONITOR)
            .filter(e -> e.getResult() == PlayerLoginEvent.Result.ALLOWED)
            .handler(e -> {
                plugin.getDataManager().logPlayer(e.getPlayer().getUniqueId(), e.getPlayer().getName());
                Metadata.provideForPlayer(e.getPlayer()).put(NetworkAnalytics.CONNECTION_TIME_SECONDS, (System.currentTimeMillis() / 1000L));
            })
            .bindWith(consumer);

    Events.subscribe(PlayerJoinEvent.class, EventPriority.MONITOR)
            .handler(e -> {
                ProtocolVersion protocolVersion = ProtocolSupportAPI.getProtocolVersion(e.getPlayer());
                if (protocolVersion != null) {
                    Metadata.provideForPlayer(e.getPlayer()).put(NetworkAnalytics.PROTOCOL_VERSION, protocolVersion);
                }
            })
            .bindWith(consumer);

    Events.subscribe(PlayerQuitEvent.class)
            .handler(e -> {
                Long loginTime = Metadata.provideForPlayer(e.getPlayer()).getOrNull(NetworkAnalytics.CONNECTION_TIME_SECONDS);
                long now = System.currentTimeMillis() / 1000L;
                if (loginTime != null) {
                    long diff = now - loginTime;
                    int mins = (int) TimeUnit.SECONDS.toMinutes(diff);
                    if (mins > 0) {
                        plugin.getDataManager().incrementPlayerMinutesPlayed(e.getPlayer().getUniqueId(), mins);
                    }
                }
            })
            .bindWith(consumer);
}
 
Example 14
Project: SkipNight   File: Vote.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onLogoff(PlayerQuitEvent event) {
    Player player = event.getPlayer();

    if (timer != Timer.COMPLETE) // vote is running
        if (player.hasPermission("skipnight.vote")) { // player has permission
            Voter voter = new Voter(player.getUniqueId());
            if (voters.contains(voter)) { // player is in voter list
                voter = (Voter) voters.get(voters.lastIndexOf(voter));
                if (voter.getVote() == 1) yes--;
                if (voter.getVote() == -1) no--;
                voters.remove(voter);
            }
        }
}
 
Example 15
Project: AntiCheat   File: OrebfuscatorPlayerListener.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerQuit(PlayerQuitEvent event) {
    BlockHitManager.clearHistory(event.getPlayer());
    if (OrebfuscatorConfig.UseProximityHider) {
        ProximityHider.clearPlayer(event.getPlayer());
    }
}
 
Example 16
Project: SignEdit   File: Interact.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onDisconnect(PlayerQuitEvent event) {
    Player player = event.getPlayer();
    if (isInProgress(player)) {
        popInProgressCommit(player).cleanup();
    }
    popSignEditCommit(player);
}
 
Example 17
Project: EscapeLag   File: AutoSave.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void QuitCancelled(PlayerQuitEvent e) {
    if (ConfigOptimize.AutoSaveenable == false) {
        return;
    }
    Player p = e.getPlayer();
    if (TaskId.get(p) != null) {
        Bukkit.getScheduler().cancelTask(TaskId.get(p));
        TaskId.remove(p);
    }
}
 
Example 18
Project: EscapeLag   File: AzurePlayerList.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void dec(PlayerQuitEvent evt){
    Player player = evt.getPlayer();
    names.remove(player.getName());
    players.remove(player);
    
    if (!quit.isEmpty()) {
        for (QuitReactor re : quit) re.react(evt);
    }
}
 
Example 19
Project: Arcadia-Spigot   File: ConnectionListener.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
    ArcadiaAPI api = Arcadia.getPlugin(Arcadia.class).getAPI();
    Translation translation = api.getTranslationManager().fetchTranslation("common.leave-message", event.getPlayer());
    if(translation != null) {
        final String message = translation.build(event.getPlayer().getName());
        if(!message.isEmpty()) {
            event.setQuitMessage(message);
        } else {
            event.setQuitMessage(null);
        }
    }
    if(api.getGameManager().isAlive(event.getPlayer())) api.getGameManager().setAlive(event.getPlayer(), false);
    if(api.getGameManager().isSpectating(event.getPlayer())) api.getGameManager().setSpectating(event.getPlayer(), false);
}
 
Example 20
Project: VoxelGamesLibv2   File: UserListener.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onLeave(@Nonnull PlayerQuitEvent event) {
    Optional<User> user = handler.getUser(event.getPlayer().getUniqueId());
    user.ifPresent(u -> gameHandler.getGames(u.getUuid(), true).forEach(game -> game.leave(u)));

    handler.logout(event.getPlayer().getUniqueId());
}
 
Example 21
Project: HCFCore   File: FactionListener.java   Source Code and License 5 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
    Player player = event.getPlayer();
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
    if (playerFaction != null) {
        playerFaction.broadcast(prefix + ChatColor.GRAY + "Your faction member " + ChatColor.GOLD  + playerFaction.getMember(player).getRole().getAstrix() + player.getName() + ChatColor.GRAY + " has " + ChatColor.RED + "disconnected.");
    }
}
 
Example 22
Project: UltimateTs   File: TypeYesOrNo.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onQuit(PlayerQuitEvent e){
	Player p = e.getPlayer();
	if(PlayerManager.confirmationReady.contains(p)){
		PlayerManager.confirmationReady.remove(p); 
	}
}
 
Example 23
Project: VoxelGamesLibv2   File: GameListener.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onLeave(@Nonnull PlayerQuitEvent event) {
    User user = userHandler.getUser(event.getPlayer().getUniqueId())
            .orElseThrow(() -> new UserException(
                    "Unknown user " + event.getPlayer().getDisplayName() + "(" + event.getPlayer()
                            .getUniqueId() + ")"));
    gameHandler.getGames(event.getPlayer().getUniqueId(), true)
            .forEach((game -> game.leave(user)));
}
 
Example 24
Project: ProjectAres   File: TabManager.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onQuit(PlayerQuitEvent event) {
    TabView view = this.getViewOrNull(event.getPlayer());
    if(view != null) {
        view.disable();
        this.removeView(view);
    }
    this.removePlayerEntry(event.getPlayer());
}
 
Example 25
Project: ProjectAres   File: PlayerServerChanger.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onQuit(PlayerQuitEvent event) {
    final MetadataValue future = event.getPlayer().getMetadata(METADATA_KEY, plugin);
    if(future != null) {
        ((SettableFuture) future.value()).set(null);
    }
}
 
Example 26
Project: ProjectAres   File: IdentityProviderImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Clean up after quitting players
 */
@EventHandler(priority = EventPriority.MONITOR)
public void deactivateNickOnQuit(PlayerQuitEvent event) {
    final Identity identity = identities.remove(event.getPlayer());
    if(identity != null && identity.getNickname() != null) {
        nicknames.remove(identity.getNickname());
    }
}
 
Example 27
Project: ProjectAres   File: JoinMessageAnnouncer.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void onQuit(PlayerQuitEvent event) throws EventException {
    event.setQuitMessage(null);
    final User user = userStore.getUser(event.getPlayer());
    final SessionChange change = pendingQuits.getIfPresent(user);

    event.yield();

    if(change != null) {
        pendingQuits.invalidate(user);
        announce(change);
    }
}
 
Example 28
Project: SmartInvs   File: InventoryManager.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void onPlayerQuit(PlayerQuitEvent e) {
    Player p = e.getPlayer();

    if(!inventories.containsKey(p))
        return;

    SmartInventory inv = inventories.get(p);

    inv.getListeners().stream()
            .filter(listener -> listener.getType() == PlayerQuitEvent.class)
            .forEach(listener -> ((InventoryListener<PlayerQuitEvent>) listener).accept(e));

    inventories.remove(p);
}
 
Example 29
Project: HCFCore   File: LogoutTimer.java   Source Code and License 5 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
    UUID uuid = event.getPlayer().getUniqueId();
    if (getRemaining(event.getPlayer().getUniqueId()) > 0L) {
        clearCooldown(uuid);
    }
}
 
Example 30
Project: NavyCraft2-Lite   File: MoveCraft_PlayerListener.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerQuit(PlayerQuitEvent event) {
	Player player = event.getPlayer();

	Craft craft = Craft.getPlayerCraft(player);

	if (craft != null) {
		if (craft.isNameOnBoard.get(player.getName())) {
			Craft.reboardNames.put(player.getName(), craft);

			craft.isNameOnBoard.put(player.getName(), false);
			if (craft.driverName == player.getName()) {
				craft.haveControl = false;
				craft.releaseHelm();
			}

			boolean abandonCheck = true;
			for (String s : craft.isNameOnBoard.keySet()) {
				if (craft.isNameOnBoard.get(s)) {
					abandonCheck = false;
				}
			}

			if (abandonCheck) {
				craft.abandoned = true;
				craft.captainAbandoned = true;
			} else if (player.getName() == craft.captainName) {
				craft.captainAbandoned = true;
			}
		}

		for (Periscope p : craft.periscopes) {
			if (p.user == player) {
				p.user = null;
				break;
			}
		}
	}

}
 
Example 31
Project: Arc-v2   File: PlayerListener.java   Source Code and License 5 votes vote down vote up
/**
 * Remove the player from all maps and lists.
 *
 * @param event the event.
 */
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
    Player player = event.getPlayer();
    Arc.getExemptionManager().clearData(player);
    Arc.getViolationHandler().removeViolationData(player);

    // clear check data.
    MovingData.removeData(player);
    FightData.removeData(player);
    InventoryData.removeData(player);

    Arc.getViolationHandler().clearPlayerData(player);

}
 
Example 32
Project: kaosEssentials   File: Core.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onQuit(PlayerQuitEvent e){
	if( pwm.contains(e.getPlayer().getName()) ){
		pwm.remove(e.getPlayer().getName());
	}
	if( pwli.contains(e.getPlayer().getName())){
		pwli.remove(e.getPlayer().getName());
	}
}
 
Example 33
Project: Minecordbot   File: UserQuitJoinListener.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerQuit(PlayerQuitEvent e) {
    if (safeToProceed(e)) {
        mcb.getBot().getUpdatableMap().get("list").update();
        SuperVanishHook svHook = HookContainer.getSuperVanishHook();
        String msg = ChatColor.stripColor(e.getQuitMessage());
        boolean isLeaveBroadcast = configsManager.getBroadcastConfig().getBoolean("See_Player_Quit");
        boolean seeQuit = configsManager.getModChannelConfig().getBoolean("See_Player_Quit");
        if (seeQuit) {
            String m = msg;
            if (svHook != null) {
                boolean seeSV = configsManager.getModChannelConfig().getBoolean("See_SV");
                if (VanishAPI.isInvisible(e.getPlayer()) || e.getQuitMessage().equals("Fake") && seeSV)
                    m = "(Vanish) " + m;
            }
            messenger.sendMessageEmbedToAllModChannel(new EmbedBuilder().setColor(LEAVE_COLOR)
                    .setTitle(m, null).build());
        }
        if (isLeaveBroadcast) {
            if (e.getQuitMessage().equals("Fake")) {
                messenger.sendMessageEmbedToAllBoundChannel(new EmbedBuilder().setColor(LEAVE_COLOR)
                        .setTitle(msg, null).build());
                e.setQuitMessage("");
            } else if (check(e)) {
                messenger.sendMessageEmbedToAllBoundChannel(new EmbedBuilder().setColor(LEAVE_COLOR)
                        .setTitle(msg, null).build());
            }
        }
    }
}
 
Example 34
Project: OnlineChecker-Spigot-SQL-Support   File: SQLJoinLeave.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onsqlQuit(PlayerQuitEvent e){
	if (Core.getInstance().isSqlEnabled()) {
		SQLUtil sql = new SQLUtil();
		if (StoreMaps.getInstance().totalTime.get(e.getPlayer().getUniqueId())!=null||StoreMaps.getInstance().totalTime.get(e.getPlayer().getUniqueId())!=0)
			sql.setTotalTime(e.getPlayer().getUniqueId(), StoreMaps.getInstance().totalTime.get(e.getPlayer().getUniqueId()));
	}else{
		Core.getInstance().data.get().set("cache."+e.getPlayer().getUniqueId()+".totalTime", StoreMaps.getInstance().totalTime.get(e.getPlayer().getUniqueId()));
		Core.getInstance().data.save();
	}
	StoreMaps.getInstance().onlineSince.remove(e.getPlayer().getUniqueId());
}
 
Example 35
Project: RealSurvival   File: BasicEvent.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void quit(PlayerQuitEvent e){
	if(e.getPlayer().hasMetadata("NPC"))return;
	if(rs.getPlayerData(e.getPlayer())==null)return;
	rs.deletePlayer(e.getPlayer());
	return;
}
 
Example 36
Project: ArchersBattle   File: PlayerListener.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onQuit(PlayerQuitEvent e) {
    Player p = e.getPlayer();
    if (Utils.isInArena(p)) {
        Arena a = Utils.getAreana(p);
        a.removePlayer(p);
    }
}
 
Example 37
Project: mczone   File: ConnectEvents.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onPlayerLeave(PlayerQuitEvent event) {
	event.setQuitMessage(null);
	
	Gamer g = Gamer.get(event.getPlayer());
	Team team = Nexus.getRotary().getCurrentMap().getTeam(g);
	
	if (team != null)
		team.remove(g);
	
}
 
Example 38
Project: mczone   File: PlayerEvents.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
	for (PetInstance p : PetInstance.getList()) {
		if (p.getOwner().equalsIgnoreCase(event.getPlayer().getName())) {
			p.despawn();
		}
	}
}
 
Example 39
Project: VoxelGamesLibv2   File: UserListener.java   Source Code and License 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void suppressQuitMessages(@Nonnull PlayerQuitEvent event) {
    event.setQuitMessage(null);
}
 
Example 40
Project: CloudNet   File: BukkitListener.java   Source Code and License 4 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void handle(PlayerQuitEvent e)
{
    CloudServer.getInstance().getCloudPlayers().remove(e.getPlayer().getUniqueId());
    CloudServer.getInstance().updateAsync();
}