Skip to content

Commit

Permalink
fix: don't use Apache HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Jun 16, 2024
1 parent a0d3d20 commit 632a80d
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,19 @@
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.BiomeKeys;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.jetbrains.annotations.Nullable;
import xyz.nucleoid.map_templates.*;
import xyz.nucleoid.plasmid.game.GameOpenException;
import xyz.nucleoid.plasmid.game.common.team.GameTeam;

import java.io.IOException;
import java.net.URL;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class SiegeMapLoader {
@Nullable
static final CloseableHttpClient httpClient = loadRemote() ? HttpClients.createDefault() : null;

public static boolean loadRemote() {
return System.getenv().getOrDefault("SIEGE_LOAD_MAPS_FROM_BUILD", "false").equals("true");
}
Expand All @@ -46,17 +41,13 @@ public static SiegeMap load(MinecraftServer server, SiegeMapConfig config) throw
if (loadRemote()) {
Siege.LOGGER.info("Loading map from build server");

assert httpClient != null;

var id = config.templateId();
var uri = String.format(
"https://build.nucleoid.xyz/nucleoid_creator_tools/export/%s/map_templates/%s.nbt",
id.getNamespace(),
id.getPath()
);

var response = httpClient.execute(new HttpGet(uri));
template = MapTemplateSerializer.loadFrom(response.getEntity().getContent());
template = MapTemplateSerializer.loadFrom(new URL(uri).openStream());
} else {
Siege.LOGGER.info("Loading map from resources");
template = MapTemplateSerializer.loadFromResource(server, config.templateId());
Expand Down

0 comments on commit 632a80d

Please sign in to comment.