mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Reformat
This commit is contained in:
@ -5,7 +5,10 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.Statistic.Type;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
|
@ -84,8 +84,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
||||
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
||||
PlotSquared.debug("&aFast mode UUID caching enabled!");
|
||||
File playerDataFolder =
|
||||
new File(container, world + File.separator + "playerdata");
|
||||
File playerDataFolder = new File(container, world + File.separator + "playerdata");
|
||||
String[] dat = playerDataFolder.list(new DatFileFilter());
|
||||
boolean check = all.isEmpty();
|
||||
if (dat != null) {
|
||||
@ -127,8 +126,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
PlotSquared.debug("Failed to cache: " + all.size()
|
||||
+ " uuids - slowly processing all files");
|
||||
PlotSquared.debug(
|
||||
"Failed to cache: " + all.size() + " uuids - slowly processing all files");
|
||||
}
|
||||
}
|
||||
HashSet<String> worlds1 = Sets.newHashSet(world, "world");
|
||||
@ -137,8 +136,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
File playerDataFolder = null;
|
||||
for (String worldName : worlds1) {
|
||||
// Getting UUIDs
|
||||
playerDataFolder =
|
||||
new File(container, worldName + File.separator + "playerdata");
|
||||
playerDataFolder = new File(container, worldName + File.separator + "playerdata");
|
||||
String[] dat = playerDataFolder.list(new DatFileFilter());
|
||||
if ((dat != null) && (dat.length != 0)) {
|
||||
for (String current : dat) {
|
||||
@ -212,8 +210,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
|
||||
if (getUUIDMap().isEmpty()) {
|
||||
for (OfflinePlotPlayer op : FileUUIDHandler.this.uuidWrapper
|
||||
.getOfflinePlayers()) {
|
||||
for (OfflinePlotPlayer op : FileUUIDHandler.this.uuidWrapper.getOfflinePlayers()) {
|
||||
long last = op.getLastPlayed();
|
||||
if (last != 0) {
|
||||
String name = op.getName();
|
||||
|
@ -73,14 +73,12 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
try {
|
||||
HashBiMap<StringWrapper, UUID> toAdd =
|
||||
HashBiMap.create(new HashMap<>());
|
||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<>());
|
||||
try (PreparedStatement statement = getConnection()
|
||||
.prepareStatement("SELECT `uuid`, `username` FROM `usercache`");
|
||||
ResultSet resultSet = statement.executeQuery()) {
|
||||
while (resultSet.next()) {
|
||||
StringWrapper username =
|
||||
new StringWrapper(resultSet.getString("username"));
|
||||
StringWrapper username = new StringWrapper(resultSet.getString("username"));
|
||||
UUID uuid = UUID.fromString(resultSet.getString("uuid"));
|
||||
toAdd.put(new StringWrapper(username.value), uuid);
|
||||
}
|
||||
@ -99,8 +97,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
return;
|
||||
}
|
||||
FileUUIDHandler fileHandler =
|
||||
new FileUUIDHandler(SQLUUIDHandler.this.uuidWrapper);
|
||||
FileUUIDHandler fileHandler = new FileUUIDHandler(SQLUUIDHandler.this.uuidWrapper);
|
||||
fileHandler.startCaching(() -> {
|
||||
// If the file based UUID handler didn't cache it, then we can't cache offline mode
|
||||
// Also, trying to cache based on files again, is useless as that's what the file based uuid cacher does
|
||||
@ -203,13 +200,12 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
// Ignoring duplicates
|
||||
if (super.add(name, uuid)) {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
try (PreparedStatement statement = getConnection().prepareStatement(
|
||||
"REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) {
|
||||
try (PreparedStatement statement = getConnection()
|
||||
.prepareStatement("REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) {
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, name.toString());
|
||||
statement.execute();
|
||||
PlotSquared
|
||||
.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
PlotSquared.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -230,8 +226,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, name.value);
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.execute();
|
||||
PlotSquared.debug(
|
||||
C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||
PlotSquared
|
||||
.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user