Formatting

This commit is contained in:
Telesphoreo 2022-02-22 03:30:23 -06:00
parent 442ab21a6b
commit 553e5c6355
18 changed files with 138 additions and 93 deletions

View File

@ -21,14 +21,13 @@ import dev.plex.storage.StorageType;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import dev.plex.world.CustomWorld; import dev.plex.world.CustomWorld;
import java.util.UUID;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.bstats.bukkit.Metrics; import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.UUID;
@Getter @Getter
@Setter @Setter
public class Plex extends JavaPlugin public class Plex extends JavaPlugin
@ -82,7 +81,8 @@ public class Plex extends JavaPlugin
{ {
PlexUtils.testConnections(); PlexUtils.testConnections();
PlexLog.log("Connected to " + storageType.name().toUpperCase()); PlexLog.log("Connected to " + storageType.name().toUpperCase());
} catch (Exception e) }
catch (Exception e)
{ {
PlexLog.error("Failed to connect to " + storageType.name().toUpperCase()); PlexLog.error("Failed to connect to " + storageType.name().toUpperCase());
e.printStackTrace(); e.printStackTrace();
@ -96,7 +96,8 @@ public class Plex extends JavaPlugin
{ {
redisConnection.getJedis(); redisConnection.getJedis();
PlexLog.log("Connected to Redis!"); PlexLog.log("Connected to Redis!");
} else }
else
{ {
PlexLog.log("Redis is disabled in the configuration file, not connecting."); PlexLog.log("Redis is disabled in the configuration file, not connecting.");
} }
@ -104,7 +105,8 @@ public class Plex extends JavaPlugin
if (storageType == StorageType.MONGODB) if (storageType == StorageType.MONGODB)
{ {
mongoPlayerData = new MongoPlayerData(); mongoPlayerData = new MongoPlayerData();
} else }
else
{ {
sqlPlayerData = new SQLPlayerData(); sqlPlayerData = new SQLPlayerData();
} }
@ -149,7 +151,8 @@ public class Plex extends JavaPlugin
if (mongoPlayerData != null) //back to mongo checking if (mongoPlayerData != null) //back to mongo checking
{ {
mongoPlayerData.update(plexPlayer); //update the player's document mongoPlayerData.update(plexPlayer); //update the player's document
} else if (sqlPlayerData != null) //sql checking }
else if (sqlPlayerData != null) //sql checking
{ {
sqlPlayerData.update(plexPlayer); sqlPlayerData.update(plexPlayer);
} }

View File

@ -436,8 +436,9 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
/** /**
* Converts usage to a component * Converts usage to a component
* * <p>
* s The usage to convert * s The usage to convert
*
* @return A Kyori component stating the usage * @return A Kyori component stating the usage
*/ */
protected Component usage(String s) protected Component usage(String s)

View File

@ -1,7 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.Plex;
import dev.plex.command.PlexCommand; import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;

View File

@ -25,8 +25,9 @@ public class Config extends YamlConfiguration
/** /**
* Creates a config object * Creates a config object
*
* @param plugin The plugin instance * @param plugin The plugin instance
* @param name The file name * @param name The file name
*/ */
public Config(Plex plugin, String name) public Config(Plex plugin, String name)
{ {

View File

@ -27,6 +27,7 @@ public abstract class PunishedPlayerEvent extends PlayerEvent implements Cancell
/** /**
* Creates an event object * Creates an event object
*
* @param punishedPlayer The player who was punished * @param punishedPlayer The player who was punished
* @see PunishedPlayer * @see PunishedPlayer
*/ */

View File

@ -6,6 +6,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
//TODO: Event doesn't look like it is called //TODO: Event doesn't look like it is called
/** /**
* Event that is called when a player is frozen or unfrozen * Event that is called when a player is frozen or unfrozen
*/ */
@ -21,8 +22,9 @@ public class PunishedPlayerFreezeEvent extends PunishedPlayerEvent implements Ca
/** /**
* Creates a new event instance * Creates a new event instance
*
* @param punishedPlayer The player who was punished * @param punishedPlayer The player who was punished
* @param frozen The new frozen status * @param frozen The new frozen status
*/ */
public PunishedPlayerFreezeEvent(PunishedPlayer punishedPlayer, boolean frozen) public PunishedPlayerFreezeEvent(PunishedPlayer punishedPlayer, boolean frozen)
{ {

View File

@ -6,6 +6,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
//TODO: Event doesn't look like it is called //TODO: Event doesn't look like it is called
/** /**
* Event that is called when a player is frozen or unfrozen * Event that is called when a player is frozen or unfrozen
*/ */
@ -21,8 +22,9 @@ public class PunishedPlayerMuteEvent extends PunishedPlayerEvent implements Canc
/** /**
* Creates a new event instance * Creates a new event instance
*
* @param punishedPlayer The player who was punished * @param punishedPlayer The player who was punished
* @param muted The new muted status * @param muted The new muted status
*/ */
public PunishedPlayerMuteEvent(PunishedPlayer punishedPlayer, boolean muted) public PunishedPlayerMuteEvent(PunishedPlayer punishedPlayer, boolean muted)
{ {

View File

@ -6,12 +6,11 @@ import dev.plex.player.PunishedPlayer;
import dev.plex.punishment.PunishmentType; import dev.plex.punishment.PunishmentType;
import dev.plex.util.MojangUtils; import dev.plex.util.MojangUtils;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import java.time.format.DateTimeFormatter;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import java.time.format.DateTimeFormatter;
public class BanListener extends PlexListener public class BanListener extends PlexListener
{ {
private final String banUrl = plugin.config.getString("banning.ban_url"); private final String banUrl = plugin.config.getString("banning.ban_url");

View File

@ -8,6 +8,8 @@ import dev.plex.listener.PlexListener;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
import dev.plex.player.PunishedPlayer; import dev.plex.player.PunishedPlayer;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import java.util.Collections;
import java.util.UUID;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
@ -18,9 +20,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import java.util.Collections;
import java.util.UUID;
public class PlayerListener extends PlexListener public class PlayerListener extends PlexListener
{ {
private final MongoPlayerData mongoPlayerData = plugin.getMongoPlayerData() != null ? plugin.getMongoPlayerData() : null; private final MongoPlayerData mongoPlayerData = plugin.getMongoPlayerData() != null ? plugin.getMongoPlayerData() : null;
@ -38,7 +37,8 @@ public class PlayerListener extends PlexListener
{ {
player.setOp(true); player.setOp(true);
PlexLog.debug("Automatically opped " + player.getName() + " since ranks are enabled."); PlexLog.debug("Automatically opped " + player.getName() + " since ranks are enabled.");
} else if (plugin.getSystem().equalsIgnoreCase("permissions")) }
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{ {
player.setOp(false); player.setOp(false);
PlexLog.debug("Automatically deopped " + player.getName() + " since ranks are disabled."); PlexLog.debug("Automatically deopped " + player.getName() + " since ranks are disabled.");
@ -51,7 +51,8 @@ public class PlayerListener extends PlexListener
plexPlayer.setName(player.getName()); //set the name of the player plexPlayer.setName(player.getName()); //set the name of the player
plexPlayer.setIps(Collections.singletonList(player.getAddress().getAddress().getHostAddress().trim())); //set the arraylist of ips plexPlayer.setIps(Collections.singletonList(player.getAddress().getAddress().getHostAddress().trim())); //set the arraylist of ips
DataUtils.insert(plexPlayer); // insert data in some wack db DataUtils.insert(plexPlayer); // insert data in some wack db
} else }
else
{ {
plexPlayer = DataUtils.getPlayer(player.getUniqueId()); plexPlayer = DataUtils.getPlayer(player.getUniqueId());
} }
@ -62,7 +63,8 @@ public class PlayerListener extends PlexListener
{ {
punishedPlayer = new PunishedPlayer(player.getUniqueId()); punishedPlayer = new PunishedPlayer(player.getUniqueId());
PlayerCache.getPunishedPlayerMap().put(player.getUniqueId(), punishedPlayer); PlayerCache.getPunishedPlayerMap().put(player.getUniqueId(), punishedPlayer);
} else }
else
{ {
punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId()); punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
} }
@ -76,8 +78,8 @@ public class PlayerListener extends PlexListener
{ {
event.joinMessage( event.joinMessage(
Component.text(ChatColor.AQUA + player.getName() + " is ").color(NamedTextColor.AQUA).append(LegacyComponentSerializer.legacyAmpersand().deserialize(loginMessage)) Component.text(ChatColor.AQUA + player.getName() + " is ").color(NamedTextColor.AQUA).append(LegacyComponentSerializer.legacyAmpersand().deserialize(loginMessage))
.append(Component.newline()) .append(Component.newline())
.append(Component.text(player.getName() + " joined the game").color(NamedTextColor.YELLOW)) .append(Component.text(player.getName() + " joined the game").color(NamedTextColor.YELLOW))
); );
} }
} }
@ -96,7 +98,8 @@ public class PlayerListener extends PlexListener
if (mongoPlayerData != null) //back to mongo checking if (mongoPlayerData != null) //back to mongo checking
{ {
mongoPlayerData.update(plexPlayer); //update the player's document mongoPlayerData.update(plexPlayer); //update the player's document
} else if (sqlPlayerData != null) //sql checking }
else if (sqlPlayerData != null) //sql checking
{ {
sqlPlayerData.update(plexPlayer); sqlPlayerData.update(plexPlayer);
} }

View File

@ -3,13 +3,12 @@ package dev.plex.listener.impl;
import com.destroystokyo.paper.event.server.PaperServerListPingEvent; import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import dev.plex.listener.PlexListener; import dev.plex.listener.PlexListener;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import java.util.List;
import java.util.stream.Collectors;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import java.util.List;
import java.util.stream.Collectors;
public class ServerListener extends PlexListener public class ServerListener extends PlexListener
{ {
@EventHandler @EventHandler
@ -27,7 +26,8 @@ public class ServerListener extends PlexListener
motd.append(PlexUtils.randomChatColor()).append(word).append(" "); motd.append(PlexUtils.randomChatColor()).append(word).append(" ");
} }
event.motd(LegacyComponentSerializer.legacyAmpersand().deserialize(motd.toString().trim())); event.motd(LegacyComponentSerializer.legacyAmpersand().deserialize(motd.toString().trim()));
} else }
else
{ {
event.motd(LegacyComponentSerializer.legacyAmpersand().deserialize(baseMotd.trim())); event.motd(LegacyComponentSerializer.legacyAmpersand().deserialize(baseMotd.trim()));
} }

View File

@ -8,6 +8,9 @@ import dev.plex.rank.enums.Rank;
import dev.plex.rank.enums.Title; import dev.plex.rank.enums.Title;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -18,10 +21,6 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
public class WorldListener extends PlexListener public class WorldListener extends PlexListener
{ {
@ -34,15 +33,27 @@ public class WorldListener extends PlexListener
if (plugin.getSystem().equalsIgnoreCase("permissions")) if (plugin.getSystem().equalsIgnoreCase("permissions"))
{ {
String permission = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".permission"); String permission = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".permission");
if (permission == null) return; if (permission == null)
if (player.hasPermission(permission)) return; {
} else if (plugin.getSystem().equalsIgnoreCase("ranks")) return;
}
if (player.hasPermission(permission))
{
return;
}
}
else if (plugin.getSystem().equalsIgnoreCase("ranks"))
{ {
if (plugin.config.contains("worlds." + world.getName().toLowerCase() + ".requiredLevels")) if (plugin.config.contains("worlds." + world.getName().toLowerCase() + ".requiredLevels"))
{ {
@NotNull List<String> requiredLevel = plugin.config.getStringList("worlds." + world.getName().toLowerCase() + ".requiredLevels"); @NotNull List<String> requiredLevel = plugin.config.getStringList("worlds." + world.getName().toLowerCase() + ".requiredLevels");
if (checkLevel(plexPlayer, requiredLevel.toArray(String[]::new))) return; if (checkLevel(plexPlayer, requiredLevel.toArray(String[]::new)))
} else { {
return;
}
}
else
{
return; return;
} }
} }
@ -64,15 +75,27 @@ public class WorldListener extends PlexListener
if (plugin.getSystem().equalsIgnoreCase("permissions")) if (plugin.getSystem().equalsIgnoreCase("permissions"))
{ {
String permission = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".permission"); String permission = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".permission");
if (permission == null) return; if (permission == null)
if (player.hasPermission(permission)) return; {
} else if (plugin.getSystem().equalsIgnoreCase("ranks")) return;
}
if (player.hasPermission(permission))
{
return;
}
}
else if (plugin.getSystem().equalsIgnoreCase("ranks"))
{ {
if (plugin.config.contains("worlds." + world.getName().toLowerCase() + ".requiredLevels")) if (plugin.config.contains("worlds." + world.getName().toLowerCase() + ".requiredLevels"))
{ {
@NotNull List<String> requiredLevel = plugin.config.getStringList("worlds." + world.getName().toLowerCase() + ".requiredLevels"); @NotNull List<String> requiredLevel = plugin.config.getStringList("worlds." + world.getName().toLowerCase() + ".requiredLevels");
if (checkLevel(plexPlayer, requiredLevel.toArray(String[]::new))) return; if (checkLevel(plexPlayer, requiredLevel.toArray(String[]::new)))
} else { {
return;
}
}
else
{
return; return;
} }
} }
@ -121,7 +144,8 @@ public class WorldListener extends PlexListener
return false; return false;
} }
} }
} else if (required.startsWith("Rank")) }
else if (required.startsWith("Rank"))
{ {
String rankString = required.split("\\.")[1]; String rankString = required.split("\\.")[1];
Rank rank = Rank.valueOf(rankString.toUpperCase(Locale.ROOT)); Rank rank = Rank.valueOf(rankString.toUpperCase(Locale.ROOT));

View File

@ -8,16 +8,6 @@ import dev.plex.event.PunishedPlayerFreezeEvent;
import dev.plex.event.PunishedPlayerMuteEvent; import dev.plex.event.PunishedPlayerMuteEvent;
import dev.plex.punishment.Punishment; import dev.plex.punishment.Punishment;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -27,6 +17,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
@Getter @Getter
public class PunishedPlayer extends PlexBase public class PunishedPlayer extends PlexBase
@ -79,7 +78,8 @@ public class PunishedPlayer extends PlexBase
try try
{ {
file.createNewFile(); file.createNewFile();
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
@ -91,7 +91,10 @@ public class PunishedPlayer extends PlexBase
@SneakyThrows @SneakyThrows
public void convertPunishments() public void convertPunishments()
{ {
if (!plugin.getRedisConnection().isEnabled()) return; if (!plugin.getRedisConnection().isEnabled())
{
return;
}
List<Punishment> punishments = Lists.newArrayList(); List<Punishment> punishments = Lists.newArrayList();
File file = getPunishmentsFile(); File file = getPunishmentsFile();
@ -121,7 +124,8 @@ public class PunishedPlayer extends PlexBase
plugin.getRedisConnection().getJedis().set(uuid, obj.toString()); plugin.getRedisConnection().getJedis().set(uuid, obj.toString());
PlexLog.debug("Updated Redis Punishments to match with file"); PlexLog.debug("Updated Redis Punishments to match with file");
} }
} else }
else
{ {
plugin.getRedisConnection().getJedis().set(uuid, obj.toString()); plugin.getRedisConnection().getJedis().set(uuid, obj.toString());
} }
@ -137,9 +141,15 @@ public class PunishedPlayer extends PlexBase
if (plugin.getRedisConnection().isEnabled()) if (plugin.getRedisConnection().isEnabled())
{ {
PlexLog.debug("Getting punishments from Redis..."); PlexLog.debug("Getting punishments from Redis...");
if (!plugin.getRedisConnection().getJedis().exists(uuid)) return punishments; if (!plugin.getRedisConnection().getJedis().exists(uuid))
{
return punishments;
}
String strObj = plugin.getRedisConnection().getJedis().get(uuid); String strObj = plugin.getRedisConnection().getJedis().get(uuid);
if (strObj.isEmpty() || !strObj.startsWith("{")) return punishments; if (strObj.isEmpty() || !strObj.startsWith("{"))
{
return punishments;
}
JSONObject object = new JSONObject(strObj); JSONObject object = new JSONObject(strObj);
object.getJSONObject(uuid).getJSONArray("punishments").forEach(obj -> object.getJSONObject(uuid).getJSONArray("punishments").forEach(obj ->
{ {
@ -169,7 +179,8 @@ public class PunishedPlayer extends PlexBase
Punishment punishment = Punishment.fromJson(obj.toString()); Punishment punishment = Punishment.fromJson(obj.toString());
punishments.add(punishment); punishments.add(punishment);
}); });
} catch (FileNotFoundException e) }
catch (FileNotFoundException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
@ -182,7 +193,8 @@ public class PunishedPlayer extends PlexBase
try try
{ {
return !FileUtils.readFileToString(file, StandardCharsets.UTF_8).trim().isEmpty(); return !FileUtils.readFileToString(file, StandardCharsets.UTF_8).trim().isEmpty();
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -8,13 +8,6 @@ import dev.plex.cache.PlayerCache;
import dev.plex.player.PunishedPlayer; import dev.plex.player.PunishedPlayer;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
import org.json.JSONObject;
import org.json.JSONTokener;
import redis.clients.jedis.Jedis;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileWriter; import java.io.FileWriter;
@ -26,6 +19,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
import org.json.JSONObject;
import org.json.JSONTokener;
import redis.clients.jedis.Jedis;
public class PunishmentManager extends PlexBase public class PunishmentManager extends PlexBase
{ {
@ -51,7 +50,8 @@ public class PunishmentManager extends PlexBase
writer.append(object.toString(8)); writer.append(object.toString(8));
writer.flush(); writer.flush();
writer.close(); writer.close();
} else }
else
{ {
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
Map<String, List<String>> punishments = Maps.newHashMap(); Map<String, List<String>> punishments = Maps.newHashMap();
@ -73,7 +73,8 @@ public class PunishmentManager extends PlexBase
writer.flush(); writer.flush();
writer.close(); writer.close();
} }
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
@ -84,7 +85,8 @@ public class PunishmentManager extends PlexBase
try try
{ {
return !FileUtils.readFileToString(file, StandardCharsets.UTF_8).trim().isEmpty(); return !FileUtils.readFileToString(file, StandardCharsets.UTF_8).trim().isEmpty();
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
@ -120,7 +122,8 @@ public class PunishmentManager extends PlexBase
punishments.add(punishment); punishments.add(punishment);
} }
}); });
} catch (IllegalArgumentException e) }
catch (IllegalArgumentException e)
{ {
} }
@ -161,7 +164,8 @@ public class PunishmentManager extends PlexBase
if (PlayerCache.getPunishedPlayerMap().containsKey(uuid)) if (PlayerCache.getPunishedPlayerMap().containsKey(uuid))
{ {
player = PlayerCache.getPunishedPlayer(uuid); player = PlayerCache.getPunishedPlayer(uuid);
} else }
else
{ {
player = new PunishedPlayer(uuid); player = new PunishedPlayer(uuid);
} }
@ -188,7 +192,8 @@ public class PunishmentManager extends PlexBase
writer.append(object.toString()); writer.append(object.toString());
writer.flush(); writer.flush();
writer.close(); writer.close();
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
@ -224,7 +229,8 @@ public class PunishmentManager extends PlexBase
Bukkit.getLogger().info("Unfroze"); Bukkit.getLogger().info("Unfroze");
} }
}.runTaskLater(Plex.get(), 20 * seconds); }.runTaskLater(Plex.get(), 20 * seconds);
} else if (punishment.getType() == PunishmentType.MUTE) }
else if (punishment.getType() == PunishmentType.MUTE)
{ {
player.setMuted(true); player.setMuted(true);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();

View File

@ -5,17 +5,16 @@ import dev.plex.player.PlexPlayer;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import dev.plex.rank.enums.Title; import dev.plex.rank.enums.Title;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import lombok.SneakyThrows;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.SneakyThrows;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
public class RankManager public class RankManager
{ {
@ -82,7 +81,8 @@ public class RankManager
Title.valueOf(key).setLoginMessage(title.getJSONObject(key).getString("loginMessage")); Title.valueOf(key).setLoginMessage(title.getJSONObject(key).getString("loginMessage"));
Title.valueOf(key).setPrefix(title.getJSONObject(key).getString("prefix")); Title.valueOf(key).setPrefix(title.getJSONObject(key).getString("prefix"));
}); });
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -1,11 +1,5 @@
package dev.plex.rank.enums; package dev.plex.rank.enums;
import com.google.common.collect.Lists;
import java.util.Arrays;
import java.util.List;
import com.google.gson.Gson;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

View File

@ -4,7 +4,6 @@ import dev.plex.Plex;
import dev.plex.punishment.Punishment; import dev.plex.punishment.Punishment;
import dev.plex.services.AbstractService; import dev.plex.services.AbstractService;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;

View File

@ -2,13 +2,6 @@ package dev.plex.util;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer; import com.google.gson.JsonDeserializer;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.Instant; import java.time.Instant;
@ -16,6 +9,12 @@ import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Arrays; import java.util.Arrays;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
public class MojangUtils public class MojangUtils
{ {

View File

@ -9,7 +9,7 @@ server:
- "&cForums: https://forum.plex.us.org" - "&cForums: https://forum.plex.us.org"
titles: titles:
masterbuilders: [] masterbuilders: [ ]
owners: owners:
- Telesphoreo - Telesphoreo