Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args){
- if(CommandLabel.equalsIgnoreCase("szspawn")){
- if(!(sender instanceof Player)){
- sender.sendMessage(ChatColor.DARK_RED + "You must be a player to execute this command!");
- return false;
- }
- Player p = (Player) sender;
- if(args.length == 2){
- Player target = Bukkit.getPlayer(args[0]);
- if(target.isOnline()){
- if(isInt(args[1])){
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.GREEN + "Spawning Zombies around the target!");
- target.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.GREEN + "Spawning Zombies around You!");
- Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- public void run() {
- for(int i = 0; i < Integer.valueOf(args[1]); i++){
- World world = target.getWorld();
- Location loc = target.getLocation().add(5, 0, 5);
- Location loc1 = target.getLocation().add(-5, 0, 5);
- Location loc2 = target.getLocation().add(5, 0, -5);
- Location loc3 = target.getLocation().add(-5, 0, -5);
- Zombie z1 = (Zombie) world.spawnEntity(loc, EntityType.ZOMBIE);
- Zombie z2 = (Zombie) world.spawnEntity(loc1, EntityType.ZOMBIE);
- Zombie z3 = (Zombie) world.spawnEntity(loc2, EntityType.ZOMBIE);
- Zombie z4 = (Zombie) world.spawnEntity(loc3, EntityType.ZOMBIE);
- z1.setTarget(target);
- z2.setTarget(target);
- z3.setTarget(target);
- z4.setTarget(target);
- }
- }
- }, 0L, 20L);
- }else if (!isInt(args[1])){
- p.sendMessage(ChatColor.GREEN + "Variable <zombies per second> must me a number!");
- }
- }else if(!target.isOnline()){
- p.sendMessage(ChatColor.RED + "The target is Offline!");
- }
- }else if(!(args.length == 2)){
- p.sendMessage(ChatColor.GREEN + "Usage: /szspawn <target> <zombies per second>");
- }
- }
- if(CommandLabel.equalsIgnoreCase("szstart")){
- if(!(sender instanceof Player)){
- sender.sendMessage(ChatColor.DARK_RED + "You must be a player to execute this command!");
- return false;
- }
- Player p = (Player) sender;
- if(args.length == 2){
- if(isInt(args[0])){
- int radius = Integer.valueOf(args[0]);
- if(isInt(args[1])){
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.GREEN + "Spawning Zombies around You!");
- Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- public void run() {
- for(int i = 0; i < Integer.valueOf(args[1]); i++){
- World w = p.getWorld();
- Location loc = new Location(p.getLocation().getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
- loc.setX(loc.getX() + Math.random() * radius * 2 - radius);
- loc.setZ(loc.getZ() + Math.random() * radius * 2 - radius);
- loc.setY(w.getHighestBlockAt(loc.getBlockX(), loc.getBlockZ()).getY());
- w.spawnEntity(loc, EntityType.ZOMBIE);
- }
- }
- }, 0L, 20L);
- }else if (!isInt(args[1])){
- p.sendMessage(ChatColor.GREEN + "Variable <zombies per second> must be a number!");
- }
- }else if(!(isInt(args[0]))){
- p.sendMessage(ChatColor.GREEN + "Variable <radius> must be a number!");
- }
- }else if(!(args.length == 2)){
- p.sendMessage(ChatColor.GREEN + "Usage: /szstart <radius> <zombies per second>");
- }
- }
- if(CommandLabel.equalsIgnoreCase("szstop")){
- if(!(sender instanceof Player)){
- sender.sendMessage(ChatColor.DARK_RED + "You must be a player to execute this command!");
- return false;
- }
- Player p = (Player) sender;
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.RED + "Stopped Spawning Zombies around You!");
- Bukkit.getServer().getScheduler().cancelAllTasks();
- }
- if(CommandLabel.equalsIgnoreCase("szinfo")){
- if(!(sender instanceof Player)){
- sender.sendMessage(ChatColor.DARK_RED + "You must be a player to execute this command!");
- return false;
- }
- Player p = (Player) sender;
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "Plugin Made by TrolleDz");
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "YouTube: TrolleDz");
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "Skype: darkmix13");
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "Thank for using SpawnZombies");
- }
- if(CommandLabel.equalsIgnoreCase("szboss")){
- if(!(sender instanceof Player)){
- sender.sendMessage(ChatColor.DARK_RED + "You must be a player to execute this command!");
- return false;
- }
- Player p = (Player) sender;
- Bukkit.broadcastMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "Boss Spawned! :O");
- World world = p.getWorld();
- Location l = p.getLocation();
- Zombie boss = (Zombie) world.spawnEntity(l, EntityType.ZOMBIE);
- boss.setCustomName(ChatColor.GRAY + "* " + ChatColor.BOLD + ChatColor.DARK_RED + "Boss" + ChatColor.RESET + ChatColor.GRAY + " *");
- boss.setCustomNameVisible(true);
- boss.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 999999, 5));
- boss.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 5));
- boss.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 2));
- boss.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 10));
- boss.setMaxHealth(500);
- boss.setHealth(500);
- for(int i = 0; i < 8; i++) {
- Location location = boss.getLocation().add(5, 0, 5);
- Zombie z1 = (Zombie) world.spawnEntity(location, EntityType.ZOMBIE);
- z1.setCustomName("Guard");
- z1.setCustomNameVisible(true);
- z1.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET));
- z1.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
- z1.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS));
- z1.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
- Location location1 = boss.getLocation().add(-5, 0, 5);
- Zombie z2 = (Zombie) world.spawnEntity(location1, EntityType.ZOMBIE);
- z2.setCustomName("Paladin");
- z2.setCustomNameVisible(true);
- z2.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
- z2.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
- z2.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- z2.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
- Location location2 = boss.getLocation().add(5, 0, -5);
- Zombie z3 = (Zombie) world.spawnEntity(location2, EntityType.ZOMBIE);
- z3.setCustomName("Non-Dead Warrior");
- z3.setCustomNameVisible(true);
- z3.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
- z3.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
- z3.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
- z3.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
- Location location3 = boss.getLocation().add(-5, 0, -5);
- Zombie z4 = (Zombie) world.spawnEntity(location3, EntityType.ZOMBIE);
- z1.setCustomName("Defender");
- z1.setCustomNameVisible(true);
- z4.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET));
- z4.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
- z4.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS));
- z4.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
- }
- }
- if(CommandLabel.equalsIgnoreCase("szkill")){
- if(!(sender instanceof Player)){
- sender.sendMessage(ChatColor.DARK_RED + "You must be a player to execute this command!");
- return false;
- }
- Player p = (Player) sender;
- World w = p.getWorld();
- p.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "SpawnZombies" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "Killing all the Zombies!");
- List<Entity> entities = w.getEntities();
- for (Entity entity : entities){
- if(entity.getType() == EntityType.ZOMBIE){
- entity.remove();
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment