mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-28 22:46:40 +00:00
Format
This commit is contained in:
@ -1,9 +1,7 @@
|
||||
package dev.plex.util;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
@ -2,6 +2,7 @@ package dev.plex.util;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import dev.plex.Plex;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
@ -9,8 +10,6 @@ import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
|
@ -4,6 +4,14 @@ import dev.plex.Plex;
|
||||
import dev.plex.PlexBase;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.storage.StorageType;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Month;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
@ -17,15 +25,6 @@ import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Month;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PlexUtils implements PlexBase
|
||||
{
|
||||
private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
|
||||
@ -71,18 +70,21 @@ public class PlexUtils implements PlexBase
|
||||
if (Plex.get().getStorageType() == StorageType.MARIADB)
|
||||
{
|
||||
PlexLog.log("Successfully enabled MySQL!");
|
||||
} else if (Plex.get().getStorageType() == StorageType.SQLITE)
|
||||
}
|
||||
else if (Plex.get().getStorageType() == StorageType.SQLITE)
|
||||
{
|
||||
PlexLog.log("Successfully enabled SQLite!");
|
||||
}
|
||||
} catch (SQLException e)
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
if (Plex.get().getMongoConnection().getDatastore() != null)
|
||||
{
|
||||
PlexLog.log("Successfully enabled MongoDB!");
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Plex.get().getMongoConnection().getDatastore() != null)
|
||||
{
|
||||
@ -172,8 +174,9 @@ public class PlexUtils implements PlexBase
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((TextComponent) component).content();
|
||||
} catch (Exception e)
|
||||
return ((TextComponent)component).content();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PlexLog.warn("Unable to get text of component", e.getLocalizedMessage());
|
||||
return "";
|
||||
@ -192,7 +195,8 @@ public class PlexUtils implements PlexBase
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PlexLog.warn("Unable to get text of components", e.getLocalizedMessage());
|
||||
return "";
|
||||
|
@ -5,7 +5,6 @@ import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
import dev.plex.Plex;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
@ -13,7 +12,8 @@ import java.time.ZonedDateTime;
|
||||
|
||||
public class ZonedDateTimeDeserializer implements JsonDeserializer<ZonedDateTime>
|
||||
{
|
||||
private static String TIMEZONE = Plex.get().config.getString("server.timezone");
|
||||
private static final String TIMEZONE = Plex.get().config.getString("server.timezone");
|
||||
|
||||
@Override
|
||||
public ZonedDateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
|
||||
{
|
||||
|
@ -5,13 +5,13 @@ import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import dev.plex.Plex;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
public class ZonedDateTimeSerializer implements JsonSerializer<ZonedDateTime>
|
||||
{
|
||||
private static String TIMEZONE = Plex.get().config.getString("server.timezone");
|
||||
private static final String TIMEZONE = Plex.get().config.getString("server.timezone");
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(ZonedDateTime src, Type typeOfSrc, JsonSerializationContext context)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.event.Listener;
|
||||
|
||||
public abstract class AbstractMenu implements Listener
|
||||
{
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public AbstractMenu(String name)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.plex.util.minimessage;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.Context;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
@ -11,8 +12,6 @@ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SafeMiniMessage
|
||||
{
|
||||
public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().tags(new SafeMiniMessageTagResolver()).build();
|
||||
|
Reference in New Issue
Block a user