Vanish No Packet

Vanish No Packet

855k Downloads

Allow non-vanished players to place blocks on vanished players

ScoreUnder opened this issue ยท 7 comments

commented

Could possibly be done with BlockCanBuildEvent - see https://github.com/Bukkit/CraftBukkit/blob/master/src/main/java/net/minecraft/server/World.java#L2306 (World.mayPlace) for calculation and the event itself.

commented

I've put some work into a potential fix for this on the Bukkit/CraftBukkit end.

commented

Could this be fixed by faking a player death in the style of older vanish plugins? The server shouldn't prevent the placement of blocks on top of a deceased player.

commented

Closing for now. BlockCanBuild still requires work

commented

I would have thought the vanilla client prevents this from occurring as well as bukkit.

commented

The vanilla client can't prevent it from happening, because it doesn't know that the player is there in the first place.

commented

I must learn to read

commented

Decided to have a poke at this, got up till this point but apparently since there isn't a method to get the placing entity in the event there's no way to check if the placing entity can see the entity in the entity list so yeah this isn't going to happen unless we can grab the placing entity in BlockCanBuildEvent

        if (!event.isBuildable()) {
            Location loc = event.getBlock().getLocation();
            int x = loc.getBlockX();
            int y = loc.getBlockY();
            int z = loc.getBlockZ();

            Block nmsBlock = Block.byId[event.getMaterialId()];
            World world = ((CraftWorld) loc.getWorld()).getHandle();       

            AxisAlignedBB axisalignedbb = nmsBlock.e(world, x, y, z);
            if (axisalignedbb != null) {
                List<?> list = world.getEntities(null, axisalignedbb);
                for (Object object : list) {
                    if (!(object instanceof Entity)) {
                        continue;
                    }
                    Entity entity = (Entity) object;
                    if (entity.dead || !entity.m) {
                        continue;
                    }
                    if (entity instanceof EntityPlayer ) {

                    }
                }
            }
        }