mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-05 17:16:41 +00:00
Migrate (what I could find) legacy component system uses to kyori component system
Create List command Remove fionn command Remove test command Add Mojang Utils Auto add Plex Players back to cache on start if any are online
This commit is contained in:
@ -11,21 +11,20 @@ import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandParameters(description = "Freeze a player on the server", usage = "/<command> <player>")
|
||||
@CommandParameters(name = "freeze", description = "Freeze a player on the server", usage = "/<command> <player>")
|
||||
@CommandPermissions(level = Rank.ADMIN)
|
||||
public class FreezeCMD extends PlexCommand
|
||||
{
|
||||
public FreezeCMD()
|
||||
{
|
||||
super("freeze");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component execute(CommandSender sender, String[] args)
|
||||
@ -36,7 +35,7 @@ public class FreezeCMD extends PlexCommand
|
||||
}
|
||||
Player player = getNonNullPlayer(args[0]);
|
||||
PunishedPlayer punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
|
||||
Punishment punishment = new Punishment(UUID.fromString(punishedPlayer.getUuid()), sender.isConsoleSender() ? null : sender.getPlayer().getUniqueId());
|
||||
Punishment punishment = new Punishment(UUID.fromString(punishedPlayer.getUuid()), getUUID(sender));
|
||||
punishment.setCustomTime(false);
|
||||
punishment.setEndDate(new Date(Instant.now().plusSeconds(10).toEpochMilli()));
|
||||
punishment.setType(PunishmentType.FREEZE);
|
||||
@ -45,11 +44,12 @@ public class FreezeCMD extends PlexCommand
|
||||
|
||||
plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment);
|
||||
PlexUtils.broadcast(tl("frozePlayer", sender.getName(), player.getName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, String[] args)
|
||||
public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
|
||||
{
|
||||
return args.length == 1 ? PlexUtils.getPlayerNameList() : ImmutableList.of();
|
||||
return args.length == 1 && isAdmin(sender) ? PlexUtils.getPlayerNameList() : ImmutableList.of();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user