Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) {
- if (command.getName().equalsIgnoreCase("spawncreepers")) {
- final Player player = (Player) commandSender;
- new BukkitRunnable() {
- int step = 0;
- @Override
- public void run() {
- step++;
- if (step <= 10 * 4) {
- spawnCreepers2(player);
- } else {
- cancel();
- }
- }
- }.runTaskTimer(Main.getInstance(), 0, 5);
- }
- return false;
- }
- public static void spawnCreepers2(final Player player) {
- final Creeper c1 = player.getWorld().spawn(player.getLocation(), Creeper.class);
- final Creeper c2 = player.getWorld().spawn(player.getLocation(), Creeper.class);
- final Creeper c3 = player.getWorld().spawn(player.getLocation(), Creeper.class);
- c1.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
- c2.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
- c3.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
- c1.setPowered(true);
- c2.setPowered(true);
- c3.setPowered(true);
- new BukkitRunnable() {
- int particleStep = 0;
- int particleStep2 = 20 * 7;
- int particleStep3 = 40 * 7;
- @Override
- public void run() {
- if (!player.isOnline()) {
- c1.remove();
- c2.remove();
- c3.remove();
- cancel();
- return;
- }
- List<Location> locations = LocationUtils.getCircle(player.getLocation(), 3 * 7, 60 * 7);
- c1.teleport(locations.get(particleStep));
- c2.teleport(locations.get(particleStep2));
- c3.teleport(locations.get(particleStep3));
- }
- }.runTaskTimer(Main.getInstance(), 0, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment