diff --git a/src/de/steamwar/spectatesystem/elements/RPlayer.java b/src/de/steamwar/spectatesystem/elements/RPlayer.java index 49062c6..6f63e9e 100644 --- a/src/de/steamwar/spectatesystem/elements/RPlayer.java +++ b/src/de/steamwar/spectatesystem/elements/RPlayer.java @@ -56,6 +56,14 @@ public class RPlayer extends REntity { connection.sendPacket(new PacketPlayOutEntityEquipment(entity.getId(), EnumItemSlot.FEET, ((EntityPlayer) entity).inventory.armor.get(3))); } + @Override + public void remove(){ + PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, (EntityPlayer) entity); + for(Player player : Bukkit.getOnlinePlayers()) + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet); + super.remove(); + } + private static EntityPlayer createPlayer(UUID uuid, String name){ MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer(); GameProfile gameProfile = new GameProfile(uuid, name); // Change "playername" to the name the NPC should have, max 16 characters. diff --git a/src/de/steamwar/spectatesystem/util/WorldLoader.java b/src/de/steamwar/spectatesystem/util/WorldLoader.java index 88a3352..eb246de 100644 --- a/src/de/steamwar/spectatesystem/util/WorldLoader.java +++ b/src/de/steamwar/spectatesystem/util/WorldLoader.java @@ -37,9 +37,10 @@ public class WorldLoader { private static final World world = Bukkit.getWorlds().get(0); public static void configureForceLoad(){ - for(int cX = Config.ArenaMinX / 16; cX <= Config.ArenaMaxX / 16; cX++){ - for(int cZ = Config.ArenaMinZ / 16; cZ <= Config.ArenaMaxZ / 16; cZ++){ + for(int cX = (int) Math.floor(Config.ArenaMinX / 16.0); cX <= (int) Math.floor(Config.ArenaMaxX / 16.0); cX++){ + for(int cZ = (int) Math.floor(Config.ArenaMinZ / 16.0); cZ <= (int) Math.floor(Config.ArenaMaxZ / 16.0); cZ++){ world.setChunkForceLoaded(cX, cZ, true); + world.loadChunk(cX, cZ, false); } } } @@ -50,8 +51,8 @@ public class WorldLoader { World backupWorld = new WorldCreator(world.getName() + "-backup").createWorld(); int delay = 0; - for(int cX = Config.ArenaMinX / 16; cX <= Config.ArenaMaxX / 16; cX++){ - for(int cZ = Config.ArenaMinZ / 16; cZ <= Config.ArenaMaxZ / 16; cZ++){ + for(int cX = (int) Math.floor(Config.ArenaMinX / 16.0); cX <= (int) Math.floor(Config.ArenaMaxX / 16.0); cX++){ + for(int cZ = (int) Math.floor(Config.ArenaMinZ / 16.0); cZ <= (int) Math.floor(Config.ArenaMaxZ / 16.0); cZ++){ int finalCX = cX; int finalCZ = cZ; Bukkit.getScheduler().runTaskLater(SpectateSystem.get(), () -> reloadChunk(backupWorld, finalCX, finalCZ), delay++);