danik159

Untitled

Jul 11th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. @EventHandler
  2. public void OnThrow(PlayerEggThrowEvent e) {
  3. Player player = e.getPlayer();
  4. Entity cow = player.getWorld().spawnEntity(e.getEgg().getLocation(), EntityType.COW);
  5. cow.setCustomName(ChatColor.RED + "Mama");
  6. cow.setCustomNameVisible(true);
  7. if (player.getInventory().getItemInMainHand().getType() == (Material.EGG)) {
  8. if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
  9. if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName() != null) {
  10. if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Cow Egg")) {
  11. player.getWorld().spawnEntity(e.getEgg().getLocation(), EntityType.COW);
  12. } if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Egg")) {
  13.  
  14. }
  15. }
  16. }
  17.  
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment