@SuppressWarnings("unchecked") public void sendUpdates(MinecraftServer server) { if (mapsToUpdate.isEmpty()) return; MapUpdatesEvent evt = new MapUpdatesEvent(); evt.mapIds.addAll(mapsToUpdate); mapsToUpdate.clear(); evt.sendToPlayers(server.getConfigurationManager().playerEntityList); }
@ForgeSubscribe public void onMapUpdates(MapUpdatesEvent evt) { World world = getPlayerWorld(evt.player); Set<Integer> mapsToUpdate = Sets.newHashSet(); for (Integer mapId : evt.mapIds) { HeightMapData map = getMapData(world, mapId); if (map != null) mapsToUpdate.add(mapId); } if (!mapsToUpdate.isEmpty()) { MapDataRequestEvent request = new MapDataRequestEvent(); request.mapIds = Lists.newArrayList(mapsToUpdate); evt.reply(request); } }