Проблема с командой и блоком

Версия Minecraft
1.12.2
API
Forge
У меня есть тайл блока

Java:
package pk.blocks.bariblock;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityEnderPearl;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.server.management.PlayerChunkMapEntry;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import pk.blocks.Bari;
import pk.blocks.BasisTileBlock;
import pk.command.CommandTeam;
import pk.init.BlocksInit;
import software.bernie.geckolib3.core.IAnimatable;
import software.bernie.geckolib3.core.PlayState;
import software.bernie.geckolib3.core.builder.AnimationBuilder;
import software.bernie.geckolib3.core.controller.AnimationController;
import software.bernie.geckolib3.core.event.predicate.AnimationEvent;
import software.bernie.geckolib3.core.manager.AnimationData;
import software.bernie.geckolib3.core.manager.AnimationFactory;

import java.util.*;

public class BariStaffBlockTile extends BasisTileBlock implements ITickable, IAnimatable {
    private final AnimationFactory manager = new AnimationFactory(this);
    private String pplayer;
    private double ppos;
    private float timed;

    CommandTeam commandTeam = new CommandTeam();
    Map<String, List<String>> teams = commandTeam.getTeams();

    @SuppressWarnings("unchecked")
    public <E extends BariStaffBlockTile & IAnimatable> PlayState predicate(AnimationEvent<E> e) {
        e.getController().setAnimation(new AnimationBuilder().addAnimation("baristaffblock", true));
        return PlayState.CONTINUE;
    }

    @Override public void registerControllers(AnimationData data) {
        data.addAnimationController(new AnimationController<BariStaffBlockTile>(this, "controller", 0, this::predicate));
    }
    @Override public AnimationFactory getFactory() { return manager; }

    public void setPlayer(String s) {setPplayer(s);}
    public String getPlayer() {return getPplayer();}


    public void createHollowCustomBlockSphere(World world, BlockPos centerPos, int radius) {
        for (int x = centerPos.getX() - radius; x <= centerPos.getX() + radius; x++) {
            for (int y = centerPos.getY() - radius; y <= centerPos.getY() + radius; y++) {
                for (int z = centerPos.getZ() - radius; z <= centerPos.getZ() + radius; z++) {
                    BlockPos currentPos = new BlockPos(x, y, z);
                    double distanceSq = centerPos.distanceSq(currentPos);
                    if (distanceSq <= radius * radius && distanceSq >= (radius - 1) * (radius - 1)) {
                        if (world.isAirBlock(currentPos)) { // Проверка на пустоту блока
                            world.setBlockState(currentPos, BlocksInit.BARI.getDefaultState());
                        }
                    }
                }
            }
        }
    }

    public String getPlayerTeam(String playerName) {
        for (Map.Entry<String, List<String>> entry : teams.entrySet()) {
            if (entry.getValue().contains(playerName)) {
                return entry.getKey();
            }
        }
        return null;
    }
    public List getTeamPlayers(String teamName) {
        return teams.getOrDefault(teamName, new ArrayList<>());
    }



