本文整理汇总了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));
}
示例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();
}
}
示例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!");
}
示例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");
}
示例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);
}
}
示例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
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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");
}
}
示例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());
}
示例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());
}
示例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())));
}
示例14: onPlayerQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
event.setQuitMessage(null);
}
示例15: onPlayerQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player p = event.getPlayer();
logoff(p);
event.setQuitMessage("");
}