mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-23 01:27:37 +00:00
Fixes /punishments [player] not actually working
This commit is contained in:
parent
37ac71b6ee
commit
360775bac3
@ -1,14 +1,20 @@
|
|||||||
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.cache.DataUtils;
|
||||||
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;
|
||||||
|
import dev.plex.command.exception.PlayerNotFoundException;
|
||||||
import dev.plex.command.source.RequiredCommandSource;
|
import dev.plex.command.source.RequiredCommandSource;
|
||||||
|
|
||||||
|
import dev.plex.menu.impl.PunishedPlayerMenu;
|
||||||
import dev.plex.menu.impl.PunishmentMenu;
|
import dev.plex.menu.impl.PunishmentMenu;
|
||||||
|
import dev.plex.player.PlexPlayer;
|
||||||
import dev.plex.util.PlexUtils;
|
import dev.plex.util.PlexUtils;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -23,7 +29,23 @@ public class PunishmentsCMD extends PlexCommand
|
|||||||
@Override
|
@Override
|
||||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
new PunishmentMenu().open(playerSender);
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
new PunishmentMenu().open(playerSender);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!DataUtils.hasPlayedBefore(args[0]))
|
||||||
|
{
|
||||||
|
throw new PlayerNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(args[0]);
|
||||||
|
final PlexPlayer player = offlinePlayer.isOnline() ? getOnlinePlexPlayer(args[0]) : getOfflinePlexPlayer(offlinePlayer.getUniqueId());
|
||||||
|
|
||||||
|
new PunishedPlayerMenu(player).open(playerSender);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user