Warning fixes
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
package dev.heliosares.auxprotect.core;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class APLogger {
|
||||
private final Logger logger;
|
||||
|
||||
public APLogger(Logger logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public static void info(String msg) {
|
||||
|
||||
}
|
||||
|
||||
public static void warning(String msg) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class Language {
|
||||
String message = null;
|
||||
try {
|
||||
String name = this.name;
|
||||
if (subcategory != null && subcategory.length() > 0) {
|
||||
if (subcategory != null && !subcategory.isEmpty()) {
|
||||
name += "." + subcategory.toLowerCase();
|
||||
}
|
||||
if (lang != null && !lang.isNull()) {
|
||||
|
||||
@@ -185,7 +185,7 @@ public class Parameters implements Cloneable {
|
||||
parameters.target(targetstr);
|
||||
parameters.data(datastr);
|
||||
|
||||
if (parameters.actions.size() == 0 || parameters.table == null) {
|
||||
if (parameters.actions.isEmpty() || parameters.table == null) {
|
||||
for (EntryAction action : EntryAction.values()) {
|
||||
if (action.getTable() == Table.AUXPROTECT_MAIN
|
||||
&& !APPermission.LOOKUP_ACTION.dot(action.toString().toLowerCase()).hasPermission(sender)) {
|
||||
@@ -206,7 +206,7 @@ public class Parameters implements Cloneable {
|
||||
if (parameters.flags.contains(Flag.ACTIVITY) || parameters.flags.contains(Flag.PLAYTIME)) {
|
||||
if (parameters.users.size() > 1) {
|
||||
throw new ParseException(Language.L.COMMAND__LOOKUP__PLAYTIME__TOOMANYUSERS);
|
||||
} else if (parameters.uids.size() == 0) {
|
||||
} else if (parameters.uids.isEmpty()) {
|
||||
throw new ParseException(Language.L.COMMAND__LOOKUP__PLAYTIME__NOUSER);
|
||||
}
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class Parameters implements Cloneable {
|
||||
parameters.actions.add(EntryAction.MONEY.id);
|
||||
parameters.actions.add(EntryAction.MONEY.idPos);
|
||||
}
|
||||
if (parameters.ratings.size() > 0) {
|
||||
if (!parameters.ratings.isEmpty()) {
|
||||
if (!parameters.actions.isEmpty()) {
|
||||
for (int id : parameters.actions) {
|
||||
if (id != EntryAction.VEIN.id) {
|
||||
@@ -282,7 +282,7 @@ public class Parameters implements Cloneable {
|
||||
if (escape) {
|
||||
build.append('\\');
|
||||
}
|
||||
if (build.length() > 0) {
|
||||
if (!build.isEmpty()) {
|
||||
values.add(build.toString());
|
||||
}
|
||||
return values;
|
||||
@@ -844,7 +844,7 @@ public class Parameters implements Cloneable {
|
||||
if (!exactTime.isEmpty()) {
|
||||
StringBuilder stmt = new StringBuilder();
|
||||
for (Long exact : exactTime) {
|
||||
if (stmt.length() > 0) {
|
||||
if (!stmt.isEmpty()) {
|
||||
stmt.append(" OR ");
|
||||
}
|
||||
stmt.append("time = ").append(exact);
|
||||
@@ -913,10 +913,10 @@ public class Parameters implements Cloneable {
|
||||
|
||||
StringBuilder outsql = new StringBuilder();
|
||||
for (String stmt : stmts) {
|
||||
if (stmt == null || stmt.length() == 0) {
|
||||
if (stmt == null || stmt.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (outsql.length() > 0) {
|
||||
if (!outsql.isEmpty()) {
|
||||
outsql.append(" AND ");
|
||||
}
|
||||
outsql.append("(").append(stmt).append(")");
|
||||
@@ -971,7 +971,7 @@ public class Parameters implements Cloneable {
|
||||
for (String data : datas) {
|
||||
StringBuilder node = new StringBuilder();
|
||||
for (String part : data.split("[*\\-]")) {
|
||||
if (node.length() > 0) {
|
||||
if (!node.isEmpty()) {
|
||||
node.append(".*");
|
||||
}
|
||||
node.append(Pattern.quote(part));
|
||||
|
||||
@@ -189,7 +189,7 @@ public class APCommand extends Command {
|
||||
plugin.runAsync(() -> {
|
||||
String backup;
|
||||
try {
|
||||
backup = plugin.getSqlManager().executeReturn(connection -> plugin.getSqlManager().backup(connection), 30000L, String.class);
|
||||
backup = plugin.getSqlManager().executeReturn(connection -> plugin.getSqlManager().backup(), 30000L, String.class);
|
||||
} catch (Exception e) {
|
||||
plugin.print(e);
|
||||
return;
|
||||
|
||||
@@ -158,7 +158,7 @@ public class DumpCommand extends Command {
|
||||
|
||||
private static String dumpContents(IAuxProtect plugin, String parent, int depth) {
|
||||
StringBuilder build = new StringBuilder();
|
||||
if (parent.length() > 0) {
|
||||
if (!parent.isEmpty()) {
|
||||
build.append(" ".repeat(Math.max(0, depth)));
|
||||
build.append(parent.substring(parent.lastIndexOf(".") + 1)).append(": ");
|
||||
}
|
||||
@@ -169,10 +169,10 @@ public class DumpCommand extends Command {
|
||||
if (plugin.getAPConfig().getConfig().isSection(parent)) {
|
||||
build.append("\n");
|
||||
for (String key : plugin.getAPConfig().getConfig().getKeys(parent, false)) {
|
||||
if (key.length() == 0) {
|
||||
if (key.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
build.append(dumpContents(plugin, parent + (parent.length() > 0 ? "." : "") + key, depth + 2));
|
||||
build.append(dumpContents(plugin, parent + (!parent.isEmpty() ? "." : "") + key, depth + 2));
|
||||
}
|
||||
} else {
|
||||
build.append(plugin.getAPConfig().getConfig().get(parent)).append("\n");
|
||||
@@ -194,9 +194,7 @@ public class DumpCommand extends Command {
|
||||
case "simple" -> simple = true;
|
||||
// case "file" -> file = true;
|
||||
case "config" -> config = true;
|
||||
default -> {
|
||||
throw new SyntaxException();
|
||||
}
|
||||
default -> throw new SyntaxException();
|
||||
}
|
||||
}
|
||||
sender.sendMessageRaw("&aBuilding trace...");
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SQLCommand extends Command {
|
||||
ResultMap results = plugin.getSqlManager().executeGetMap(stmt);
|
||||
StringBuilder line = new StringBuilder();
|
||||
for (String label : results.getLabels()) {
|
||||
if (line.length() > 0) {
|
||||
if (!line.isEmpty()) {
|
||||
line.append(" | ");
|
||||
}
|
||||
line.append(label);
|
||||
@@ -47,7 +47,7 @@ public class SQLCommand extends Command {
|
||||
for (ResultMap.Result result : results.getResults()) {
|
||||
line = new StringBuilder();
|
||||
for (Object part : result.getValues()) {
|
||||
if (line.length() > 0) {
|
||||
if (!line.isEmpty()) {
|
||||
line.append(", ");
|
||||
}
|
||||
line.append(part);
|
||||
|
||||
@@ -535,7 +535,7 @@ public class MigrationManager {
|
||||
}
|
||||
}
|
||||
if (!sql.isMySQL() && needBackup) {
|
||||
String path = sql.backup(connection);
|
||||
String path = sql.backup();
|
||||
if (path != null) plugin.info("Pre-migration database backup created: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class SQLManager extends ConnectionPool {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String backup(Connection connection) throws SQLException {
|
||||
public String backup() {
|
||||
if (isMySQL()) return null;
|
||||
|
||||
File backup = new File(sqliteFile.getParentFile(), "backups/backup-v" + migrationmanager.getVersion() + "-" + System.currentTimeMillis() + ".db");
|
||||
|
||||
@@ -55,7 +55,7 @@ public class XrayEntry extends DbEntry {
|
||||
public void setRating(short rating, @Nullable String rater) {
|
||||
if (rater != null) {
|
||||
String data = getData();
|
||||
if (data.length() > 0) {
|
||||
if (!data.isEmpty()) {
|
||||
data += "; ";
|
||||
}
|
||||
String ratedBy = LocalDateTime.now().format(XrayCommand.ratedByDateFormatter) + ": " + rater + " rated " + rating;
|
||||
|
||||
@@ -168,7 +168,7 @@ public class PlayerListener implements Listener {
|
||||
public void onConsume(PlayerItemConsumeEvent e) {
|
||||
String sup = "";
|
||||
if (e.getItem().getType() == Material.POTION && e.getItem().getItemMeta() instanceof PotionMeta pm) {
|
||||
sup = pm.getBasePotionData().getType().toString().toLowerCase();
|
||||
sup = pm.getBasePotionType().toString().toLowerCase();
|
||||
}
|
||||
DbEntry entry = new DbEntry(AuxProtectSpigot.getLabel(e.getPlayer()), EntryAction.CONSUME, false,
|
||||
e.getPlayer().getLocation(), e.getItem().getType().toString().toLowerCase(), sup);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class InvSerialization {
|
||||
if (i.hasItemMeta()) {
|
||||
return true;
|
||||
}
|
||||
return i.getEnchantments().size() > 0;
|
||||
return !i.getEnchantments().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class StackUtil {
|
||||
|
||||
if (!check.test(thread)) continue;
|
||||
|
||||
if (trace.length() > 0) {
|
||||
if (!trace.isEmpty()) {
|
||||
trace.append("\n\n");
|
||||
}
|
||||
trace.append(thread);
|
||||
|
||||
@@ -113,7 +113,7 @@ public class TimeUtil {
|
||||
time += Double.parseDouble(builder.toString()) * modifier;
|
||||
builder = new StringBuilder();
|
||||
}
|
||||
if (builder.length() > 0) {
|
||||
if (!builder.isEmpty()) {
|
||||
time += Double.parseDouble(builder.toString());
|
||||
}
|
||||
return time;
|
||||
|
||||
Reference in New Issue
Block a user