i prefer this

This commit is contained in:
2022-05-19 13:59:16 -05:00
parent a775d258e9
commit 92c07f89fe
43 changed files with 285 additions and 277 deletions

View File

@ -27,8 +27,8 @@ public class GameRuleUtil
private static <T> void readGameRules(World world, String s)
{
String gameRule = s.split(";")[0];
T value = (T)s.split(";")[1];
GameRule<T> rule = (GameRule<T>)GameRule.getByName(gameRule);
T value = (T) s.split(";")[1];
GameRule<T> rule = (GameRule<T>) GameRule.getByName(gameRule);
if (rule != null && check(value).getClass().equals(rule.getType()))
{
world.setGameRule(rule, value);

View File

@ -38,7 +38,7 @@ public class MojangUtils
return null;
}
client.close();
AshconInfo ashconInfo = new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, (JsonDeserializer<ZonedDateTime>)(json1, typeOfT, context) ->
AshconInfo ashconInfo = new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, (JsonDeserializer<ZonedDateTime>) (json1, typeOfT, context) ->
ZonedDateTime.ofInstant(Instant.from(DateTimeFormatter.ISO_INSTANT.parse(json1.getAsJsonPrimitive().getAsString())), ZoneId.of(Plex.get().config.getString("server.timezone")))).create().fromJson(json, AshconInfo.class);
Arrays.sort(ashconInfo.getUsernameHistories(), (o1, o2) ->

View File

@ -35,7 +35,7 @@ public class PlexLog
}
}
Bukkit.getConsoleSender().sendMessage(PlexUtils.mmDeserialize("<red>[Plex Error] <gold>" + message));
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.RED + "[Plex Error] " + ChatColor.GOLD + "%s", message));
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.RED + "[Plex Error] " + ChatColor.GOLD + "%s", message));
}
public static void warn(String message, Object... strings)
@ -47,7 +47,7 @@ public class PlexLog
message = message.replace("{" + i + "}", strings[i].toString());
}
}
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.YELLOW + "[Plex Warning] " + ChatColor.GOLD + "%s", message));
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.YELLOW + "[Plex Warning] " + ChatColor.GOLD + "%s", message));
Bukkit.getConsoleSender().sendMessage(PlexUtils.mmDeserialize("<#eb7c0e>[Plex Warning] <gold>" + message));
}
@ -63,7 +63,7 @@ public class PlexLog
if (Plex.get().config.getBoolean("debug"))
{
Bukkit.getConsoleSender().sendMessage(PlexUtils.mmDeserialize("<dark_purple>[Plex Debug] <gold>" + message));
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.DARK_PURPLE + "[Plex Debug] " + ChatColor.GOLD + "%s", message));
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.DARK_PURPLE + "[Plex Debug] " + ChatColor.GOLD + "%s", message));
}
}
}

View File

@ -2,7 +2,6 @@ package dev.plex.util;
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;
@ -174,7 +173,7 @@ public class PlexUtils implements PlexBase
{
try
{
return ((TextComponent)component).content();
return ((TextComponent) component).content();
}
catch (Exception e)
{

View File

@ -49,7 +49,7 @@ public class ReflectionsUtil
{
if (clazz.getSuperclass() == subType || Arrays.asList(clazz.getInterfaces()).contains(subType))
{
classes.add((Class<? extends T>)clazz);
classes.add((Class<? extends T>) clazz);
}
});
return Collections.unmodifiableSet(classes);

View File

@ -46,7 +46,7 @@ public class UpdateChecker implements PlexBase
{
try
{
HttpURLConnection connection = (HttpURLConnection)new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection();
HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection();
connection.connect();
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND)
{

View File

@ -17,7 +17,7 @@ public class WebUtils
try
{
URL u = new URL(url);
HttpURLConnection connection = (HttpURLConnection)u.openConnection();
HttpURLConnection connection = (HttpURLConnection) u.openConnection();
connection.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
@ -39,13 +39,13 @@ public class WebUtils
public static UUID getFromName(String name)
{
JSONObject profile;
profile = (JSONObject)simpleGET("https://api.ashcon.app/mojang/v2/user/" + name);
profile = (JSONObject) simpleGET("https://api.ashcon.app/mojang/v2/user/" + name);
if (profile == null)
{
PlexLog.error("Profile from Ashcon API returned null!");
return null;
}
String uuidString = (String)profile.get("uuid");
String uuidString = (String) profile.get("uuid");
return UUID.fromString(uuidString);
}
}