e
This commit is contained in:
parent
a0a1e79138
commit
e92e1ea23f
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package rip.tilly.bedwars.listeners.game;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.github.paperspigot.Title;
|
||||
@ -57,8 +58,8 @@ public class GameEndListener implements Listener {
|
||||
playerData.setGamesPlayed(playerData.getGamesPlayed() + 1);
|
||||
}));
|
||||
|
||||
for (CustomVillager villager : game.getVillagers()) {
|
||||
villager.die();
|
||||
for (Entity entity : game.getEntitiesToRemove()) {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class GameStartListener implements Listener {
|
||||
game.getActivatedGenerators().add(emeGen);
|
||||
}
|
||||
|
||||
game.spawnVillagers(game.getCopiedArena());
|
||||
game.spawnVillagers();
|
||||
|
||||
Set<Player> gamePlayers = new HashSet<>();
|
||||
game.getTeams().forEach(team -> team.playingPlayers().forEach(player -> {
|
||||
|
Loading…
Reference in New Issue
Block a user