🅱️an glowup

This commit is contained in:
Telesphoreo 2022-02-04 14:13:56 -06:00
parent 140f298018
commit dbf95441dc
6 changed files with 32 additions and 17 deletions

View File

@ -97,6 +97,7 @@ public class Plex extends JavaPlugin
if (redisConnection.isEnabled())
{
redisConnection.getJedis();
PlexLog.log("Connected to Redis!");
}
else
{

View File

@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@CommandPermissions(level = Rank.OP, permission = "plex.plex", source = RequiredCommandSource.ANY)
@CommandParameters(name = "plex", usage = "/<command> [reload]", aliases = "plexhelp", description = "Show information about Plex or reload it")
@CommandParameters(name = "plex", usage = "/<command> [reload | redis]", aliases = "plexhelp", description = "Show information about Plex or reload it")
public class PlexCMD extends PlexCommand
{
@Override
@ -26,8 +26,8 @@ public class PlexCMD extends PlexCommand
{
if (args.length == 0)
{
send(sender, ChatColor.LIGHT_PURPLE + "Plex. The long awaited TotalFreedomMod rewrite starts here...");
return componentFromString(ChatColor.LIGHT_PURPLE + "Plugin version: " + ChatColor.GOLD + "1.0");
send(sender, ChatColor.LIGHT_PURPLE + "Plex - A new freedom plugin.");
return componentFromString(ChatColor.LIGHT_PURPLE + "Plugin version: " + ChatColor.GOLD + plugin.getDescription().getVersion());
}
if (args[0].equalsIgnoreCase("reload"))
{

View File

@ -1,32 +1,42 @@
package dev.plex.listener.impl;
import dev.plex.cache.DataUtils;
import dev.plex.listener.PlexListener;
import dev.plex.player.PlexPlayer;
import dev.plex.player.PunishedPlayer;
import dev.plex.punishment.Punishment;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
public class LoginListener extends PlexListener
{
private final String banMessage = plugin.config.getString("banning.message");
private final String banUrl = plugin.config.getString("banning.ban_url");
@EventHandler
public void onPreLogin(AsyncPlayerPreLoginEvent event)
{
if (plugin.getBanManager().isBanned(event.getUniqueId()))
{
PunishedPlayer player = new PunishedPlayer(event.getUniqueId());
Punishment punishment = player.getPunishments().get(player.getPunishments().size() - 1);
PlexLog.debug("This player is banned. Outputting information:");
PlexLog.debug("UUID: " + player.getUuid());
PlexLog.debug("Username: " + punishment.getPunishedUsername());
PlexLog.debug("Punisher: " + punishment.getPunisher());
PlexLog.debug("Reason: " + punishment.getReason());
PlexLog.debug("End date: " + punishment.getEndDate());
PlexLog.debug("IPs: " + punishment.getIPS());
PlexLog.debug("Type: " + punishment.getType());
PunishedPlayer punishedPlayer = new PunishedPlayer(event.getUniqueId());
Punishment punishment = punishedPlayer.getPunishments().get(punishedPlayer.getPunishments().size() - 1);
String banMessage;
if (punishment.getPunisher() == null)
{
banMessage = PlexUtils.tl("banMessage", banUrl, punishment.getReason(),
punishment.getEndDate(), "CONSOLE");
}
else
{
PlexPlayer player = DataUtils.getPlayer(punishment.getPunisher());
banMessage = PlexUtils.tl("banMessage", banUrl, punishment.getReason(),
punishment.getEndDate(), player.getName());
}
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED,
LegacyComponentSerializer.legacyAmpersand().deserialize(banMessage));
}

View File

@ -50,7 +50,6 @@ public class RedisConnection extends PlexBase
{
jedis.auth(plugin.config.getString("data.side.password"));
}
PlexLog.log("Connected to Redis!");
return jedis;
}
catch (Exception ex)

View File

@ -6,9 +6,9 @@ server:
motd: "%servername% - Minecraft %mcversion%"
colorize_motd: true
# Ban message is customized here. Additional messages can be configured in messages.yml
# Ban message is customized in the messages.yml file. The URL to appeal at is below.
banning:
message: "&cYou are banned! Please appeal on the forums at https://forum.plex.us.org/"
ban_url: "https://forum.plex.us.org"
# Settings for commands relating to Plex

View File

@ -19,6 +19,11 @@ errorColor: "c"
# Broadcast color <b> - this will make the color of the message the broadcast color defined above.
# Error color <e> - this will make the color of the message the error color defined above.
# 1: Appeal URL
# 2: Reason
# 3: Expiry
# 4: Punisher
banMessage: "&cYou have been banned! You may appeal at &6<v>.\n&cReason: &6<v>\n&cEnd date: &6<v>\n&cBanned by: &6<v>"
test: "this is a test message!"
# 1: the command sender's username
variableTest: "variable test with <v>!"