mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-29 06:46:43 +00:00
Code cleanup
This commit is contained in:
@ -69,7 +69,8 @@ public class PlexPlayer
|
||||
this.rank = "";
|
||||
}
|
||||
|
||||
public String displayName() {
|
||||
public String displayName()
|
||||
{
|
||||
return PlainTextComponentSerializer.plainText().serialize(player.displayName());
|
||||
}
|
||||
|
||||
|
@ -68,9 +68,12 @@ public class PunishedPlayer
|
||||
File file = new File(folder, getUuid() + ".json");
|
||||
if (!file.exists())
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -86,24 +89,32 @@ public class PunishedPlayer
|
||||
|
||||
if (isNotEmpty(file))
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
JSONTokener tokener = new JSONTokener(new FileInputStream(file));
|
||||
JSONObject object = new JSONObject(tokener);
|
||||
object.getJSONObject(getUuid()).getJSONArray("punishments").forEach(obj -> {
|
||||
object.getJSONObject(getUuid()).getJSONArray("punishments").forEach(obj ->
|
||||
{
|
||||
Punishment punishment = Punishment.fromJson(obj.toString());
|
||||
punishments.add(punishment);
|
||||
});
|
||||
} catch (FileNotFoundException e) {
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return punishments;
|
||||
}
|
||||
|
||||
private boolean isNotEmpty(File file) {
|
||||
try {
|
||||
private boolean isNotEmpty(File file)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !FileUtils.readFileToString(file, StandardCharsets.UTF_8).trim().isEmpty();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user