mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Simplify PlayersTableCreator#getActivityString
Remove @SafeVarargs annotation
This commit is contained in:
parent
b4e1014d59
commit
486a67a013
@ -77,7 +77,6 @@ public class Log {
|
||||
* @param messages All messages to add to the debug log.
|
||||
* @return full debug complex so far.
|
||||
*/
|
||||
@SafeVarargs
|
||||
public static DebugInfo debug(String task, String... messages) {
|
||||
DebugInfo debug = getDebug(task);
|
||||
long time = MiscUtils.getTime();
|
||||
|
@ -27,11 +27,11 @@ public class Select extends SqlParser {
|
||||
|
||||
public Select where(String... conditions) {
|
||||
append(" WHERE ");
|
||||
for (int i = 0; i < conditions.length; i++) {
|
||||
for (String condition : conditions) {
|
||||
if (this.conditions > 0) {
|
||||
append(" AND ");
|
||||
}
|
||||
append("(").append(conditions[i]).append(")");
|
||||
append("(").append(condition).append(")");
|
||||
this.conditions++;
|
||||
}
|
||||
return this;
|
||||
|
@ -66,9 +66,14 @@ public class PlayersTableCreator {
|
||||
}
|
||||
|
||||
private static String getActivityString(boolean isBanned, boolean isUnknown, boolean isActive) {
|
||||
return isBanned ? "Banned"
|
||||
: (isUnknown ? "Unknown"
|
||||
: (isActive ? "Active"
|
||||
: "Inactive"));
|
||||
if (isBanned) {
|
||||
return "Banned";
|
||||
}
|
||||
|
||||
if (isUnknown) {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
return isActive ? "Active" : "Inactive";
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,7 @@ public class DumpLog {
|
||||
* @param header The name of the header
|
||||
*/
|
||||
public void addHeader(String header) {
|
||||
addLine("");
|
||||
addLine("--- " + header + " ---");
|
||||
addLines("", "--- " + header + " ---");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,5 +74,4 @@ public class SettingsTest {
|
||||
public void testGetPath() {
|
||||
assertEquals("Settings.WebServer.Enabled", Settings.WEBSERVER_ENABLED.getPath());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -106,14 +106,11 @@ public class DataCacheQueueTest {
|
||||
public void testGetQueue_cache() {
|
||||
List<Integer> calls = new ArrayList<>();
|
||||
List<Integer> errors = new ArrayList<>();
|
||||
handler.getUserDataForProcessing(new DBCallableProcessor() {
|
||||
@Override
|
||||
public void process(UserData data) {
|
||||
if (data.equals(data1)) {
|
||||
calls.add(1);
|
||||
} else {
|
||||
errors.add(1);
|
||||
}
|
||||
handler.getUserDataForProcessing(data -> {
|
||||
if (data.equals(data1)) {
|
||||
calls.add(1);
|
||||
} else {
|
||||
errors.add(1);
|
||||
}
|
||||
}, uuid1);
|
||||
while (calls.size() < 1) {
|
||||
@ -131,14 +128,11 @@ public class DataCacheQueueTest {
|
||||
public void testGetQueue_dontCache() {
|
||||
List<Integer> getCalls = new ArrayList<>();
|
||||
List<Integer> errors = new ArrayList<>();
|
||||
handler.getUserDataForProcessing(new DBCallableProcessor() {
|
||||
@Override
|
||||
public void process(UserData data) {
|
||||
if (data.equals(data1)) {
|
||||
getCalls.add(1);
|
||||
} else {
|
||||
errors.add(1);
|
||||
}
|
||||
handler.getUserDataForProcessing(data -> {
|
||||
if (data.equals(data1)) {
|
||||
getCalls.add(1);
|
||||
} else {
|
||||
errors.add(1);
|
||||
}
|
||||
}, uuid1, false);
|
||||
while (getCalls.size() < 1) {
|
||||
|
@ -10,6 +10,7 @@ import org.junit.Test;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -46,7 +47,7 @@ public class MathUtilsTest {
|
||||
*/
|
||||
@Test
|
||||
public void testAverageIntEmpty() {
|
||||
List<Integer> l = new ArrayList<>();
|
||||
List<Integer> l = Collections.emptyList();
|
||||
double exp = 0;
|
||||
double result = MathUtils.averageInt(l.stream());
|
||||
assertTrue(result + "/" + exp, Double.compare(exp, result) == 0);
|
||||
|
@ -46,7 +46,6 @@ public class HastebinTest {
|
||||
/* Ignored */
|
||||
}
|
||||
|
||||
Log.info(link);
|
||||
testLink.set(link);
|
||||
});
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class TestInit {
|
||||
|
||||
@Override
|
||||
public ITask runTask() {
|
||||
new Thread(() -> runnable.run()).start();
|
||||
new Thread(runnable::run).start();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user