bridgeegg and popuptower ezzzz

This commit is contained in:
Luca
2021-11-24 19:44:31 +01:00
parent 9301730272
commit bb2bba9a30
11 changed files with 682 additions and 22 deletions

View File

@ -1,8 +0,0 @@
package rip.tilly.bedwars.customitems.popuptower;
public class CheckRotation {
public CheckRotation(Double d) {
}
}

View File

@ -4,24 +4,30 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.game.Game;
import rip.tilly.bedwars.playerdata.PlayerTeam;
public class PlaceTower {
private final BedWars plugin = BedWars.getInstance();
public PlaceTower(Block block, String xyz, PlayerTeam playerTeam, Player player, boolean ladder, int ladderData) {
int x = Integer.parseInt(xyz.split(", ")[0]);
int y = Integer.parseInt(xyz.split(", ")[1]);
int z = Integer.parseInt(xyz.split(", ")[2]);
Block relative = block.getRelative(x, y, z);
if (relative.getType() == Material.AIR) {
if (!ladder) {
relative.setType(Material.WOOL);
relative.setData((byte) playerTeam.getColorData());
} else {
relative.setType(Material.LADDER);
relative.setData((byte) ladderData);
Game game = this.plugin.getGameManager().getGame(player.getUniqueId());
if (!game.isInside(relative.getLocation(), game)) {
if (relative.getType() == Material.AIR) {
if (!ladder) {
relative.setType(Material.WOOL);
relative.setData((byte) playerTeam.getColorData());
} else {
relative.setType(Material.LADDER);
relative.setData((byte) ladderData);
}
this.plugin.getGameManager().getGame(player.getUniqueId()).addPlacedBlock(relative);
}
BedWars.getInstance().getGameManager().getGame(player.getUniqueId()).addPlacedBlock(relative);
}
}
}

View File

@ -1,4 +1,170 @@
package rip.tilly.bedwars.customitems.popuptower.types;
import org.bukkit.Bukkit;
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.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.customitems.popuptower.PlaceTower;
import rip.tilly.bedwars.playerdata.PlayerTeam;
import java.util.ArrayList;
import java.util.List;
public class TowerEast {
private BukkitTask bukkitTask;
public TowerEast(Location location, Block block, PlayerTeam playerTeam, Player player) {
ItemStack hand = player.getItemInHand();
if (hand.getAmount() == 1) {
hand.setType(Material.AIR);
player.setItemInHand(hand);
} else {
hand.setAmount(hand.getAmount() - 1);
}
List<String> locList = new ArrayList<>();
locList.add("2, 0, -1");
locList.add("1, 0, -2");
locList.add("0, 0, -2");
locList.add("-1, 0, -1");
locList.add("-1, 0, 0");
locList.add("-1, 0, 1");
locList.add("0, 0, 2");
locList.add("1, 0, 2");
locList.add("2, 0, 1");
locList.add("0, 0, 0, ladder5");
locList.add("2, 1, -1");
locList.add("1, 1, -2");
locList.add("0, 1, -2");
locList.add("-1, 1, -1");
locList.add("-1, 1, 0");
locList.add("-1, 1, 1");
locList.add("0, 1, 2");
locList.add("1, 1, 2");
locList.add("2, 1, 1");
locList.add("0, 1, 0, ladder5");
locList.add("2, 2, -1");
locList.add("1, 2, -2");
locList.add("0, 2, -2");
locList.add("-1, 2, -1");
locList.add("-1, 2, 0");
locList.add("-1, 2, 1");
locList.add("0, 2, 2");
locList.add("1, 2, 2");
locList.add("2, 2, 1");
locList.add("0, 2, 0, ladder5");
locList.add("2, 3, 0");
locList.add("2, 3, -1");
locList.add("1, 3, -2");
locList.add("0, 3, -2");
locList.add("-1, 3, -1");
locList.add("-1, 3, 0");
locList.add("-1, 3, 1");
locList.add("0, 3, 2");
locList.add("1, 3, 2");
locList.add("2, 3, 1");
locList.add("0, 3, 0, ladder5");
locList.add("2, 4, 0");
locList.add("2, 4, -1");
locList.add("1, 4, -2");
locList.add("0, 4, -2");
locList.add("-1, 4, -1");
locList.add("-1, 4, 0");
locList.add("-1, 4, 1");
locList.add("0, 4, 2");
locList.add("1, 4, 2");
locList.add("2, 4, 1");
locList.add("0, 4, 0, ladder5");
locList.add("-1, 5, -2");
locList.add("0, 5, -2");
locList.add("1, 5, -2");
locList.add("2, 5, -2");
locList.add("-1, 5, -1");
locList.add("0, 5, -1");
locList.add("1, 5, -1");
locList.add("2, 5, -1");
locList.add("-1, 5, 0");
locList.add("1, 5, 0");
locList.add("2, 5, 0");
locList.add("-1, 5, 1");
locList.add("0, 5, 0, ladder5");
locList.add("0, 5, 1");
locList.add("1, 5, 1");
locList.add("2, 5, 1");
locList.add("-1, 5, 2");
locList.add("0, 5, 2");
locList.add("1, 5, 2");
locList.add("2, 5, 2");
locList.add("2, 5, -3");
locList.add("2, 6, -3");
locList.add("2, 7, -3");
locList.add("1, 6, -3");
locList.add("0, 6, -3");
locList.add("-1, 5, -3");
locList.add("-1, 6, -3");
locList.add("-1, 7, -3");
locList.add("-2, 5, -2");
locList.add("-2, 6, -2");
locList.add("-2, 7, -2");
locList.add("-2, 6, -1");
locList.add("-2, 5, 0");
locList.add("-2, 6, 0");
locList.add("-2, 7, 0");
locList.add("-2, 6, 1");
locList.add("-2, 5, 2");
locList.add("-2, 6, 2");
locList.add("-2, 7, 2");
locList.add("2, 5, 3");
locList.add("2, 6, 3");
locList.add("2, 7, 3");
locList.add("1, 6, 3");
locList.add("0, 6, 3");
locList.add("-1, 5, 3");
locList.add("-1, 6, 3");
locList.add("-1, 7, 3");
locList.add("3, 5, -2");
locList.add("3, 6, -2");
locList.add("3, 7, -2");
locList.add("3, 6, -1");
locList.add("3, 5, 0");
locList.add("3, 6, 0");
locList.add("3, 7, 0");
locList.add("3, 6, 1");
locList.add("3, 5, 2");
locList.add("3, 6, 2");
locList.add("3, 7, 2");
int[] i = { 0 };
this.bukkitTask = Bukkit.getScheduler().runTaskTimer(BedWars.getInstance(), () -> {
location.getWorld().playSound(location, Sound.CHICKEN_EGG_POP, 1f, 0.5f);
if (locList.size() + 1 == i[0] + 1) {
this.bukkitTask.cancel();
return;
}
String string = locList.get(i[0]);
if (string.contains("ladder")) {
int ladderData = Integer.parseInt(string.split("ladder")[1]);
new PlaceTower(block, string, playerTeam, player, true, ladderData);
} else {
new PlaceTower(block, string, playerTeam, player, false, 0);
}
if (locList.size() + 1 == i[0] + 2) {
this.bukkitTask.cancel();
return;
}
String string2 = locList.get(i[0] + 1);
if (string2.contains("ladder")) {
int ladderData = Integer.parseInt(string2.split("ladder")[1]);
new PlaceTower(block, string2, playerTeam, player, true, ladderData);
} else {
new PlaceTower(block, string2, playerTeam, player, false, 0);
}
i[0] = i[0] + 2;
}, 0, 1);
}
}

View File

@ -1,4 +1,171 @@
package rip.tilly.bedwars.customitems.popuptower.types;
import org.bukkit.Bukkit;
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.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.customitems.popuptower.PlaceTower;
import rip.tilly.bedwars.playerdata.PlayerTeam;
import java.util.ArrayList;
import java.util.List;
public class TowerNorth {
private BukkitTask bukkitTask;
public TowerNorth(Location location, Block block, PlayerTeam playerTeam, Player player) {
ItemStack hand = player.getItemInHand();
if (hand.getAmount() == 1) {
hand.setType(Material.AIR);
player.setItemInHand(hand);
} else {
hand.setAmount(hand.getAmount() - 1);
}
List<String> locList = new ArrayList<>();
locList.add("-1, 0, -2");
locList.add("-2, 0, -1");
locList.add("-2, 0, 0");
locList.add("-1, 0, 1");
locList.add("0, 0, 1");
locList.add("1, 0, 1");
locList.add("2, 0, 0");
locList.add("2, 0, -1");
locList.add("1, 0, -2");
locList.add("0, 0, 0, ladder2");
locList.add("-1, 1, -2");
locList.add("-2, 1, -1");
locList.add("-2, 1, 0");
locList.add("-1, 1, 1");
locList.add("0, 1, 1");
locList.add("1, 1, 1");
locList.add("2, 1, 0");
locList.add("2, 1, -1");
locList.add("1, 1, -2");
locList.add("0, 1, 0, ladder2");
locList.add("-1, 2, -2");
locList.add("-2, 2, -1");
locList.add("-2, 2, 0");
locList.add("-1, 2, 1");
locList.add("0, 2, 1");
locList.add("1, 2, 1");
locList.add("2, 2, 0");
locList.add("2, 2, -1");
locList.add("1, 2, -2");
locList.add("0, 2, 0, ladder2");
locList.add("0, 3, -2");
locList.add("-1, 3, -2");
locList.add("-2, 3, -1");
locList.add("-2, 3, 0");
locList.add("-1, 3, 1");
locList.add("0, 3, 1");
locList.add("1, 3, 1");
locList.add("2, 3, 0");
locList.add("2, 3, -1");
locList.add("1, 3, -2");
locList.add("0, 3, 0, ladder2");
locList.add("0, 4, -2");
locList.add("-1, 4, -2");
locList.add("-2, 4, -1");
locList.add("-2, 4, 0");
locList.add("-1, 4, 1");
locList.add("0, 4, 1");
locList.add("1, 4, 1");
locList.add("2, 4, 0");
locList.add("2, 4, -1");
locList.add("1, 4, -2");
locList.add("0, 4, 0, ladder2");
locList.add("-2, 5, 1");
locList.add("-2, 5, 0");
locList.add("-2, 5, -1");
locList.add("-2, 5, -2");
locList.add("-1, 5, 1");
locList.add("-1, 5, 0");
locList.add("-1, 5, -1");
locList.add("-1, 5, -2");
locList.add("0, 5, 1");
locList.add("0, 5, -1");
locList.add("0, 5, -2");
locList.add("1, 5, 1");
locList.add("0, 5, 0, ladder2");
locList.add("1, 5, 0");
locList.add("1, 5, -1");
locList.add("1, 5, -2");
locList.add("2, 5, 1");
locList.add("2, 5, 0");
locList.add("2, 5, -1");
locList.add("2, 5, -2");
locList.add("-3, 5, -2");
locList.add("-3, 6, -2");
locList.add("-3, 7, -2");
locList.add("-3, 6, -1");
locList.add("-3, 6, 0");
locList.add("-3, 5, 1");
locList.add("-3, 6, 1");
locList.add("-3, 7, 1");
locList.add("-2, 5, 2");
locList.add("-2, 6, 2");
locList.add("-2, 7, 2");
locList.add("-1, 6, 2");
locList.add("0, 5, 2");
locList.add("0, 6, 2");
locList.add("0, 7, 2");
locList.add("1, 6, 2");
locList.add("2, 5, 2");
locList.add("2, 6, 2");
locList.add("2, 7, 2");
locList.add("3, 5, -2");
locList.add("3, 6, -2");
locList.add("3, 7, -2");
locList.add("3, 6, -1");
locList.add("3, 6, 0");
locList.add("3, 5, 1");
locList.add("3, 6, 1");
locList.add("3, 7, 1");
locList.add("-2, 5, -3");
locList.add("-2, 6, -3");
locList.add("-2, 7, -3");
locList.add("-1, 6, -3");
locList.add("0, 5, -3");
locList.add("0, 6, -3");
locList.add("0, 7, -3");
locList.add("1, 6, -3");
locList.add("2, 5, -3");
locList.add("2, 6, -3");
locList.add("2, 7, -3");
int[] i = { 0 };
this.bukkitTask = Bukkit.getScheduler().runTaskTimer(BedWars.getInstance(), () -> {
location.getWorld().playSound(location, Sound.CHICKEN_EGG_POP, 1f, 0.5f);
if (locList.size() + 1 == i[0] + 1) {
this.bukkitTask.cancel();
return;
}
String string = locList.get(i[0]);
if (string.contains("ladder")) {
int ladderData = Integer.parseInt(string.split("ladder")[1]);
new PlaceTower(block, string, playerTeam, player, true, ladderData);
} else {
new PlaceTower(block, string, playerTeam, player, false, 0);
}
if (locList.size() + 1 == i[0] + 2) {
this.bukkitTask.cancel();
return;
}
String string2 = locList.get(i[0] + 1);
if (string2.contains("ladder")) {
int ladderData = Integer.parseInt(string2.split("ladder")[1]);
new PlaceTower(block, string2, playerTeam, player, true, ladderData);
} else {
new PlaceTower(block, string2, playerTeam, player, false, 0);
}
i[0] = i[0] + 2;
}, 0, 1);
}
}

View File

@ -1,4 +1,171 @@
package rip.tilly.bedwars.customitems.popuptower.types;
import org.bukkit.Bukkit;
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.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.customitems.popuptower.PlaceTower;
import rip.tilly.bedwars.playerdata.PlayerTeam;
import java.util.ArrayList;
import java.util.List;
public class TowerSouth {
private BukkitTask bukkitTask;
public TowerSouth(Location location, Block block, PlayerTeam playerTeam, Player player) {
ItemStack hand = player.getItemInHand();
if (hand.getAmount() == 1) {
hand.setType(Material.AIR);
player.setItemInHand(hand);
} else {
hand.setAmount(hand.getAmount() - 1);
}
List<String> locList = new ArrayList<>();
locList.add("1, 0, 2");
locList.add("2, 0, 1");
locList.add("2, 0, 0");
locList.add("1, 0, -1");
locList.add("0, 0, -1");
locList.add("-1, 0, -1");
locList.add("-2, 0, 0");
locList.add("-2, 0, 1");
locList.add("-1, 0, 2");
locList.add("0, 0, 0, ladder3");
locList.add("1, 1, 2");
locList.add("2, 1, 1");
locList.add("2, 1, 0");
locList.add("1, 1, -1");
locList.add("0, 1, -1");
locList.add("-1, 1, -1");
locList.add("-2, 1, 0");
locList.add("-2, 1, 1");
locList.add("-1, 1, 2");
locList.add("0, 1, 0, ladder3");
locList.add("1, 2, 2");
locList.add("2, 2, 1");
locList.add("2, 2, 0");
locList.add("1, 2, -1");
locList.add("0, 2, -1");
locList.add("-1, 2, -1");
locList.add("-2, 2, 0");
locList.add("-2, 2, 1");
locList.add("-1, 2, 2");
locList.add("0, 2, 0, ladder3");
locList.add("0, 3, 2");
locList.add("1, 3, 2");
locList.add("2, 3, 1");
locList.add("2, 3, 0");
locList.add("1, 3, -1");
locList.add("0, 3, -1");
locList.add("-1, 3, -1");
locList.add("-2, 3, 0");
locList.add("-2, 3, 1");
locList.add("-1, 3, 2");
locList.add("0, 3, 0, ladder3");
locList.add("0, 4, 2");
locList.add("1, 4, 2");
locList.add("2, 4, 1");
locList.add("2, 4, 0");
locList.add("1, 4, -1");
locList.add("0, 4, -1");
locList.add("-1, 4, -1");
locList.add("-2, 4, 0");
locList.add("-2, 4, 1");
locList.add("-1, 4, 2");
locList.add("0, 4, 0, ladder3");
locList.add("2, 5, -1");
locList.add("2, 5, 0");
locList.add("2, 5, 1");
locList.add("2, 5, 2");
locList.add("1, 5, -1");
locList.add("1, 5, 0");
locList.add("1, 5, 1");
locList.add("1, 5, 2");
locList.add("0, 5, -1");
locList.add("0, 5, 1");
locList.add("0, 5, 2");
locList.add("-1, 5, -1");
locList.add("0, 5, 0, ladder3");
locList.add("-1, 5, 0");
locList.add("-1, 5, 1");
locList.add("-1, 5, 2");
locList.add("-2, 5, -1");
locList.add("-2, 5, 0");
locList.add("-2, 5, 1");
locList.add("-2, 5, 2");
locList.add("3, 5, 2");
locList.add("3, 6, 2");
locList.add("3, 7, 2");
locList.add("3, 6, 1");
locList.add("3, 6, 0");
locList.add("3, 5, -1");
locList.add("3, 6, -1");
locList.add("3, 7, -1");
locList.add("2, 5, -2");
locList.add("2, 6, -2");
locList.add("2, 7, -2");
locList.add("1, 6, -2");
locList.add("0, 5, -2");
locList.add("0, 6, -2");
locList.add("0, 7, -2");
locList.add("-1, 6, -2");
locList.add("-2, 5, -2");
locList.add("-2, 6, -2");
locList.add("-2, 7, -2");
locList.add("-3, 5, 2");
locList.add("-3, 6, 2");
locList.add("-3, 7, 2");
locList.add("-3, 6, 1");
locList.add("-3, 6, 0");
locList.add("-3, 5, -1");
locList.add("-3, 6, -1");
locList.add("-3, 7, -1");
locList.add("2, 5, 3");
locList.add("2, 6, 3");
locList.add("2, 7, 3");
locList.add("1, 6, 3");
locList.add("0, 5, 3");
locList.add("0, 6, 3");
locList.add("0, 7, 3");
locList.add("-1, 6, 3");
locList.add("-2, 5, 3");
locList.add("-2, 6, 3");
locList.add("-2, 7, 3");
int[] i = { 0 };
this.bukkitTask = Bukkit.getScheduler().runTaskTimer(BedWars.getInstance(), () -> {
location.getWorld().playSound(location, Sound.CHICKEN_EGG_POP, 1f, 0.5f);
if (locList.size() + 1 == i[0] + 1) {
this.bukkitTask.cancel();
return;
}
String string = locList.get(i[0]);
if (string.contains("ladder")) {
int ladderData = Integer.parseInt(string.split("ladder")[1]);
new PlaceTower(block, string, playerTeam, player, true, ladderData);
} else {
new PlaceTower(block, string, playerTeam, player, false, 0);
}
if (locList.size() + 1 == i[0] + 2) {
this.bukkitTask.cancel();
return;
}
String string2 = locList.get(i[0] + 1);
if (string2.contains("ladder")) {
int ladderData = Integer.parseInt(string2.split("ladder")[1]);
new PlaceTower(block, string2, playerTeam, player, true, ladderData);
} else {
new PlaceTower(block, string2, playerTeam, player, false, 0);
}
i[0] = i[0] + 2;
}, 0, 1);
}
}

View File

@ -139,6 +139,7 @@ public class TowerWest {
locList.add("-3, 5, -2");
locList.add("-3, 6, -2");
locList.add("-3, 7, -2");
int[] i = { 0 };
this.bukkitTask = Bukkit.getScheduler().runTaskTimer(BedWars.getInstance(), () -> {
location.getWorld().playSound(location, Sound.CHICKEN_EGG_POP, 1f, 0.5f);