Horse Api

This project is abandoned and its default file will likely not work with the most recent version of Minecraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

Overview

This plugin was created out of the lack of an official horse api. I was frustrated that it was next to impossible to make horses protected on my server so I made this plugin.

How to install

1. Download the latest version
2. Place in your server's /plugins folder
3. Reload or restart

Legal Stuff

You can use this api in whatever plugin you want as long as the following conditions are met.

"My code" refers to the code created by me (john01dav) and hosted on dev.bukkit.org labed as part of the project "horse-api" "The Pluign" and "Your Plugin" Refer to any code you create refrencing my code

1. Your plugin must be posted on bukkitdev or be a custom private plugin used only on servers you or someone you are making the plugin for operate
2. Your plugin must not be posted on any site other then dev.bukkit.org, curse.com or any servers running the jenkins ci server
3. This page must be linked to in the bukkitdev description of your plugin

How to use this api in your own plugin

This plugin simply adds one event the HorseMountedEvent. Use the new event just like you would any other normal bukkit event.Example code making horses protected in GriefPrevention claims is shown below.

package src.john01dav.horseprotect;
import src.john01dav.horseapi.HorseMountedEvent;
import me.ryanhamshire.GriefPrevention.*;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public class HorseProtect extends JavaPlugin implements Listener{
	
	public void onEnable(){
		getServer().getPluginManager().registerEvents(this, this);
		getLogger().info("HorseProtect Has Been Enabled!");
	}
	
	public void onDisable(){
		getLogger().info("HorseProtect Has Been Disabled.");
	}
	
	@EventHandler
	public void HorseMountedEvent(HorseMountedEvent e){
		if(!e.getPlayer().isOp()){
			Claim claim = GriefPrevention.instance.dataStore.getClaimAt(e.getHorse().getLocation(), false, null);
			if(claim != null){
				if(claim.allowBuild(e.getPlayer()) != null){
					e.getPlayer().sendMessage(ChatColor.RED + "You do not have " + claim.getOwnerName() + "'s permissions to ride that horse!");
					e.setCancelled(true);
				}
			}
		}
	}
	
}

Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    60757
  • Created
    Jul 3, 2013
  • Last Released File
    Jul 3, 2013
  • Total Downloads
    679
  • License

Categories

Members

Recent Files

Bukkit