当前位置: 首页>>代码示例>>Java>>正文


Java PlayerDeathEvent.getDeathMessage方法代码示例

本文整理汇总了Java中org.bukkit.event.entity.PlayerDeathEvent.getDeathMessage方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerDeathEvent.getDeathMessage方法的具体用法?Java PlayerDeathEvent.getDeathMessage怎么用?Java PlayerDeathEvent.getDeathMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.entity.PlayerDeathEvent的用法示例。


在下文中一共展示了PlayerDeathEvent.getDeathMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler
  public void onPlayerDeath(PlayerDeathEvent event) {
  	String dmessage = event.getDeathMessage() + "!";
Team.getTeam(event.getEntity()).leave(event.getEntity());
  	event.setDeathMessage(null);
      if (State.PRE)
          return;

if (event.getEntity().getKiller() instanceof Player) {
	Hive.getInstance().getDatabase().update(String.format("INSERT INTO kills (server,game_id,player,target) VALUES ('%s',%d,'%s','%s')","walls",Walls.ID,event.getEntity().getKiller().getName(),event.getEntity().getName()));
      }
else {
	Hive.getInstance().getDatabase().update(String.format("INSERT INTO kills (server,game_id,player,target) VALUES ('%s',%d,'%s','%s')","walls",Walls.ID,"natural",event.getEntity().getName()));
}

      Chat.server(dmessage.replace(event.getEntity().getName(), event.getEntity().getDisplayName() + "&c"));
      Walls.getSpectators().add(event.getEntity().getName());
      Player p = event.getEntity();
      Chat.player(p, "&2You are now a spectator and can watch the game.");
      Walls.updateSpectators();
p.setFlying(true);
  }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:23,代码来源:GameEvents.java

示例2: onPlayerDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDeath(PlayerDeathEvent event) {
	String deathMsg = event.getDeathMessage();

	String[] msgWords = deathMsg.split("\\s");
	if (msgWords.length == 5) {
		if (msgWords[1].equalsIgnoreCase("was") && msgWords[3].equalsIgnoreCase("by")) {
			Player p = plugin.getServer().getPlayer(msgWords[4]);
			if ((p != null) && PermissionInterface.CheckEnabledWorld(p.getLocation())) {
				int newExp = 100;
				
				plugin.getServer().broadcastMessage(ChatColor.GREEN + p.getName() + " receives " + ChatColor.YELLOW
						+ newExp + ChatColor.GREEN + " rank points!");
				
				syp = (Shipyard)plugin.getServer().getPluginManager().getPlugin("NavyCraft-Shipyard");
				if( syp != null ) {
					syp.rewardExpPlayer(newExp, p);
					syp.checkRankWorld(p, newExp, p.getWorld());
					syp.saveExperience();
				}
			}
		}
	}

	if (!NavyCraft.playerKits.isEmpty() && NavyCraft.playerKits.contains(event.getEntity().getName())) {
		NavyCraft.playerKits.remove(event.getEntity().getName());
	}
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:29,代码来源:NavyCraft_PlayerListener.java

示例3: onPlayerDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerDeath(final PlayerDeathEvent event) {
    final String message = event.getDeathMessage();
    if(message == null || message.isEmpty()) {
        return;
    }
    event.setDeathMessage(getDeathMessage(message,  event.getEntity(),  this.getKiller(event)));
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:DeathMessageListener.java

示例4: onPlayerDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerDeath(final PlayerDeathEvent event) {
    final String message = event.getDeathMessage();
    if(message == null || message.isEmpty()) {
        return;
    }
    event.setDeathMessage(getDeathMessage(message,  event.getEntity(),  this.getKiller(event)));
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:DeathMessageListener.java

示例5: safeToSend

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
private boolean safeToSend(PlayerDeathEvent event) {
    boolean safe = event.getDeathMessage() != null && !event.getDeathMessage().isEmpty();
    if(!safe)
        Logger.warn("Previous PlayerDeathEvent message is null or missing!");
    return safe;
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:7,代码来源:DeathListener.java


注:本文中的org.bukkit.event.entity.PlayerDeathEvent.getDeathMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。