Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.pokepixel.pokedisplay;
- import com.mojang.brigadier.CommandDispatcher;
- import com.mojang.brigadier.exceptions.CommandSyntaxException;
- import com.pixelmonmod.pixelmon.api.command.PixelmonCommandUtils;
- import com.pixelmonmod.pixelmon.api.pokemon.Pokemon;
- import com.pixelmonmod.pixelmon.api.storage.PlayerPartyStorage;
- import com.pixelmonmod.pixelmon.api.storage.StorageProxy;
- import com.pixelmonmod.pixelmon.api.util.helpers.CommandHelper;
- import com.pixelmonmod.pixelmon.command.PixelCommand;
- import net.minecraft.command.CommandException;
- import net.minecraft.command.CommandSource;
- import net.minecraft.entity.player.ServerPlayerEntity;
- import net.minecraft.util.Util;
- import net.minecraft.util.text.StringTextComponent;
- import net.minecraft.util.text.TextFormatting;
- import net.minecraftforge.fml.server.ServerLifecycleHooks;
- import static java.lang.Integer.parseInt;
- public class PokeDisplayCmd extends PixelCommand {
- public PokeDisplayCmd(CommandDispatcher<CommandSource> dispatcher) {
- super(dispatcher, "pokedisplay", "/pokedisplay <slot>", 0);
- }
- @Override
- public void execute(CommandSource commandSource, String[] args) throws CommandException, CommandSyntaxException {
- ServerPlayerEntity hrac = commandSource.asPlayer();
- if (args.length < 1) {
- commandSource.sendErrorMessage(PixelmonCommandUtils.format(TextFormatting.RED, "Pouzij /pokedisplay <slot 1-6>"));
- PixelmonCommandUtils.endCommand(this.getUsage(commandSource));
- }
- if (args.length == 1) {
- int slot2 = parseInt(args[0]);
- if (slot2 > 0 && slot2 < 7) {
- int slot = slot2 - 1;
- PlayerPartyStorage storage = StorageProxy.getParty(hrac);
- Pokemon pokemon = storage.get(slot);
- if (pokemon == null) {
- commandSource.sendErrorMessage(PixelmonCommandUtils.format(TextFormatting.RED, "Pouzij /pokedisplay <slot 1-6>"));
- return;
- }
- else if (!pokemon.isEgg()) {
- for (ServerPlayerEntity player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) {
- player.sendMessage(CommandHelper.getHoverTextPokemon(pokemon), Util.DUMMY_UUID);
- player.sendMessage(new StringTextComponent("Test funkce.."), Util.DUMMY_UUID);
- }
- }
- } else {
- commandSource.sendErrorMessage(PixelmonCommandUtils.format(TextFormatting.RED, "Zadej slot 1-6"));
- }
- }
- if (args.length == 2) {
- commandSource.sendErrorMessage(PixelmonCommandUtils.format(TextFormatting.RED, "Zadej slot 1-6"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement