a few things

This commit is contained in:
Telesphoreo 2022-02-22 01:11:37 -06:00
parent e23929ee0c
commit 137bc44212
6 changed files with 31 additions and 22 deletions

View File

@ -442,7 +442,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
*/
protected Component usage(String s)
{
return componentFromString(ChatColor.YELLOW + "Correct Usage: " + ChatColor.GRAY + this.getUsage());
return componentFromString(ChatColor.YELLOW + "Correct Usage: " + ChatColor.GRAY + s);
}
protected Player getNonNullPlayer(String name)

View File

@ -7,6 +7,7 @@ import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;
import java.util.List;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.command.CommandSender;
@ -14,9 +15,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@CommandParameters(name = "debug", description = "Debug command", usage = "/<command> <redis-reset> [player]")
@CommandParameters(name = "debug", description = "Debug command", usage = "/<command> redis-reset [player]")
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
public class DebugCMD extends PlexCommand
{
@ -30,15 +29,13 @@ public class DebugCMD extends PlexCommand
if (args[0].equalsIgnoreCase("redis-reset"))
{
Player player = getNonNullPlayer(args[1]);
if (Plex.get().getRedisConnection().getJedis().exists(player.getUniqueId().toString()))
if (plugin.getRedisConnection().getJedis().exists(player.getUniqueId().toString()))
{
Plex.get().getRedisConnection().getJedis().del(player.getUniqueId().toString());
return componentFromString("Successfully reset " + player.getName() + "'s redis punishments!").color(NamedTextColor.YELLOW);
plugin.getRedisConnection().getJedis().del(player.getUniqueId().toString());
return componentFromString("Successfully reset " + player.getName() + "'s Redis punishments!").color(NamedTextColor.YELLOW);
}
return componentFromString("Couldn't find player in redis punishments.");
return componentFromString("Couldn't find player in Redis punishments.");
}
return null;
}

View File

@ -48,7 +48,7 @@ public class TagCMD extends PlexCommand
String prefix = StringUtils.join(args, " ", 1, args.length);
if (ChatColor.stripColor(prefix).length() > plugin.config.getInt("chat.max-tag-length", 16))
{
return componentFromString("The max length for a tag may only be " + plugin.config.getInt("chat.max-tag-length", 16));
return componentFromString("The maximum length for a tag may only be " + plugin.config.getInt("chat.max-tag-length", 16));
}
player.setPrefix(prefix);
return Component.text("Your prefix has been set to ").color(NamedTextColor.AQUA).append(componentFromString(prefix));
@ -68,7 +68,7 @@ public class TagCMD extends PlexCommand
return Component.text("Your prefix has been cleared.").color(NamedTextColor.AQUA);
}
checkRank(sender, Rank.ADMIN, "plex.tag.clearother");
checkRank(sender, Rank.ADMIN, "plex.tag.clear.others");
Player target = getNonNullPlayer(args[1]);
PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId());

View File

@ -8,7 +8,11 @@ import dev.plex.cache.SQLPlayerData;
import dev.plex.listener.PlexListener;
import dev.plex.player.PlexPlayer;
import dev.plex.player.PunishedPlayer;
import dev.plex.rank.enums.Title;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
import java.util.Collections;
import java.util.UUID;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -17,9 +21,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.Collections;
import java.util.UUID;
public class PlayerListener extends PlexListener
{
private final MongoPlayerData mongoPlayerData = plugin.getMongoPlayerData() != null ? plugin.getMongoPlayerData() : null;
@ -37,7 +38,8 @@ public class PlayerListener extends PlexListener
{
player.setOp(true);
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);
PlexLog.debug("Automatically deopped " + player.getName() + " since ranks are disabled.");
@ -50,7 +52,8 @@ public class PlayerListener extends PlexListener
plexPlayer.setName(player.getName()); //set the name of the player
plexPlayer.setIps(Collections.singletonList(player.getAddress().getAddress().getHostAddress().trim())); //set the arraylist of ips
DataUtils.insert(plexPlayer); // insert data in some wack db
} else
}
else
{
plexPlayer = DataUtils.getPlayer(player.getUniqueId());
}
@ -61,7 +64,8 @@ public class PlayerListener extends PlexListener
{
punishedPlayer = new PunishedPlayer(player.getUniqueId());
PlayerCache.getPunishedPlayerMap().put(player.getUniqueId(), punishedPlayer);
} else
}
else
{
punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
}
@ -69,6 +73,11 @@ public class PlayerListener extends PlexListener
assert plexPlayer != null;
if (PlexUtils.DEVELOPERS.contains(plexPlayer.getUuid())) // don't remove or we will front door ur mother
{
PlexUtils.broadcast(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + Title.DEV.getLoginMessage()));
}
if (plugin.getSystem().equalsIgnoreCase("ranks"))
{
if (plugin.getRankManager().isAdmin(plexPlayer))
@ -81,7 +90,8 @@ public class PlayerListener extends PlexListener
if (!plexPlayer.getLoginMSG().isEmpty())
{
event.joinMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + plexPlayer.getLoginMSG()));
} else
}
else
{
event.joinMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(ChatColor.AQUA + player.getName() + " is " + plexPlayer.getRankFromString().getLoginMessage()));
}
@ -103,7 +113,8 @@ public class PlayerListener extends PlexListener
if (mongoPlayerData != null) //back to mongo checking
{
mongoPlayerData.update(plexPlayer); //update the player's document
} else if (sqlPlayerData != null) //sql checking
}
else if (sqlPlayerData != null) //sql checking
{
sqlPlayerData.update(plexPlayer);
}

View File

@ -98,7 +98,7 @@ public class PunishedPlayer extends PlexBase
//Converting from File to Redis
if (isNotEmpty(file))
{
PlexLog.debug("Starting converting punishments from file to redis for " + uuid + "...");
PlexLog.debug("Starting converting punishments from file to Redis for " + uuid + "...");
JSONTokener tokener = new JSONTokener(new FileInputStream(file));
JSONObject object = new JSONObject(tokener);
JSONArray array = object.getJSONObject(getUuid()).getJSONArray("punishments");

View File

@ -10,7 +10,8 @@ server:
titles:
masterbuilders: []
owners: []
owners:
- Telesphoreo
# Ban message is customized in the messages.yml file. The URL to appeal at is below.
banning: