Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package be.isach.particletests.command.commands;
- import be.isach.particletests.ParticleTests;
- import be.isach.particletests.command.SubCommand;
- import org.bukkit.Bukkit;
- import org.bukkit.Effect;
- import org.bukkit.Location;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.scheduler.BukkitRunnable;
- /**
- * Created by Sacha on 08/11/15.
- */
- public class TestCommand extends SubCommand {
- public TestCommand() {
- super("test", "", "t");
- }
- private int[][] shape = {
- {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- };
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- BukkitRunnable task = new BukkitRunnable() {
- @Override
- public void run() {
- drawParticles(((Player)sender).getLocation());
- }
- };
- task.runTaskTimerAsynchronously(ParticleTests.instance, 0, 5);
- Bukkit.getScheduler().runTaskLater(ParticleTests.instance, () -> task.cancel(), 100);
- }
- private void drawParticles(Location location) {
- double defX = location.getX() - 1;
- double x = defX;
- double y = location.clone().getY() + 4;
- for(int i = 0; i < shape.length; i++) {
- for(int j = 0; j < shape[i].length; j++) {
- if(shape[i][j] == 1)
- location.getWorld().spigot().playEffect(new Location(location.getWorld(), x, y, location.getZ()), Effect.FLAME, 0, 0, 0, 0, 0, 0, 1, 64);
- x += 0.1;
- }
- y -= 0.1;
- x = defX;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement