當前位置: 首頁>>代碼示例>>Java>>正文


Java Player.getKiller方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Player.getKiller方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.getKiller方法的具體用法?Java Player.getKiller怎麽用?Java Player.getKiller使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.getKiller方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: playerDeath

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler
public void playerDeath(PlayerDeathEvent e) {
    Player player = (Player) e.getEntity();   
    if (player.getKiller() instanceof Player) { 
        Bukkit.broadcastMessage(ChatColor.GREEN + player.getKiller().getName() + ChatColor.DARK_GRAY + " has killed " + ChatColor.GREEN + player.getName());
        for (PotionEffect effect : player.getActivePotionEffects())
            player.removePotionEffect(effect.getType());	   
        Datafiles.addDeath(player.getName());
        Datafiles.addKill(player.getKiller().getName());
        }else{
      	  Datafiles.addDeath(player.getName());
        
    }
    }
 
開發者ID:MohibMirza,項目名稱:RPGPlus,代碼行數:15,代碼來源:StatsGUI.java

示例2: onPlayerDeath

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerDeath(PlayerDeathEvent event) {
    Player player = event.getEntity();
    Player killer = player.getKiller();
    if (killer != null && killer.hasPermission(KILL_BEHEAD_PERMISSION)) {
        ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
        SkullMeta meta = (SkullMeta) skull.getItemMeta();
        meta.setOwner(player.getName());
        skull.setItemMeta(meta);
        event.getDrops().add(skull);
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:13,代碼來源:SkullListener.java

示例3: onPlayerDeath

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerDeath(PlayerDeathEvent event) {
    Player player = event.getEntity();
    Player killer = player.getKiller();
    if (killer != null && !killer.equals(player)) {
        event.getDrops().add(getDeathSign(player.getName(), killer.getName()));
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:9,代碼來源:DeathSignListener.java

示例4: onKill

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler
public void onKill(PlayerDeathEvent event) {
    Player target = event.getEntity();
    Player killer = target.getKiller();
    if (RankManager.isPrisoner(killer)) {
        if (RankManager.isPrisoner(target)) {
            killer.setTotalExperience(killer.getTotalExperience() + 250);
        } else if (RankManager.isGuard(target) || RankManager.isWarden(target)) {
            killer.setTotalExperience(killer.getTotalExperience() + 2000);
        }
    }
}
 
開發者ID:Warvale,項目名稱:Locked,代碼行數:13,代碼來源:RankListener.java

示例5: onPlayerDeath

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event) {
    Player player = event.getEntity();
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);

    if (playerFaction != null) {
        Faction factionAt = plugin.getFactionManager().getFactionAt(player.getLocation());
        double dtrLoss = (1.0D * factionAt.getDtrLossMultiplier());
        double newDtr = playerFaction.setDeathsUntilRaidable(playerFaction.getDeathsUntilRaidable() - dtrLoss);

        Role role = playerFaction.getMember(player.getUniqueId()).getRole();
        playerFaction.setRemainingRegenerationTime(BASE_REGEN_DELAY + (playerFaction.getOnlinePlayers().size() * TimeUnit.MINUTES.toMillis(2L)));
        playerFaction.broadcast(prefix + ChatColor.GRAY + "Member Death: " + SettingsYML.TEAMMATE_COLOUR + role.getAstrix() + player.getName() + ChatColor.GRAY + ". " + "DTR: (" + ChatColor.GOLD
                + JavaUtils.format(newDtr, 2) + '/' + JavaUtils.format(playerFaction.getMaximumDeathsUntilRaidable(), 2) + ChatColor.GRAY + ").");
        }
        Integer balance = 0;
        if(plugin.getEconomyManager().getBalance(player.getUniqueId()) > 0){
            balance = plugin.getEconomyManager().getBalance(player.getUniqueId()) % 10;
            if (player.getKiller() instanceof Player){
                plugin.getEconomyManager().subtractBalance(player.getUniqueId(), balance);
                if(balance != 0) {
                    plugin.getEconomyManager().addBalance(player.getKiller().getUniqueId(), balance);
                	player.getKiller().sendMessage(ChatColor.YELLOW + "You earned "  +ChatColor.GREEN+ ChatColor.BOLD + EconomyManager.ECONOMY_SYMBOL+balance + ChatColor.YELLOW +" for killing "+ ChatColor.WHITE +  player.getName() + "");
                }
                return;

            }
        }


    if (Bukkit.spigot().getTPS()[0] > 15) { // Prevent unnecessary lag during prime times.
        Location location = player.getLocation();
        WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();

        EntityLightning entityLightning = new EntityLightning(worldServer, location.getX(), location.getY(), location.getZ(), false);
        PacketPlayOutSpawnEntityWeather packet = new PacketPlayOutSpawnEntityWeather(entityLightning);
        for (Player target : Bukkit.getOnlinePlayers()) {
            if (plugin.getUserManager().getUser(target.getUniqueId()).isShowLightning()) {
                ((CraftPlayer) target).getHandle().playerConnection.sendPacket(packet);
                target.playSound(target.getLocation(), Sound.AMBIENCE_THUNDER, 1.0F, 1.0F);
            }
        }
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:45,代碼來源:DeathListener.java


注:本文中的org.bukkit.entity.Player.getKiller方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。