Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SheepWars;
- import org.bukkit.Bukkit;
- import org.bukkit.Material;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.Sheep;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class SheepWars extends JavaPlugin implements Listener{
- public void onEnable(){
- Bukkit.getPluginManager().registerEvents(this, this);
- }
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent e){
- Player p = e.getPlayer();
- if(e.getItem().getType() == Material.WOOL){
- if(p.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("Mouton d'Abordage")){
- if(e.getAction() == Action.RIGHT_CLICK_AIR){
- p.getLocation().getDirection();
- Sheep sheep = (Sheep) p.getWorld().spawn(p.getLocation(), Sheep.class);
- sheep.setVelocity(p.getLocation().getDirection().normalize().multiply(6D));
- sheep.setPassenger(p);
- }else if(e.getAction() == Action.RIGHT_CLICK_BLOCK){
- e.setCancelled(true);
- p.getLocation().getDirection();
- Sheep sheep = (Sheep) p.getWorld().spawn(p.getLocation(), Sheep.class);
- sheep.setVelocity(p.getLocation().getDirection().normalize().multiply(6D));
- sheep.setPassenger(p);
- }
- }else{
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment