This commit is contained in:
Luca
2021-11-23 19:17:19 +01:00
parent a0a1e79138
commit e92e1ea23f
3 changed files with 22 additions and 24 deletions

View File

@ -11,6 +11,7 @@ import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
import org.bukkit.inventory.ItemStack;
import org.github.paperspigot.Title;
import rip.tilly.bedwars.BedWars;
@ -39,8 +40,6 @@ public class Game {
private final Set<Integer> runnables = new HashSet<>();
private final Set<ItemStack> droppedItems = new ConcurrentSet<>();
private final Set<CustomVillager> villagers = new ConcurrentSet<>();
private final List<GameTeam> teams;
private final Arena arena;
private final GameType gameType;
@ -284,28 +283,26 @@ public class Game {
return seconds / 60D;
}
public void spawnVillagers(CopiedArena copiedArena) {
Location teamAshopLoc = copiedArena.getTeamAshop().toBukkitLocation();
WorldServer worldServer = ((CraftWorld) teamAshopLoc.getWorld()).getHandle();
public void spawnVillagers() {
Villager teamAShopVillager = this.copiedArena.getTeamAshop().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamAshop().toBukkitLocation(), Villager.class);
teamAShopVillager.setCustomName(CC.translate("&aItem Shop"));
teamAShopVillager.setCustomNameVisible(true);
CustomVillager teamAshop = new CustomVillager(worldServer, "&aItem Shop");
teamAshop.setLocation(teamAshopLoc.getBlockX(), teamAshopLoc.getBlockY(), teamAshopLoc.getBlockZ(), teamAshopLoc.getYaw(), teamAshopLoc.getPitch());
Villager teamBShopVillager = this.copiedArena.getTeamBshop().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamBshop().toBukkitLocation(), Villager.class);
teamBShopVillager.setCustomName(CC.translate("&aItem Shop"));
teamBShopVillager.setCustomNameVisible(true);
Location teamBshopLoc = copiedArena.getTeamBshop().toBukkitLocation();
CustomVillager teamBshop = new CustomVillager(worldServer, "&aItem Shop");
teamBshop.setLocation(teamBshopLoc.getBlockX(), teamBshopLoc.getBlockY(), teamBshopLoc.getBlockZ(), teamBshopLoc.getYaw(), teamBshopLoc.getPitch());
Villager teamAUpgradesVillager = this.copiedArena.getTeamAupgrades().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamAupgrades().toBukkitLocation(), Villager.class);
teamAUpgradesVillager.setCustomName(CC.translate("&aUpgrades Shop"));
teamAUpgradesVillager.setCustomNameVisible(true);
Location teamAupgradeLoc = copiedArena.getTeamAupgrades().toBukkitLocation();
CustomVillager teamAupgrade = new CustomVillager(worldServer, "&aUpgrades Shop");
teamAupgrade.setLocation(teamAupgradeLoc.getBlockX(), teamAupgradeLoc.getBlockY(), teamAupgradeLoc.getBlockZ(), teamAupgradeLoc.getYaw(), teamAupgradeLoc.getPitch());
Villager teamBUpgradesVillager = this.copiedArena.getTeamBupgrades().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamBupgrades().toBukkitLocation(), Villager.class);
teamBUpgradesVillager.setCustomName(CC.translate("&aUpgrades Shop"));
teamBUpgradesVillager.setCustomNameVisible(true);
Location teamBupgradeLoc = copiedArena.getTeamAupgrades().toBukkitLocation();
CustomVillager teamBupgrade = new CustomVillager(worldServer, "&aUpgrades Shop");
teamBupgrade.setLocation(teamBupgradeLoc.getBlockX(), teamBupgradeLoc.getBlockY(), teamBupgradeLoc.getBlockZ(), teamBupgradeLoc.getYaw(), teamBupgradeLoc.getPitch());
this.villagers.add(teamAshop);
this.villagers.add(teamBshop);
this.villagers.add(teamAupgrade);
this.villagers.add(teamBupgrade);
this.addEntityToRemove(teamAShopVillager);
this.addEntityToRemove(teamBShopVillager);
this.addEntityToRemove(teamAUpgradesVillager);
this.addEntityToRemove(teamBUpgradesVillager);
}
}