Advertisement
Guest User

Help me please

a guest
Jun 20th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.61 KB | None | 0 0
  1. package me.zeddy;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Location;
  6. import org.bukkit.Material;
  7. import org.bukkit.World;
  8. import org.bukkit.command.Command;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.EntityType;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.event.EventHandler;
  13. import org.bukkit.event.EventPriority;
  14. import org.bukkit.event.Listener;
  15. import org.bukkit.event.block.Action;
  16. import org.bukkit.event.player.PlayerInteractEvent;
  17. import org.bukkit.inventory.ItemStack;
  18. import org.bukkit.inventory.meta.ItemMeta;
  19. import org.bukkit.plugin.java.JavaPlugin;
  20.  
  21. public class Main extends JavaPlugin implements Listener{
  22.    
  23.     public void onEnable(){
  24.         saveDefaultConfig();
  25.         getServer().getPluginManager().registerEvents(this , this);
  26.     }
  27.    
  28.     public void onDisable(){
  29.         saveConfig();
  30.     }
  31.    
  32.     //0 = skeleton 2 wither 2 zombie 3 player 4 creeper 5 dragon
  33.     //Items
  34.     //wither skull
  35.     public ItemStack Wither(){
  36.         ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
  37.         ItemMeta meta = witherskull.getItemMeta();
  38.         meta.setDisplayName("WitherBoss");
  39.         witherskull.setItemMeta(meta);
  40.         return witherskull;
  41.     }
  42.  
  43.     public ItemStack Blaze(){
  44.         ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
  45.         ItemMeta meta = witherskull.getItemMeta();
  46.         meta.setDisplayName("WitherBoss");
  47.         witherskull.setItemMeta(meta);
  48.         return witherskull;
  49.     }
  50.    
  51.     public ItemStack Skeleton(){
  52.         ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
  53.         ItemMeta meta = witherskull.getItemMeta();
  54.         meta.setDisplayName("WitherBoss");
  55.         witherskull.setItemMeta(meta);
  56.         return witherskull;
  57.     }
  58.    
  59.     public ItemStack Zombie(){
  60.         ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
  61.         ItemMeta meta = witherskull.getItemMeta();
  62.         meta.setDisplayName("WitherBoss");
  63.         witherskull.setItemMeta(meta);
  64.         return witherskull;
  65.     }
  66.    
  67.     public ItemStack Witch(){
  68.         ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
  69.         ItemMeta meta = witherskull.getItemMeta();
  70.         meta.setDisplayName("WitherBoss");
  71.         witherskull.setItemMeta(meta);
  72.         return witherskull;
  73.     }
  74.    
  75.    
  76.    
  77.     public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  78.        
  79.         Player player = (Player)sender;
  80.         if (commandLabel.equalsIgnoreCase("bosses")){
  81.             player.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Messages.Verison")));
  82.         return true;
  83.         }else if (commandLabel.equalsIgnoreCase("cmobegg")){
  84.             if (args.length == 2){
  85.                 if (player.hasPermission("Bosses.admin")){
  86.                     if (args[0].equalsIgnoreCase(" witherBoss"));
  87.                     Player PlayerTaged = Bukkit.getServer().getPlayer(args[1]);
  88.                     if (PlayerTaged == null){
  89.                         player.sendMessage(ChatColor.RED + "This player is offline!");
  90.                     }else if (PlayerTaged != null){
  91.                         PlayerTaged.getInventory().addItem(Wither());
  92.                     }
  93.                 }
  94.             }
  95.         }
  96.         return true;
  97.     }
  98.    
  99.     @EventHandler(priority=EventPriority.HIGH)
  100.     public void onPlayerUse(PlayerInteractEvent event){
  101.         Player p = event.getPlayer();
  102.         Action click  = event.getAction();
  103.         Location TargetLocation = p.getLocation();
  104.         if (click == Action.RIGHT_CLICK_AIR || click == Action.RIGHT_CLICK_BLOCK){
  105.             p.sendMessage ("works!");
  106.                 if(p.getInventory().getItemInMainHand() == Wither()){
  107.                     p.sendMessage("it works for sure!");
  108.                     p.sendMessage (ChatColor.BOLD + "You have spawned a wither boss!");
  109.                     p.getWorld().spawnEntity(TargetLocation, EntityType.WITHER);
  110.                 }
  111.            
  112.  
  113.             }
  114.     }
  115.  
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement