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


Java Horse.remove方法代碼示例

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


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

示例1: killallHorses

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public static void killallHorses(World w) // RIP in peace D:
{
    List<Horse> toremove = new ArrayList<>();

    for (Entity e : w.getEntities())
    {
        if (e instanceof Horse)
        {
            toremove.add((Horse) e);
        }
    }

    for (Horse h : toremove)
    {
        h.remove();
    }

    EquestrianDash.plugin.getLogger().info("Removed " + toremove.size() + " horse(s).");
}
 
開發者ID:ColonelHedgehog,項目名稱:Equestrian-Dash,代碼行數:20,代碼來源:WorldLoadListener.java

示例2: respawnPlayer

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public void respawnPlayer(final Player p)
{
    if (p.getVehicle() != null && p.getVehicle() instanceof Horse)
    {
        Horse h = (Horse) p.getVehicle();
        h.setPassenger(null);
        h.setOwner(null);
        h.remove();
    }

    p.getWorld().playSound(p.getLocation(), Sound.WITHER_SPAWN, 3, 1);
    p.setHealth(p.getMaxHealth());
    Location loc = lastLocation.get(p.getUniqueId());
    p.teleport(loc);

    p.getInventory().clear();
    p.setFireTicks(0);
    plugin.getPropertyHandler().generateHorse(p, loc);
}
 
開發者ID:ColonelHedgehog,項目名稱:Equestrian-Dash,代碼行數:20,代碼來源:RacerHandler.java

示例3: onVehicleExit

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
	if (event.getVehicle() instanceof Horse) {
		Horse h = (Horse) event.getVehicle();
		h.remove();
	}
}
 
開發者ID:ktross,項目名稱:HorseMount,代碼行數:8,代碼來源:HorseMount.java

示例4: onEntityDamage

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
	if (event.getEntityType() == EntityType.HORSE && ((LivingEntity) event.getEntity()).getCustomName() != null && ((LivingEntity) event.getEntity()).getCustomName().equalsIgnoreCase("[HM] Display")) {
		event.setCancelled(true);
	}
	if (event.getEntityType() == EntityType.PLAYER && event.getEntity().getVehicle() != null) {
		Damageable p = (Damageable) event.getEntity();
		if (event.getDamage() >= p.getHealth()) {
			Horse h = (Horse) event.getEntity().getVehicle();
			h.remove();
		}
	}
}
 
開發者ID:ktross,項目名稱:HorseMount,代碼行數:14,代碼來源:HorseMount.java

示例5: CommandStore

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public CommandStore(HorseKeep plugin, CommandSender sender, String[] args)
{
	super(plugin, sender, args);
	
	if (!(sender instanceof Player)) { sender.sendMessage(plugin.lang.get("canOnlyExecByPlayer")); return; }
	
	Player player = (Player) sender;
	
	if (!plugin.perm.has(sender, "horsekeep.store") && !plugin.perm.has(sender, "horsekeep.admin"))
	{
		sender.sendMessage(this.getPrefix() + ChatColor.RED + plugin.lang.get("noPermission"));
		return;
	}

	if (!plugin.manager.isOnHorse(player))
	{
		sender.sendMessage(this.getPrefix() + ChatColor.GOLD + plugin.lang.get("mustRidingHorse"));
		return;
	}
	
	Horse horse = (Horse) player.getVehicle();
	
	if (!plugin.manager.isOwned(horse.getUniqueId()))
	{
		sender.sendMessage(this.getPrefix() + ChatColor.GOLD + plugin.lang.get("horseNotProtected"));
		return;
	}

	if (!plugin.manager.isHorseOwner(player.getUniqueId(), horse) && !plugin.perm.has(sender, "horsekeep.admin"))
	{
		sender.sendMessage(this.getPrefix() + ChatColor.GOLD + plugin.lang.get("dontOwnThisHorse"));
		return;
	}
	
	horse.eject();
	
	plugin.manager.store(horse);
	
	horse.remove();
       
	sender.sendMessage(this.getPrefix() + plugin.lang.get("horseStored").replace("%id", plugin.manager.getHorseIdentifier(horse.getUniqueId())));
}
 
開發者ID:vikicraft,項目名稱:horsekeep,代碼行數:43,代碼來源:CommandStore.java


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