Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.junkstyle.SoulCatcher;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerEggThrowEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin implements Listener {
- public void onEnable() {
- System.out.println("Soul Catcher Plugin Working Fine!");
- Bukkit.getPluginManager().registerEvents(this, this);
- }
- @EventHandler
- public void OnThrow(PlayerEggThrowEvent e) {
- Player player = e.getPlayer();
- if (player.getInventory().getItemInMainHand().getType() == (Material.EGG)) {
- if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
- if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName() != null) {
- if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Cow Egg")) {
- Entity cow = player.getWorld().spawnEntity(e.getEgg().getLocation(), EntityType.COW);
- cow.setCustomName(ChatColor.RED + "Poco");
- cow.setCustomNameVisible(true);
- } if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Egg")) {
- } if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Cat Egg")) {
- Entity cat = player.getWorld().spawnEntity(e.getEgg().getLocation(), EntityType.OCELOT);
- cat.setCustomName(ChatColor.RED + "Ladiga");
- cat.setCustomNameVisible(true);
- } if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Sheep Egg")) {
- Entity sheep = player.getWorld().spawnEntity(e.getEgg().getLocation(), EntityType.SHEEP);
- sheep.setCustomName("jeb_");
- sheep.setCustomNameVisible(true);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment