mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-23 08:39:19 +00:00
refactor: use lombok in a few other places
This commit is contained in:
@@ -36,7 +36,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@@ -155,29 +155,6 @@ public class Locales {
|
||||
return value.toString().replace("__", "_\\_");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String truncateText(@NotNull String string, int truncateAfter) {
|
||||
if (string.isBlank()) {
|
||||
return string;
|
||||
}
|
||||
return string.length() > truncateAfter ? string.substring(0, truncateAfter) + "…" : string;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getNotApplicable() {
|
||||
return getRawLocale("not_applicable").orElse("N/A");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getListJoiner() {
|
||||
return getRawLocale("list_separator").orElse(", ");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getNone() {
|
||||
return getRawLocale("none").orElse("(none)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base list options to use for a paginated chat list
|
||||
*
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.google.common.collect.Maps;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import de.themoep.minedown.adventure.MineDown;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.william278.desertwell.util.Version;
|
||||
import net.william278.husksync.HuskSync;
|
||||
import net.william278.husksync.adapter.Adaptable;
|
||||
@@ -52,6 +54,21 @@ public class DataSnapshot {
|
||||
@SerializedName("id")
|
||||
protected UUID id;
|
||||
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Get whether the snapshot is pinned
|
||||
*
|
||||
* @return Whether the snapshot is pinned
|
||||
*
|
||||
* -- SETTER --
|
||||
* Set whether the snapshot is pinned
|
||||
*
|
||||
* @param pinned Whether the snapshot is pinned
|
||||
*
|
||||
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@SerializedName("pinned")
|
||||
protected boolean pinned;
|
||||
|
||||
@@ -70,6 +87,14 @@ public class DataSnapshot {
|
||||
@SerializedName("platform_type")
|
||||
protected String platformType;
|
||||
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Get the format version of the snapshot (indicating the version of HuskSync that created it)
|
||||
*
|
||||
* @return The format version of the snapshot
|
||||
*
|
||||
*/
|
||||
@Getter
|
||||
@SerializedName("format_version")
|
||||
protected int formatVersion;
|
||||
|
||||
@@ -168,26 +193,6 @@ public class DataSnapshot {
|
||||
return id.toString().substring(0, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether the snapshot is pinned
|
||||
*
|
||||
* @return Whether the snapshot is pinned
|
||||
* @since 3.0
|
||||
*/
|
||||
public boolean isPinned() {
|
||||
return pinned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the snapshot is pinned
|
||||
*
|
||||
* @param pinned Whether the snapshot is pinned
|
||||
* @since 3.0
|
||||
*/
|
||||
public void setPinned(boolean pinned) {
|
||||
this.pinned = pinned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get why the snapshot was created
|
||||
*
|
||||
@@ -255,16 +260,6 @@ public class DataSnapshot {
|
||||
return platformType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the format version of the snapshot (indicating the version of HuskSync that created it)
|
||||
*
|
||||
* @return The format version of the snapshot
|
||||
* @since 3.0
|
||||
*/
|
||||
public int getFormatVersion() {
|
||||
return formatVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* A packed {@link DataSnapshot} that has not been deserialized.
|
||||
*
|
||||
@@ -304,7 +299,6 @@ public class DataSnapshot {
|
||||
);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ApiStatus.Internal
|
||||
public byte[] asBytes(@NotNull HuskSync plugin) throws DataAdapter.AdaptionException {
|
||||
return plugin.getDataAdapter().toBytes(this);
|
||||
|
||||
Reference in New Issue
Block a user