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


Java PlayerDeathEvent.setKeepInventory方法代码示例

本文整理汇总了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.");
         }
         
     }
 }
 
开发者ID:cadox8,项目名称:WC,代码行数:23,代码来源:PlayerEvent.java

示例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);
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:10,代码来源:PlayerEvent.java

示例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();
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:40,代码来源:PlayerDeathEventListener.java

示例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();
    }
}
 
开发者ID:Warvale,项目名称:Locked,代码行数:14,代码来源:PlayerListener.java


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