mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-01 15:46:42 +00:00
Fix a whole bunch of bugs
- Rewrite how bans are handled - Add /unfreeze command - Rename LoginListener to BanListener - Persistent commandspy
This commit is contained in:
@ -15,14 +15,11 @@ import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
@ -20,11 +21,15 @@ public class CommandSpyCMD extends PlexCommand
|
||||
@Override
|
||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args)
|
||||
{
|
||||
PlexPlayer plexPlayer = getPlexPlayer(playerSender);
|
||||
plexPlayer.setCommandSpy(!plexPlayer.isCommandSpy());
|
||||
Component component = Component.text("CommandSpy has been").color(NamedTextColor.GRAY)
|
||||
.append(Component.space())
|
||||
.append(Component.text(plexPlayer.isCommandSpy() ? "enabled." : "disabled.").color(NamedTextColor.GRAY));
|
||||
return component;
|
||||
if (playerSender != null)
|
||||
{
|
||||
PlexPlayer plexPlayer = DataUtils.getPlayer(playerSender.getUniqueId());
|
||||
plexPlayer.setCommandSpy(!plexPlayer.isCommandSpy());
|
||||
DataUtils.update(plexPlayer);
|
||||
return Component.text("CommandSpy has been").color(NamedTextColor.GRAY)
|
||||
.append(Component.space())
|
||||
.append(Component.text(plexPlayer.isCommandSpy() ? "enabled." : "disabled.").color(NamedTextColor.GRAY));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -20,7 +19,7 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@CommandParameters(name = "freeze", description = "Freeze a player on the server", usage = "/<command> <player>")
|
||||
@CommandParameters(name = "freeze", description = "Freeze a player on the server", usage = "/<command> <player>", aliases = "fr")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.freeze")
|
||||
public class FreezeCMD extends PlexCommand
|
||||
{
|
||||
|
@ -10,17 +10,12 @@ import dev.plex.util.AshconInfo;
|
||||
import dev.plex.util.MojangUtils;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -30,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.namehistory")
|
||||
public class NameHistoryCMD extends PlexCommand
|
||||
{
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' HH:mm:ss");
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' hh:mm:ss a");
|
||||
|
||||
@Override
|
||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
||||
@ -44,7 +39,7 @@ public class NameHistoryCMD extends PlexCommand
|
||||
AshconInfo info = MojangUtils.getInfo(username);
|
||||
if (info == null)
|
||||
{
|
||||
return Component.text("Couldn't find this user! Please check if your spelling was correct and this player exists").color(NamedTextColor.RED);
|
||||
return tl("nameHistoryDoesntExist");
|
||||
}
|
||||
PlexLog.debug("NameHistory UUID: " + info.getUuid());
|
||||
PlexLog.debug("NameHistory Size: " + info.getUsernameHistories().length);
|
||||
|
@ -4,7 +4,6 @@ import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -9,14 +9,13 @@ import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.unfreeze")
|
||||
@CommandParameters(name = "unfreeze", description = "Unfreeze a player", usage = "/<command> <player>")
|
||||
public class UnfreezeCMD extends PlexCommand
|
||||
|
Reference in New Issue
Block a user