當前位置: 首頁>>代碼示例>>Java>>正文


Java PlayerQuitEvent.setQuitMessage方法代碼示例

本文整理匯總了Java中org.bukkit.event.player.PlayerQuitEvent.setQuitMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerQuitEvent.setQuitMessage方法的具體用法?Java PlayerQuitEvent.setQuitMessage怎麽用?Java PlayerQuitEvent.setQuitMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.player.PlayerQuitEvent的用法示例。


在下文中一共展示了PlayerQuitEvent.setQuitMessage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onLeave

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onLeave(PlayerQuitEvent event) {
    if(!Moo.getInstance().isConnected()) return;
    Player player = event.getPlayer();

    PlayerData data = new PlayerData();
    data.setUuid(player.getUniqueId());
    data.setLastName(player.getName());
    data.setLastIp(player.getAddress().getHostString());

    // UPDATE SERVER INFO
    Lightning.getInstance().updateServerInfo();

    // SET QUIT MESSAGE
    String playerName = MooQueries.getInstance().getGroup(player.getUniqueId()).getColor() + player.getName();
    event.setQuitMessage(LanguageManager.get("quit-message-pattern", playerName));
}
 
開發者ID:Superioz,項目名稱:MooProject,代碼行數:18,代碼來源:ServerListener.java

示例2: onQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void onQuit(PlayerQuitEvent e) {
	e.setQuitMessage(null);
	
	KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
	if(p.getCombatTracker().isInCombat()) {
   p.getCombatTracker().handleDisconnect();
	Bukkit.getScheduler().runTaskLater(KingdomFactionsPlugin.getInstance(), new Runnable() {
		
		@Override
		public void run() {
			ChatModule.getInstance().getChannels().forEach(channel -> channel.leave(p, false));
		    p.saveLogOut();
		}
	}, 20*2L);
	} else {
	ChatModule.getInstance().getChannels().forEach(channel -> channel.leave(p, false));
	
    p.saveLogOut();
	}
	
}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:23,代碼來源:PlayerQuitEventListener.java

示例3: onPlayerQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
    event.setQuitMessage(null);
    
    if (Team.getTeam(event.getPlayer()) == null)
    	return;
    
    if (!event.getPlayer().isDead() && !Walls.winners.contains(event.getPlayer()))
    	Team.getTeam(event.getPlayer()).leave(event.getPlayer());
    
    if (State.PRE)
        return;

    for (ItemStack i : event.getPlayer().getInventory().getContents())
    	if (i != null && i.getType() != Material.AIR)
    		Config.getWorld().dropItemNaturally(event.getPlayer().getLocation(), i);
    
    if (event.getPlayer().isDead() || Walls.winners.contains(event.getPlayer()))
        return;
		

    Hive.getInstance().getDatabase().update(String.format("INSERT INTO kills (server,game_id,player,target) VALUES ('%s',%d,'%s','%s')","walls",Walls.ID,"left",event.getPlayer().getName()));
    Chat.server(event.getPlayer().getDisplayName() + "&c has left the game! What a coward!");
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:25,代碼來源:GameEvents.java

示例4: onPlayerQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@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");
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:18,代碼來源:GameEvents.java

示例5: leave

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void leave(final PlayerQuitEvent event) {
    if(GameState.current() != GameState.LOBBY && event.getPlayer().getGameMode() != GameMode.SPECTATOR){
        event.setQuitMessage(colour("&6" + event.getPlayer().getName() + " has quit! " +
                "They have " + UHC.getInstance().getMainConfig().getDisconnectGracePeriodSeconds() + "s to reconnect."));

        bukkitRunnable(() -> disqualified(event.getPlayer().getUniqueId(), event.getPlayer().getName(),
                event.getPlayer().getLocation(), event.getPlayer().getInventory())).runTaskLater(UHC.getInstance(),
                TimeUnit.MILLISECONDS.convert(UHC.getInstance().getMainConfig().getDisconnectGracePeriodSeconds(), TimeUnit.SECONDS));

        //Zombie Spawning
        Zombie zombie = (Zombie) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.ZOMBIE);
        zombie.setCustomName(event.getPlayer().getName());
        zombie.setCustomNameVisible(true);
        //TODO Make no AI and invulnerable cough cough Proxi cough cough
        deadRepresentatives.put(event.getPlayer().getUniqueId(), zombie);
    }
}
 
開發者ID:Project-Coalesce,項目名稱:UHC,代碼行數:19,代碼來源:JoinQuitHandlers.java

示例6: onLeave

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void onLeave(PlayerQuitEvent event) {
    Player player = event.getPlayer();

    event.setQuitMessage(null);

    Game game = Skywars.getInstance().getGame(player);
    if (game != null && game.getGamePlayer(player) != null) {
        GamePlayer gamePlayer = game.getGamePlayer(player);

        if (gamePlayer.isTeamClass()) {
            if (gamePlayer.getTeam().isPlayer(player)) {
                player.damage(player.getMaxHealth()); // Kill player to make game process this as a death
            }
        } else {
            if (gamePlayer.getPlayer() == player) {
                player.damage(player.getMaxHealth()); // Kill player to make game process this as a death
            }
        }
    }
}
 
開發者ID:JordanOsterberg,項目名稱:SkywarsSeries,代碼行數:22,代碼來源:PlayerLeave.java

示例7: playerLeave

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@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);
}
 
開發者ID:dracnis,項目名稱:VanillaPlus,代碼行數:18,代碼來源:PlayerManager.java

示例8: onPlayerQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@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);
}
 
開發者ID:ArcadiaPlugins,項目名稱:Arcadia-Spigot,代碼行數:16,代碼來源:ConnectionListener.java

示例9: onQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:14,代碼來源:JoinMessageAnnouncer.java

示例10: onQuitM

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler(priority=EventPriority.LOWEST)
public void onQuitM(PlayerQuitEvent e){
	if(isSjm(e.getPlayer().getUniqueId().toString())){
		e.setQuitMessage(ChatColor.DARK_GRAY + "[" + ChatColor.RED + "- " + e.getPlayer().getName() + ChatColor.DARK_GRAY + "]");
	}else{
		e.setQuitMessage("");
	}
	for(String name : pwli){
		Bukkit.getPlayer(name).sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GOLD + "@System" + ChatColor.DARK_GRAY + "] " +
				ChatColor.GRAY + e.getPlayer().getName() + " has left");
	}
}
 
開發者ID:OverloadedCore,項目名稱:kaosEssentials,代碼行數:13,代碼來源:Core.java

示例11: onPlayerLeave

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerLeave(PlayerQuitEvent event) {
	event.setQuitMessage(null);
	Arena match = Arena.getArena(event.getPlayer());
	if (match == null)
		return;
	
	match.leave(event.getPlayer());
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:10,代碼來源:ConnectEvents.java

示例12: onQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onQuit(PlayerQuitEvent event) {
    event.setQuitMessage(ChatColor.GRAY + event.getPlayer().getName() + " left.");
    handleQuit(event.getPlayer());
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:6,代碼來源:JoinManager.java

示例13: onPlayerQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
    event.setQuitMessage(null);

    Bukkit.getPluginManager().callEvent(new QuitEvent(PlayerManager.getInstance().deregister(event.getPlayer())));
}
 
開發者ID:Dragovorn,項目名稱:OpenRPG,代碼行數:7,代碼來源:TriggerQuitEvent.java

示例14: onPlayerQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
	event.setQuitMessage(null);
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:5,代碼來源:Events.java

示例15: onPlayerQuit

import org.bukkit.event.player.PlayerQuitEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
    Player p = event.getPlayer();
    logoff(p);
    event.setQuitMessage("");
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:7,代碼來源:LoginLogoutManager.java


注:本文中的org.bukkit.event.player.PlayerQuitEvent.setQuitMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。