Skip to content
This repository has been archived by the owner on Nov 26, 2019. It is now read-only.

The favourites tab needs to be hooked to the USERDATA.dat file #45

Open
IstuntmanI opened this issue Feb 3, 2018 · 6 comments
Open

Comments

@IstuntmanI
Copy link
Contributor

So it will be easier to handle the favourites. It should use the same favourites list as the samp.exe browser. Looks like you already did most of the work for this, but for some reason you forgot to finish it.

Also:

public static SampServer addServerToFavourites(final String address, final Integer port) {
final SampServer server = new SampServer(address, port);
try (final SampQuery query = new SampQuery(server.getAddress(), server.getPort()))
{
query.getBasicServerInfo().ifPresent(serverInfo -> {
server.setPlayers(Integer.parseInt(serverInfo[1]));
server.setMaxPlayers(Integer.parseInt(serverInfo[2]));
server.setHostname(serverInfo[3]);
server.setMode(serverInfo[4]);
server.setLanguage(serverInfo[5]);
});
query.getServersRules().ifPresent(rules -> {
server.setWebsite(rules.get("weburl"));
server.setVersion(rules.get("version"));
});
}
catch (final SocketException | UnknownHostException exception) {
Logging.warn("Error updating server information.", exception);
server.setHostname(UNKNOWN);
server.setLanguage(UNKNOWN);
server.setMode(UNKNOWN);
server.setWebsite(UNKNOWN);
server.setVersion(UNKNOWN);
server.setLagcomp(UNKNOWN);
server.setPlayers(0);
server.setMaxPlayers(0);
}
Logging.info("Adding server to favourites: " + server);
addServerToFavourites(server);
return server;
}

It looks like you should just return without actually calling addServerToFavourites(server); if that exception is caught. If I'm not missing anything.

@Bios-Marcel
Copy link
Owner

Incorrect

@Bios-Marcel
Copy link
Owner

The user can add a server if it cant be pinged. Thats wanted.

@IstuntmanI
Copy link
Contributor Author

Oh. That's what I missed. 😁

@Bios-Marcel
Copy link
Owner

Bios-Marcel commented Feb 17, 2018

Sooo, i don't really want constantly write to / read from the USERDATA.dat file. I have thought about an optional import / export option somewhere. The question is how advanced it should be. i thought about somekind of double list component where you can select servers and drag and drop them into the other list... i dunno, would that be an idea?

Example

@IstuntmanI
Copy link
Contributor Author

That's nice. There should also be "import all" and "export all" buttons. Also, in application's favourite tab you should also be able to drag and drop servers to reorder them.

@Bios-Marcel
Copy link
Owner

You may create a seperate issue for that :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants