Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package spiel;
- import java.util.ArrayList;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.block.Block;
- import org.bukkit.entity.Player;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.scheduler.BukkitRunnable;
- import org.bukkit.util.Vector;
- import SpigotComplements.Particle;
- import crazy.Crazy;
- import gameverlauf.Gameverlauf;
- import lobby.VoteGUI;
- import net.minecraft.server.v1_12_R1.EnumParticle;
- public class Ultimate {
- public static void manageUltimateBar(Location loc) {
- createBar(loc, 10);
- }
- private static void createBar(final Location loc, final int currentBarLevel) {
- if(currentBarLevel > 10 || currentBarLevel<1) return;
- final ArrayList<Block> blocks = createBlocks(loc, currentBarLevel);
- BukkitRunnable bukRun = new BukkitRunnable() {
- @Override
- public void run() {
- for(Block block:blocks) {
- block.setType(Material.AIR);
- }
- blocks.clear();
- if(currentBarLevel==1) {
- for(Player p : Gameverlauf.ingame) {
- p.playSound(loc, Sound.ENTITY_ENDERDRAGON_GROWL, 3f, 1f);
- p.sendMessage("§6§lULTIMATE!");
- p.teleport(new Location(loc.getWorld(), loc.getBlockX(), loc.getY()+12, loc.getBlockZ()));
- p.setVelocity(new Vector(0,10,0));
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 300, 5));
- p.sendMessage("§7>>> §6§lULTIMATIVE BESCHLEUNIGUNG");
- p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 300, 5));
- p.sendMessage("§7>>> §6§lULTIMATIVE STÄRKE");
- }
- for (Integer spawn=0; spawn < VoteGUI.WINNER.getSpawns().size(); spawn++) {
- for(int i = 0; i<=60; i++) {
- Particle particle = new Particle(EnumParticle.VILLAGER_HAPPY, VoteGUI.WINNER.getSpawns().get(spawn).clone().add(0,i,0), true, 0.1f, 0.1f, 0.1f, 1, 4);
- particle.sendAll();
- }
- }
- manageUltimateBar(loc);
- } else {
- createBar(loc, currentBarLevel-1);
- }
- cancel();
- }
- };
- bukRun.runTaskLater(Crazy.plugin, 20l*12);
- }
- @SuppressWarnings("deprecation")
- private static ArrayList<Block> createBlocks(Location loc, Integer currentBarLevel) {
- int byteInt = currentBarLevel < 2 ? 14 : (currentBarLevel < 4 ? 1 : (currentBarLevel < 6 ? 4 : 13));
- ArrayList<Block> blocks = new ArrayList<>();
- for (Integer i = 0; i < 10; i++) {
- final Block block = loc.getWorld()
- .getBlockAt(new Location(loc.getWorld(), loc.getX(), loc.getY() + i, loc.getZ()));
- if (i < currentBarLevel) {
- block.setType(Material.STAINED_CLAY);
- blocks.add(block);
- } else {
- block.setType(Material.AIR);
- }
- }
- for (Integer i = 0; i < 10; i++) {
- final Block glass = loc.getWorld()
- .getBlockAt(new Location(loc.getWorld(), loc.getX() + 1, loc.getY() + i, loc.getZ()));
- glass.setType(Material.STAINED_GLASS);
- final Block glass2 = loc.getWorld()
- .getBlockAt(new Location(loc.getWorld(), loc.getX() - 1, loc.getY() + i, loc.getZ()));
- glass2.setType(Material.STAINED_GLASS);
- final Block glass3 = loc.getWorld()
- .getBlockAt(new Location(loc.getWorld(), loc.getX(), loc.getY() + i, loc.getZ() + 1));
- glass3.setType(Material.STAINED_GLASS);
- final Block glass4 = loc.getWorld()
- .getBlockAt(new Location(loc.getWorld(), loc.getX(), loc.getY() + i, loc.getZ() - 1));
- glass4.setType(Material.STAINED_GLASS);
- blocks.add(glass);
- blocks.add(glass2);
- blocks.add(glass3);
- blocks.add(glass4);
- }
- for(int i = 0; i < 1; i++) {
- final Block edge = loc.getWorld().getBlockAt(new Location(loc.getWorld(), loc.getX(), loc.getY() + (11*i)-1, loc.getZ()));
- edge.setType(Material.STAINED_GLASS);
- blocks.add(edge);
- }
- for (Block block : blocks) {
- block.setData((byte) byteInt);
- }
- return blocks;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement