本文整理汇总了Java中org.bukkit.event.entity.PlayerDeathEvent.setKeepInventory方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerDeathEvent.setKeepInventory方法的具体用法?Java PlayerDeathEvent.setKeepInventory怎么用?Java PlayerDeathEvent.setKeepInventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.entity.PlayerDeathEvent
的用法示例。
在下文中一共展示了PlayerDeathEvent.setKeepInventory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDeath
import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler
public void onDeath(PlayerDeathEvent e){
Entity en1 = e.getEntity();
Entity en = e.getEntity().getKiller();
if (en instanceof Player){
Player pl = (Player)en1;
Player p = (Player)en;
if(manager.isInPvP(p)){
vu.killMoney(p, pl);
e.setKeepInventory(true);
pvpc.removeCooldown(p);
pvpc.removeCooldown(pl);
p.sendMessage(Message.prefix + ChatColor.DARK_GREEN + " Ya no estás en pvp, puedes desconectarte.");
pl.sendMessage(Message.prefix + ChatColor.DARK_GREEN + " Ya no estás en pvp, puedes desconectarte.");
}
}
}
示例2: onDeath
import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler
public void onDeath(PlayerDeathEvent e){
Player p = e.getEntity();
if(WCSurvival.getPlayer(p).hasPermission("noDrop")) {
e.setKeepInventory(true);
e.setKeepLevel(true);
}
}
示例3: onDeath
import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler
public void onDeath(PlayerDeathEvent e) {
KingdomFactionsPlayer player = PlayerModule.getInstance().getPlayer(e.getEntity());
e.setKeepInventory(false);
if(player.getKingdom().getType().equals(KingdomType.GEEN)) {
player.getInventory().clear();
player.getInventory().addItem(Item.getInstance().getItem(Material.COMPASS, ChatColor.RED + "Selecteer jouw kingdom", 1));
player.updateInventory();
player.teleport(player.getKingdom().getSpawn());
}
if (e.getEntity().getKiller() != null) {
KingdomFactionsPlayer killer = PlayerModule.getInstance().getPlayer(e.getEntity().getKiller());
e.setDeathMessage(getName(player) + " is verwond door " + getName(killer) + "!");
if(player.getCombatTracker().isInCombat()) {
player.getCombatTracker().clearCombat();
}
Bukkit.getScheduler().runTaskLater(KingdomFactionsPlugin.getInstance(), new Runnable() {
@Override
public void run() {
if(!player.hasPermission("kingdomfactions.deathban.ignore")) {
if(Setting.USE_DEATHBAN.isEnabled()) {
DeathBanModule.getInstance().ban(player);
}
}
}
}, 40L);
} else {
e.setDeathMessage(null);
}
// e.getEntity().spigot().respawn();
}
示例4: onDeath
import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler
public void onDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
try {
if (RankManager.getGuardLevel(player) == 1 || RankManager.getGuardLevel(player) == 2) {
event.setKeepInventory(true);
} else {
event.setKeepInventory(false);
}
} catch (SQLException e) {
e.printStackTrace();
}
}