    @Override
    public void update() {
        int radius = 7; // Радиус круга
        Minecraft mc = Minecraft.getMinecraft();
        double centerX = pos.getX() + 0.5;
        double centerY = pos.getY() + 0.5;
        double centerZ = pos.getZ() + 0.5;
        AxisAlignedBB area = new AxisAlignedBB(
                centerX - radius, centerY - radius, centerZ - radius,
                centerX + radius, centerY + radius, centerZ + radius
        );
        List<Entity> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, area);
        List<Entity> proj = world.getEntitiesWithinAABB(Entity.class, area);
        for (Entity entity : proj) {
            if(entity instanceof IProjectile || entity instanceof EntityFishHook || entity instanceof EntityFireball) {
                double motionX = entity.posX - centerX;
                double motionY = entity.posY - centerY;
                double motionZ = entity.posZ - centerZ;
                double distance = Math.sqrt(motionX * motionX + motionY * motionY + motionZ * motionZ);

                motionX /= distance;
                motionY /= distance;
                motionZ /= distance;

                double knockbackStrength = 1.0;

                entity.addVelocity(motionX * knockbackStrength, motionY * knockbackStrength, motionZ * knockbackStrength);
                entity.velocityChanged = true;
                if (world instanceof WorldServer) {
                    ((WorldServer) world).spawnParticle(EnumParticleTypes.END_ROD, entity.posX, entity.posY + 0.5, entity.posZ, 3, 0.2, 0.2, 0.2, 0.0001, new int[0]);
                }
                timed++;
                if(entity instanceof EntityArrow && timed >= 50) {
                    if (entity.isEntityAlive()) {
                        entity.setDead();
                        timed = 0;
                    }
                }
            }
        }
        for (Entity entity : entities) {
            if (entity instanceof EntityLiving){

                double motionX = entity.posX - centerX;
                double motionY = entity.posY - centerY;
                double motionZ = entity.posZ - centerZ;
                double distance = Math.sqrt(motionX * motionX + motionY * motionY + motionZ * motionZ);

                motionX /= distance;
                motionY /= distance;
                motionZ /= distance;

                double knockbackStrength = 1.0;

                entity.addVelocity(motionX * knockbackStrength, motionY * knockbackStrength, motionZ * knockbackStrength);
                entity.velocityChanged = true;
                if (world instanceof WorldServer) {
                    ((WorldServer) world).spawnParticle(EnumParticleTypes.END_ROD, entity.posX, entity.posY + 0.5, entity.posZ, 10, 0.35, 0.4, 0.35, 0.0001, new int[0]);
                }
            }
            if (entity instanceof EntityPlayer) {
                EntityPlayer player = (EntityPlayer) entity;
                if (world instanceof WorldServer && !player.getName().equals(getPplayer())) {
                    player.velocityChanged = true;
                    double motionX = entity.posX - centerX;
                    double motionY = entity.posY - centerY;
                    double motionZ = entity.posZ - centerZ;
                    double distance = Math.sqrt(motionX * motionX + motionY * motionY + motionZ * motionZ);

                    motionX /= distance;
                    motionY /= distance;
                    motionZ /= distance;

                    double knockbackStrength = 1.0;

                    entity.motionX = motionX * knockbackStrength;
                    entity.motionY = motionY * knockbackStrength;
                    entity.motionZ = motionZ * knockbackStrength;

                    if (world instanceof WorldServer) {
                        ((WorldServer) world).spawnParticle(EnumParticleTypes.END_ROD, entity.posX, entity.posY + 0.5, entity.posZ, 10, 0.35, 0.5, 0.35, 0.0001, new int[0]);
                    }
                }
            }
        }

        createHollowCustomBlockSphere(world, pos, radius);
        dispatchTEToNearbyPlayers(world, pos);
    }
    public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
        TileEntity tile = world.getTileEntity(pos);
        if(tile != null) dispatchTEToNearbyPlayers(tile);
    }
    public static void dispatchTEToNearbyPlayers(TileEntity tile) {
        SPacketUpdateTileEntity packet = tile.getUpdatePacket();
        if(packet != null && tile.getWorld() instanceof WorldServer) {
            PlayerChunkMapEntry chunk = ((WorldServer) tile.getWorld()).getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
            if(chunk != null) chunk.sendPacket(packet);
        }
    }

    public String getPplayer() { return pplayer; }
    public void setPplayer(String pplayer) { this.pplayer = pplayer; }

    @Override public void readPacketNBT(NBTTagCompound nbt) {
        pplayer = nbt.getString("pplayer");

    }

    @Override public void writePacketNBT(NBTTagCompound nbt) {
        if(pplayer != null) nbt.setString("pplayer", pplayer);
    }
}
и есть кастомная команда

Java:
package pk.command;

