From 55b1a26b6a3d030db72b1fd8e4305d5cfabfcf93 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 12:02:03 +0100 Subject: [PATCH] Update TeamPlayer --- src/de/steamwar/lobby/team/TeamPlayer.java | 48 +++++++--------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/src/de/steamwar/lobby/team/TeamPlayer.java b/src/de/steamwar/lobby/team/TeamPlayer.java index 3b37196..cad19f6 100644 --- a/src/de/steamwar/lobby/team/TeamPlayer.java +++ b/src/de/steamwar/lobby/team/TeamPlayer.java @@ -58,41 +58,23 @@ public class TeamPlayer extends BasicListener { entities.forEach((entity, npc) -> entity.remove()); } + private void forceLoad(World world, boolean setTo) { + for (int x = -10; x < 10; x++) { + for (int z = -10; z < 10; z++) { + world.setChunkForceLoaded(95 + x , 93 + z, setTo); + } + } + } + { - World world = Bukkit.getWorld("Lobby"); - for (int x = -10; x < 10; x++) { - for (int z = -10; z < 10; z++) { - world.setChunkForceLoaded(95 + x , 93 + z, true); - } - } + World world = Bukkit.getWorlds().get(0); + forceLoad(world, true); world.getEntitiesByClasses(Villager.class).forEach(Entity::remove); - for (int x = -10; x < 10; x++) { - for (int z = -10; z < 10; z++) { - world.setChunkForceLoaded(95 + x , 93 + z, true); - } - } - spawnTeamPlayer(world, "AdmiralSeekrank"); - spawnTeamPlayer(world, "SalzgehaltSensei"); - spawnTeamPlayer(world, "Sehfxhler"); - spawnTeamPlayer(world, "Tim7077"); - spawnTeamPlayer(world, "LordMainex"); - spawnTeamPlayer(world, "Lixi266"); - spawnTeamPlayer(world, "PxlPain"); - spawnTeamPlayer(world, "KopFilme"); - spawnTeamPlayer(world, "Lixfel"); - spawnTeamPlayer(world, "Chaoscaot"); - spawnTeamPlayer(world, "YoyoNow"); - spawnTeamPlayer(world, "Zeanon"); - spawnTeamPlayer(world, "zOnlyKroks"); - spawnTeamPlayer(world, "Legula"); - spawnTeamPlayer(world, "xJoul"); - spawnTeamPlayer(world, "Maybe_Creative"); - spawnTeamPlayer(world, "Tim16227"); - spawnTeamPlayer(world, "FoehnX"); - spawnTeamPlayer(world, "_Noerf_"); - spawnTeamPlayer(world, "Edmund_Strong"); - spawnTeamPlayer(world, "TheBreadBeard"); - spawnTeamPlayer(world, "Basic_Redstone"); + forceLoad(world, false); + + SteamwarUser.getServerTeam().forEach(user -> { + spawnTeamPlayer(world, user.getUserName()); + }); Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> { entities.forEach((entity, npc) -> {