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)) { if (!Objects.equals(this.weapon, other.weapon)) {
return false; return false;
} }
if (!Objects.equals(this.victim, other.victim)) { return Objects.equals(this.victim, other.victim);
return false;
}
return true;
} }
@Override @Override

View File

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

View File

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

View File

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

View File

@ -1,13 +1,10 @@
package main.java.com.djrapitops.plan.data.additional; 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 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 * This is an abstract class that can be used to add data from a plugin to the
* "Plugins"-tab of Analysis and Inspect pages. * "Plugins"-tab of Analysis and Inspect pages.
@ -306,10 +303,7 @@ public abstract class PluginData {
if (!Objects.equals(this.sourcePlugin, other.sourcePlugin)) { if (!Objects.equals(this.sourcePlugin, other.sourcePlugin)) {
return false; return false;
} }
if (!Objects.equals(this.analysisTypes, other.analysisTypes)) { return Objects.equals(this.analysisTypes, other.analysisTypes);
return false;
}
return true;
} }
@Override @Override

View File

@ -5,14 +5,15 @@
*/ */
package main.java.com.djrapitops.plan.database.tables; 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.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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()) { while (set.next()) {
String saltedPassHash = set.getString(columnSaltedHash); String saltedPassHash = set.getString(columnSaltedHash);
int permissionLevel = set.getInt(columnPermLevel); int permissionLevel = set.getInt(columnPermLevel);
WebUser info = new WebUser(user, saltedPassHash, permissionLevel); return new WebUser(user, saltedPassHash, permissionLevel);
return info;
} }
return null; return null;
} finally { } finally {

View File

@ -1,19 +1,6 @@
package main.java.com.djrapitops.plan.database.tables; package main.java.com.djrapitops.plan.database.tables;
import com.djrapitops.plugin.utilities.player.Fetch; 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.Log;
import main.java.com.djrapitops.plan.data.UserData; import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.database.DBUtils; 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 main.java.com.djrapitops.plan.utilities.uuid.UUIDUtility;
import org.bukkit.GameMode; 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 * @author Rsl1122