import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.config.Configuration;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CommandTeam extends CommandBase {
    public Configuration config;
    public Map<String, List<String>> teams = new HashMap<>();

    @Override
    public String getName() {
        return "pkteam";
    }

    @Override
    public String getUsage(ICommandSender sender) {
        return "/pkteam <create (teamname) / add/del (playername) (teamname) / delteam (teamname)>";
    }

    public Map<String, List<String>> getTeams() {
        return teams;
    }

    public String getPlayerTeam(String playerName) {
        for (Map.Entry<String, List<String>> entry : teams.entrySet()) {
            if (entry.getValue().contains(playerName)) {
                return entry.getKey();
            }
        }
        return null;
    }
    public List getTeamPlayers(String teamName) {
        return teams.getOrDefault(teamName, new ArrayList<>());
    }

    @Override
    public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
        if (sender instanceof EntityPlayerMP) {
            EntityPlayerMP player = (EntityPlayerMP) sender;
            String playerName = player.getName();
            if (args.length < 1) {
                throw new WrongUsageException(getUsage(sender));
            }


            String subCommand = args[0];
            String teamName = args[1];
            switch (subCommand) {
                case "create":
                    if (teams.containsKey(playerName)) {
                        sender.sendMessage(new TextComponentString("You are already a member of a team!"));
                    } else {
                        boolean playerExists = false;
                        for (Map.Entry<String, List<String>> entry : teams.entrySet()) {
                            if (entry.getValue().contains(playerName)) {
                                playerExists = true; break;
                            }
                        } if (playerExists) {
                            sender.sendMessage(new TextComponentString("You are already a member of a team!"));
                        } else if (teams.containsKey(teamName)) {
                            sender.sendMessage(new TextComponentString("Team with name " + teamName + " already exists! Please choose a different name."));
                        } else {
                            teams.put(teamName, new ArrayList<>()); teams.get(teamName).add(playerName);
                            sender.sendMessage(new TextComponentString("Team " + teamName + " created!"));
                        }
                    }
                    break;
                case "add":
                    if (args.length < 3) { throw new WrongUsageException(getUsage(sender)); }
                    String playerToAdd = args[1];
                    teamName = args[2];
                    if (getTeams().containsKey(teamName)) {
                        if (getPlayerTeam(playerToAdd) != null) {
                            sender.sendMessage(new TextComponentString(playerToAdd + " is already a member of a team!"));
                        } else {
                            EntityPlayerMP playerToAddEntity = server.getPlayerList().getPlayerByUsername(playerToAdd);
                            if (playerToAddEntity != null) {
                                getTeamPlayers(teamName).add(playerToAdd);
                                sender.sendMessage(new TextComponentString(playerToAdd + " added to the team " + teamName + "!"));
                            } else {
                                sender.sendMessage(new TextComponentString(playerToAdd + " is not online on the server!"));
                            }
                        }
                    } else {
                        sender.sendMessage(new TextComponentString("Team " + teamName + " does not exist!"));
                    }
                    break;
                case "del":
                    if (args.length < 3) {
                        throw new WrongUsageException(getUsage(sender));
                    }
                    String playerToRemove = args[1];
                    String teamNameToRemove = args[2];
                    if (teams.containsKey(teamNameToRemove)) {
                        if (getPlayerTeam(playerName).equals(teamNameToRemove)) {
                            getTeamPlayers(teamNameToRemove).remove(playerToRemove);
                            sender.sendMessage(new TextComponentString(playerToRemove + " removed from the team " + teamNameToRemove + "!"));
                        } else {
                            sender.sendMessage(new TextComponentString("You can only remove players from your own team!"));
                        }
                    } else {
                        sender.sendMessage(new TextComponentString("Team " + teamNameToRemove + " does not exist!"));
                    }
                    break;
                case "delteam":
                    teamName = args[1];
                    if (teams.get(teamName).contains(playerName)) {
                        if (teams.containsKey(teamName)) {
                            List<String> teamMembers = teams.get(teamName);
                            if (teamMembers.contains(playerName)) {
                                teamMembers.remove(playerName);
                                teams.remove(teamName);
                                sender.sendMessage(new TextComponentString("Team " + teamName + " deleted!"));
                            } else {
                                sender.sendMessage(new TextComponentString("You are not a member of team " + teamName + "!"));
                            }
                        } else {
                            sender.sendMessage(new TextComponentString("Team " + teamName + " does not exist!"));
                        }
                    } else {
                        sender.sendMessage(new TextComponentString("You are not a member of any team!"));
                    }
                    break;
                case "list":
                    sender.sendMessage(new TextComponentString(getTeamPlayers(getPlayerTeam(playerName)).toString()));
                    break;
                default:
                    throw new WrongUsageException(getUsage(sender));
            }
        }
    }
}
У меня в коде есть отталкивание игроков если кто-то зайдёт в сферу то его будет отталкивать

Java:
            if (entity instanceof EntityPlayer) {
                EntityPlayer player = (EntityPlayer) entity;
                if (world instanceof WorldServer && !player.getName().equals(getPplayer())) {
                    player.velocityChanged = true;
                    double motionX = entity.posX - centerX;
                    double motionY = entity.posY - centerY;
                    double motionZ = entity.posZ - centerZ;
                    double distance = Math.sqrt(motionX * motionX + motionY * motionY + motionZ * motionZ);

                    motionX /= distance;
                    motionY /= distance;
                    motionZ /= distance;

                    double knockbackStrength = 1.0;

                    entity.motionX = motionX * knockbackStrength;
                    entity.motionY = motionY * knockbackStrength;
                    entity.motionZ = motionZ * knockbackStrength;

                    if (world instanceof WorldServer) {
                        ((WorldServer) world).spawnParticle(EnumParticleTypes.END_ROD, entity.posX, entity.posY + 0.5, entity.posZ, 10, 0.35, 0.5, 0.35, 0.0001, new int[0]);
                    }
                }
            }
я передал лист с командами в тайл блока, но я не понимаю как сделать так чтобы в код выше работал на всех игроков кроме тех кто находится в команде с игроком поставивший блок(есть 2 метода 1 получает название команды по нику 2 получает всех игроков из команды по названию команды(получат их ники также как и везде)), также есть getPplayer он получает ник игрока который поставил блок


я не понимаю как сделать так чтобы отталкивало всех кроме игроков из команды игрока
если нужно могу написать доп информацию
 
Сверху