Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.zeddy;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.EventPriority;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin implements Listener{
- public void onEnable(){
- saveDefaultConfig();
- getServer().getPluginManager().registerEvents(this , this);
- }
- public void onDisable(){
- saveConfig();
- }
- //0 = skeleton 2 wither 2 zombie 3 player 4 creeper 5 dragon
- //Items
- //wither skull
- public ItemStack Wither(){
- ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
- ItemMeta meta = witherskull.getItemMeta();
- meta.setDisplayName("WitherBoss");
- witherskull.setItemMeta(meta);
- return witherskull;
- }
- public ItemStack Blaze(){
- ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
- ItemMeta meta = witherskull.getItemMeta();
- meta.setDisplayName("WitherBoss");
- witherskull.setItemMeta(meta);
- return witherskull;
- }
- public ItemStack Skeleton(){
- ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
- ItemMeta meta = witherskull.getItemMeta();
- meta.setDisplayName("WitherBoss");
- witherskull.setItemMeta(meta);
- return witherskull;
- }
- public ItemStack Zombie(){
- ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
- ItemMeta meta = witherskull.getItemMeta();
- meta.setDisplayName("WitherBoss");
- witherskull.setItemMeta(meta);
- return witherskull;
- }
- public ItemStack Witch(){
- ItemStack witherskull = new ItemStack(Material.SKULL_ITEM, 1, (short) 1);
- ItemMeta meta = witherskull.getItemMeta();
- meta.setDisplayName("WitherBoss");
- witherskull.setItemMeta(meta);
- return witherskull;
- }
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
- Player player = (Player)sender;
- if (commandLabel.equalsIgnoreCase("bosses")){
- player.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Messages.Verison")));
- return true;
- }else if (commandLabel.equalsIgnoreCase("cmobegg")){
- if (args.length == 2){
- if (player.hasPermission("Bosses.admin")){
- if (args[0].equalsIgnoreCase(" witherBoss"));
- Player PlayerTaged = Bukkit.getServer().getPlayer(args[1]);
- if (PlayerTaged == null){
- player.sendMessage(ChatColor.RED + "This player is offline!");
- }else if (PlayerTaged != null){
- PlayerTaged.getInventory().addItem(Wither());
- }
- }
- }
- }
- return true;
- }
- @EventHandler(priority=EventPriority.HIGH)
- public void onPlayerUse(PlayerInteractEvent event){
- Player p = event.getPlayer();
- Action click = event.getAction();
- Location TargetLocation = p.getLocation();
- if (click == Action.RIGHT_CLICK_AIR || click == Action.RIGHT_CLICK_BLOCK){
- p.sendMessage ("works!");
- if(p.getInventory().getItemInMainHand() == Wither()){
- p.sendMessage("it works for sure!");
- p.sendMessage (ChatColor.BOLD + "You have spawned a wither boss!");
- p.getWorld().spawnEntity(TargetLocation, EntityType.WITHER);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement