当前位置: 首页>>代码示例>>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;未经允许,请勿转载。