Ability to disable fetching a list of community servers (#10283)
* Ability to disable fetching a list of community servers * Addressing review comments
This commit is contained in:
@@ -138,7 +138,9 @@ public class JoinDialog extends BaseDialog{
|
||||
|
||||
refreshLocal();
|
||||
refreshRemote();
|
||||
refreshCommunity();
|
||||
if(Core.settings.getBool("communityservers", true)){
|
||||
refreshCommunity();
|
||||
}
|
||||
}
|
||||
|
||||
void setupRemote(){
|
||||
@@ -317,7 +319,9 @@ public class JoinDialog extends BaseDialog{
|
||||
|
||||
section(steam ? "@servers.local.steam" : "@servers.local", local, false);
|
||||
section("@servers.remote", remote, false);
|
||||
section("@servers.global", global, true);
|
||||
if(Core.settings.getBool("communityservers", true)){
|
||||
section("@servers.global", global, true);
|
||||
}
|
||||
|
||||
ScrollPane pane = new ScrollPane(hosts);
|
||||
pane.setFadeScrollBars(false);
|
||||
@@ -631,12 +635,18 @@ public class JoinDialog extends BaseDialog{
|
||||
Core.settings.remove("server-list");
|
||||
}
|
||||
|
||||
var urls = Version.type.equals("bleeding-edge") || Vars.forceBeServers ? serverJsonBeURLs : serverJsonURLs;
|
||||
|
||||
fetchServers(urls, 0);
|
||||
fetchServers();
|
||||
}
|
||||
|
||||
private void fetchServers(String[] urls, int index){
|
||||
public static void fetchServers(){
|
||||
var urls = Version.type.equals("bleeding-edge") || Vars.forceBeServers ? serverJsonBeURLs : serverJsonURLs;
|
||||
|
||||
if(Core.settings.getBool("communityservers", true)){
|
||||
fetchServers(urls, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static void fetchServers(String[] urls, int index){
|
||||
if(index >= urls.length) return;
|
||||
|
||||
//get servers
|
||||
|
||||
@@ -333,6 +333,13 @@ public class SettingsMenuDialog extends BaseDialog{
|
||||
game.checkPref("crashreport", true);
|
||||
}
|
||||
|
||||
game.checkPref("communityservers", true, val -> {
|
||||
defaultServers.clear();
|
||||
if(val){
|
||||
JoinDialog.fetchServers();
|
||||
}
|
||||
});
|
||||
|
||||
game.checkPref("savecreate", true);
|
||||
game.checkPref("blockreplace", true);
|
||||
game.checkPref("conveyorpathfinding", true);
|
||||
|
||||
Reference in New Issue
Block a user