mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-23 08:39:19 +00:00
refactor: use Guava methods in various places
This commit is contained in:
@@ -19,11 +19,11 @@
|
||||
|
||||
package net.william278.husksync.command;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.william278.husksync.HuskSync;
|
||||
import net.william278.husksync.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class Command extends Node {
|
||||
@NotNull HuskSync plugin) {
|
||||
super(name, aliases, plugin);
|
||||
this.usage = usage;
|
||||
this.additionalPermissions = new HashMap<>();
|
||||
this.additionalPermissions = Maps.newHashMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.william278.husksync.config;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import de.exlll.configlib.Configuration;
|
||||
import de.themoep.minedown.adventure.MineDown;
|
||||
import lombok.AccessLevel;
|
||||
@@ -30,7 +31,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Plugin locale configuration
|
||||
@@ -54,7 +54,7 @@ public class Locales {
|
||||
protected static final String DEFAULT_LOCALE = "en-gb";
|
||||
|
||||
// The raw set of locales loaded from yaml
|
||||
Map<String, String> locales = new TreeMap<>();
|
||||
Map<String, String> locales = Maps.newTreeMap();
|
||||
|
||||
/**
|
||||
* Returns a raw, un-formatted locale loaded from the locales file
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.william278.husksync.config;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import de.exlll.configlib.Comment;
|
||||
import de.exlll.configlib.Configuration;
|
||||
import lombok.AccessLevel;
|
||||
@@ -162,7 +163,7 @@ public class Settings {
|
||||
@Comment("The master set name for the Redis sentinel.")
|
||||
private String master = "";
|
||||
@Comment("List of host:port pairs")
|
||||
private List<String> nodes = new ArrayList<>();
|
||||
private List<String> nodes = Lists.newArrayList();
|
||||
private String password = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.william278.husksync.data;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import de.themoep.minedown.adventure.MineDown;
|
||||
@@ -426,7 +427,7 @@ public class DataSnapshot {
|
||||
private Builder(@NotNull HuskSync plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pinned = false;
|
||||
this.data = new HashMap<>();
|
||||
this.data = Maps.newHashMap();
|
||||
this.timestamp = OffsetDateTime.now();
|
||||
this.id = UUID.randomUUID();
|
||||
this.serverName = plugin.getServerName();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.william278.husksync.database;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import net.william278.husksync.HuskSync;
|
||||
import net.william278.husksync.adapter.DataAdapter;
|
||||
@@ -250,7 +251,7 @@ public class MySqlDatabase extends Database {
|
||||
@Override
|
||||
@NotNull
|
||||
public List<DataSnapshot.Packed> getAllSnapshots(@NotNull User user) {
|
||||
final List<DataSnapshot.Packed> retrievedData = new ArrayList<>();
|
||||
final List<DataSnapshot.Packed> retrievedData = Lists.newArrayList();
|
||||
try (Connection connection = getConnection()) {
|
||||
try (PreparedStatement statement = connection.prepareStatement(formatStatementTables("""
|
||||
SELECT `version_uuid`, `timestamp`, `data`
|
||||
|
||||
Reference in New Issue
Block a user