Development Assistance Horse Mount

Discussion in 'Plugin Help/Development/Requests' started by Cypthon, Aug 13, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Cypthon

    I made a horse mount and whenever I click the apple to spawn it, it doesn't do anything.
    Code:
    public class mount extends JavaPlugin implements Listener {
        public void onEnable() {
            this.getServer().getPluginManager().registerEvents(this, this);
        }
        @EventHandler
        public void onPlayerUse(PlayerInteractEvent event) {
            Player player = event.getPlayer();
            if (player.isInsideVehicle())
            if (player.getItemInHand().getType().equals(Material.APPLE)) {
                Horse h = (Horse) player.getWorld().spawnEntity(player.getLocation(), EntityType.HORSE);
                h.setTamed(true);
                h.setAdult();
                h.setVariant(Horse.Variant.SKELETON_HORSE);
                h.getInventory().setSaddle(new ItemStack(Material.SADDLE, 1));
                h.setPassenger(player);
            }
        }
    }
     
  2. Offline

    Chromify

    I don't think you put the apple spawning the horse. That's what I think.
     
  3. Offline

    Cypthon

    fixed it, had to return after if (player.isInsideVehicle()).
     
Thread Status:
Not open for further replies.

Share This Page