本文整理匯總了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).");
}
示例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);
}
示例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();
}
}
示例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();
}
}
}
示例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())));
}