Apply suggestions from code review

Co-authored-by: CyB3RC0nN0R <kske@outlook.de>
This commit is contained in:
delvh
2020-08-23 13:39:31 +02:00
parent c784ebb787
commit ddbf9acd07
9 changed files with 73 additions and 107 deletions

View File

@ -32,9 +32,9 @@ public final class ClientConfig extends Config {
private ClientConfig() {
super(".envoy");
put("server", "s", identity(), true);
put("port", "p", Integer::parseInt, true);
put("localDB", "db", File::new, true);
put("server", "s", identity());
put("port", "p", Integer::parseInt);
put("localDB", "db", File::new);
put("ignoreLocalDB", "nodb", Boolean::parseBoolean);
put("user", "u", identity());
put("password", "pw", identity());
@ -62,10 +62,7 @@ public final class ClientConfig extends Config {
* @return {@code true} if the local database is to be ignored
* @since Envoy Client v0.3-alpha
*/
public Boolean isIgnoreLocalDB() {
final var ignoreLocalDB = items.get("ignoreLocalDB").get();
return ignoreLocalDB != null && (Boolean) ignoreLocalDB;
}
public Boolean isIgnoreLocalDB() { return (Boolean) items.get("ignoreLocalDB").get(); }
/**
* @return the user name

View File

@ -164,11 +164,11 @@ public final class Client implements Closeable {
// Process ProfilePicChanges
receiver.registerProcessor(ProfilePicChange.class, eventBus::dispatch);
// Process requests to not send anymore attachments as they will not be shown to
// Process requests to not send any more attachments as they will not be shown to
// other users
receiver.registerProcessor(NoAttachments.class, eventBus::dispatch);
// Process group creation rejections - they have been disabled on the server
// Process group creation results - they might have been disabled on the server
receiver.registerProcessor(GroupCreationResult.class, eventBus::dispatch);
// Send event

View File

@ -67,7 +67,7 @@ public final class Receiver extends Thread {
// Catch LV encoding errors
if (len != bytesRead) {
// Server has stopped sending, i.e. because he went offline
if (len == 0 && bytesRead == -1) {
if (bytesRead == -1) {
isAlive = false;
logger.log(Level.INFO, "Lost connection to the server. Exiting receiver...");
continue;

View File

@ -132,7 +132,6 @@ public final class ChatScene implements Restorable {
private AudioRecorder recorder;
private boolean recording;
private Attachment pendingAttachment;
private boolean postingPermanentlyDisabled;
private final SystemCommandsMap messageTextAreaCommands = new SystemCommandsMap();