Skip to content

Commit

Permalink
fix(common): actually set the public-url-format setting
Browse files Browse the repository at this point in the history
  • Loading branch information
yusshu committed Sep 22, 2023
1 parent 05db36b commit ebb706f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface CentralResourcePackServer extends Closeable {

boolean isOpen();

void open(String address, int port) throws IOException;
void open(String address, String publicUrlFormat, int port) throws IOException;

String publicUrlFormat();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private void loadResourcePackServer() {
getLogger().info("Resource-pack server enabled, starting...");

String address = config.address();
String publicUrlFormat = config.publicUrlFormat();
int port = config.port();

// if address is empty, automatically detect the server's address
Expand All @@ -168,7 +169,7 @@ private void loadResourcePackServer() {

if (address != null) {
try {
resourcePackServer.open(address, port);
resourcePackServer.open(address, publicUrlFormat, port);
getLogger().info("Successfully started the resource-pack server, listening on port " + port);
} catch (IOException e) {
getLogger().log(Level.SEVERE, "Failed to open the resource pack server", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;

import static java.util.Objects.requireNonNull;

public final class CommonResourcePackServer implements CentralResourcePackServer, ResourcePackRequestHandler {

private @Nullable ResourcePackServer server;
Expand All @@ -61,12 +59,13 @@ public boolean isOpen() {
}

@Override
public void open(String address, int port) throws IOException {
public void open(String address, String publicUrlFormat, int port) throws IOException {
if (open) {
throw new IllegalStateException("The resource pack server is already open!");
}

this.address = address;
this.publicUrlFormat = publicUrlFormat;
this.port = port;
this.open = true;

Expand Down

0 comments on commit ebb706f

Please sign in to comment.