diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java index b20ee110f8..9093debfe2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java @@ -39,7 +39,7 @@ enum Tree { REGULAR_TREE(null, TREE, TREE_1277, TREE_1278, TREE_1279, TREE_1280), OAK_TREE(Duration.ofMillis(8500), ObjectID.OAK_TREE, OAK_TREE_4540, OAK_10820), - WILLOW_TREE(Duration.ofMillis(8500), WILLOW, WILLOW_10833, WILLOW_10831), + WILLOW_TREE(Duration.ofMillis(8500), WILLOW, WILLOW_10829, WILLOW_10831, WILLOW_10833), MAPLE_TREE(Duration.ofSeconds(35), ObjectID.MAPLE_TREE, MAPLE_TREE_10832, MAPLE_TREE_36681), TEAK_TREE(Duration.ofMillis(8500), TEAK, TEAK_36686), MAHOGANY_TREE(Duration.ofMillis(8500), MAHOGANY, MAHOGANY_36688), diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index 78e540f859..266a0cce8e 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -33,10 +33,12 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLClassLoader; +import java.util.Map; import java.util.function.Supplier; import lombok.extern.slf4j.Slf4j; import net.runelite.client.RuneLite; import net.runelite.client.ui.RuneLiteSplashScreen; +import net.runelite.http.api.worlds.World; import okhttp3.HttpUrl; @Slf4j @@ -45,11 +47,11 @@ public class ClientLoader implements Supplier private static final String CONFIG_URL = "http://oldschool.runescape.com/jav_config.ws"; private static final String BACKUP_CONFIG_URL = "https://raw.githubusercontent.com/open-osrs/hosting/master/jav_config.ws"; - private static final int NUM_ATTEMPTS = 6; + private static final int NUM_ATTEMPTS = 10; private final ClientUpdateCheckMode updateCheckMode; private Object client = null; - private HostSupplier hostSupplier = new HostSupplier(); + private WorldSupplier worldSupplier = new WorldSupplier(); private RSConfig config; public ClientLoader(ClientUpdateCheckMode updateCheckMode) @@ -129,7 +131,7 @@ public class ClientLoader implements Supplier catch (IOException e) { log.info("Failed to get jav_config from host \"{}\" ({})", url.host(), e.getMessage()); - String host = hostSupplier.get(); + String host = worldSupplier.get().getAddress(); url = url.newBuilder().host(host).build(); err = e; } @@ -141,14 +143,19 @@ public class ClientLoader implements Supplier { RSConfig backupConfig = ClientConfigLoader.fetch(HttpUrl.parse(BACKUP_CONFIG_URL)); - if (Strings.isNullOrEmpty(backupConfig.getCodeBase()) || Strings.isNullOrEmpty(backupConfig.getInitialJar()) || Strings.isNullOrEmpty(backupConfig.getInitialClass())) + if (Strings.isNullOrEmpty(backupConfig.getCodeBase()) || Strings.isNullOrEmpty(backupConfig.getInitialJar()) + || Strings.isNullOrEmpty(backupConfig.getInitialClass()) || Strings.isNullOrEmpty(backupConfig.getRuneLiteWorldParam())) { throw new IOException("Invalid or missing jav_config"); } // Randomize the codebase - String codebase = hostSupplier.get(); - backupConfig.setCodebase("http://" + codebase + "/"); + World world = worldSupplier.get(); + backupConfig.setCodebase("http://" + world.getAddress() + "/"); + + // Update the world applet parameter + Map appletProperties = backupConfig.getAppletProperties(); + appletProperties.put(backupConfig.getRuneLiteWorldParam(), Integer.toString(world.getId())); config = backupConfig; } catch (IOException ex) @@ -215,4 +222,4 @@ public class ClientLoader implements Supplier rs.setStub(new RSAppletStub(config)); return rs; } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/rs/RSConfig.java b/runelite-client/src/main/java/net/runelite/client/rs/RSConfig.java index df6de027ff..415b21b4e0 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/RSConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/RSConfig.java @@ -54,4 +54,9 @@ class RSConfig { return classLoaderProperties.get("initial_class").replace(".class", ""); } + + String getRuneLiteWorldParam() + { + return classLoaderProperties.get("runelite.worldparam"); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/rs/HostSupplier.java b/runelite-client/src/main/java/net/runelite/client/rs/WorldSupplier.java similarity index 79% rename from runelite-client/src/main/java/net/runelite/client/rs/HostSupplier.java rename to runelite-client/src/main/java/net/runelite/client/rs/WorldSupplier.java index 522173ae74..956ce1fbda 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/HostSupplier.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/WorldSupplier.java @@ -40,43 +40,47 @@ import net.runelite.http.api.worlds.WorldClient; import net.runelite.http.api.worlds.WorldType; @Slf4j -class HostSupplier implements Supplier +class WorldSupplier implements Supplier { private final Random random = new Random(System.nanoTime()); - private Queue hosts = new ArrayDeque<>(); + private Queue worlds = new ArrayDeque<>(); @Override - public String get() + public World get() { - if (!hosts.isEmpty()) + if (!worlds.isEmpty()) { - return hosts.poll(); + return worlds.poll(); } try { - List newHosts = new WorldClient(RuneLiteAPI.CLIENT) + List newWorlds = new WorldClient(RuneLiteAPI.CLIENT) .lookupWorlds() .getWorlds() .stream() .filter(w -> w.getTypes().isEmpty() || EnumSet.of(WorldType.MEMBERS).equals(w.getTypes())) - .map(World::getAddress) .collect(Collectors.toList()); - Collections.shuffle(newHosts, random); + Collections.shuffle(newWorlds, random); - hosts.addAll(newHosts.subList(0, 16)); + worlds.addAll(newWorlds.subList(0, 16)); } catch (IOException e) { log.warn("Unable to retrieve world list", e); } - while (hosts.size() < 2) + while (worlds.size() < 2) { - hosts.add("oldschool" + (random.nextInt(50) + 1) + ".runescape.COM"); + int id = random.nextInt(50) + 1; + World world = World.builder() + .id(300 + id) // worlds start at 300 + .address("oldschool" + id + ".runescape.COM") + .build(); + worlds.add(world); } - return hosts.poll(); + return worlds.poll(); } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/MessagePanel.java b/runelite-client/src/main/java/net/runelite/client/ui/components/MessagePanel.java index e1f9d4d56c..79b833fa17 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/MessagePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/MessagePanel.java @@ -52,7 +52,7 @@ public class MessagePanel extends JPanel private final JLabel titleLabel = new JLabel("Welcome to OpenOSRS"); private final JLabel messageArea; - private final JLabel barLabel = new JLabel("Connecting with gameserver (try 1/6)"); + private final JLabel barLabel = new JLabel("Connecting with gameserver (try 1/10)"); private final JProgressBar bar = new JProgressBar(0, 100); @Getter(AccessLevel.NONE)