Simplifies 'if' statements

This commit is contained in:
Fuzzlemann 2017-07-23 14:04:55 +02:00
parent a45f092208
commit 0f14efbc46
7 changed files with 20 additions and 44 deletions

View File

@ -90,10 +90,7 @@ public class KillData {
if (!Objects.equals(this.weapon, other.weapon)) {
return false;
}
if (!Objects.equals(this.victim, other.victim)) {
return false;
}
return true;
return Objects.equals(this.victim, other.victim);
}
@Override

View File

@ -109,10 +109,7 @@ public class SessionData {
if (this.sessionStart != other.sessionStart) {
return false;
}
if (this.sessionEnd != other.sessionEnd) {
return false;
}
return true;
return this.sessionEnd == other.sessionEnd;
}
@Override

View File

@ -84,10 +84,7 @@ public class TPS {
if (Double.doubleToLongBits(this.tps) != Double.doubleToLongBits(other.tps)) {
return false;
}
if (this.players != other.players) {
return false;
}
return true;
return this.players == other.players;
}
@Override

View File

@ -809,10 +809,7 @@ public class UserData {
if (!Objects.equals(this.playerKills, other.playerKills)) {
return false;
}
if (!Objects.equals(this.sessions, other.sessions)) {
return false;
}
return true;
return Objects.equals(this.sessions, other.sessions);
}
/**

View File

@ -1,13 +1,10 @@
package main.java.com.djrapitops.plan.data.additional;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import main.java.com.djrapitops.plan.ui.html.Html;
import java.io.Serializable;
import java.util.*;
/**
* This is an abstract class that can be used to add data from a plugin to the
* "Plugins"-tab of Analysis and Inspect pages.
@ -306,10 +303,7 @@ public abstract class PluginData {
if (!Objects.equals(this.sourcePlugin, other.sourcePlugin)) {
return false;
}
if (!Objects.equals(this.analysisTypes, other.analysisTypes)) {
return false;
}
return true;
return Objects.equals(this.analysisTypes, other.analysisTypes);
}
@Override

View File

@ -5,14 +5,15 @@
*/
package main.java.com.djrapitops.plan.database.tables;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.data.WebUser;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.data.WebUser;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
/**
*
@ -96,8 +97,7 @@ public class SecurityTable extends Table {
while (set.next()) {
String saltedPassHash = set.getString(columnSaltedHash);
int permissionLevel = set.getInt(columnPermLevel);
WebUser info = new WebUser(user, saltedPassHash, permissionLevel);
return info;
return new WebUser(user, saltedPassHash, permissionLevel);
}
return null;
} finally {

View File

@ -1,19 +1,6 @@
package main.java.com.djrapitops.plan.database.tables;
import com.djrapitops.plugin.utilities.player.Fetch;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.database.DBUtils;
@ -22,6 +9,13 @@ import main.java.com.djrapitops.plan.utilities.Benchmark;
import main.java.com.djrapitops.plan.utilities.uuid.UUIDUtility;
import org.bukkit.GameMode;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122