本文整理汇总了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);
}
示例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());
}
}
示例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)));
}
示例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)));
}
示例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;
}