Projects >> AntiCheat >>ea54427a6320b5b6c6af6e9b5d3584c090bb9610

Chunk
Conflicting content
    {
    	int strikes = 0;
    	
<<<<<<< HEAD
    	// now let's swing the bat.
=======
    	Distance distance = new Distance(player.getLocation(), block.getLocation());
    	
    	//player coords
    	double px = distance.fromX();
    	double py = distance.fromY();
    	double pz = distance.fromZ();
    	
    	double x = Math.round(distance.getXDifference());
    	double y = Math.round(distance.getYDifference());
    	double z = Math.round(distance.getZDifference());
    	
    	String direction = Utilities.getCardinalDirection(player);
    	
    	/* TODO: Redo top/bottom/left/right block check, this one exposes an exploit */
>>>>>>> dcf055cdb271a3ce4095636009962e181e0887a9
    	
    	// First Line of Defense
    	Block imple = player.getTargetBlock(null, 5);
Solution content
    {
    	// The most complicated check in the world...approaching nirvana.
    	int strikes = 0;
    	
    	// now let's swing the bat.
    	
    	// First Line of Defense
    	Block imple = player.getTargetBlock(null, 5);
File
Backend.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
    	// Second line of defense.
    	if(!imple.getLocation().equals(block.getLocation()))
    	{
<<<<<<< HEAD
    		strikes++;
    	}
    	
    	// ShamWow! That check was extremely easy!
    	
=======
            for(int g = 0; g < 2; g++)
            {
                py = py+g;
                if(direction.equals("N") || direction.equals("NE")) 
                {
                    if(x > 0) 
                    {
                        boolean ignoreothers = false;
                        for(int a = 0; a < x + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px-a,py,pz);
                            if(coords.getBlock().getTypeId() == block.getTypeId() && coords.distance(block.getLocation()) < 3D) 
                            {
                                ignoreothers = true;
                            }
                            // Don't detect farther than we should be allowed to.
                            if(coords.getX() < block.getLocation().getX()) 
                            {
                                ignoreothers = true;
                                //player.sendBlockChange(coords, 66, (byte) 0);
                            }
                            if(block.getLocation().distance(coords) > 5D) 
                            {
                                    continue;
                            }
                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId() && !ignoreothers)
                            {
                                //player.sendMessage("Block detected at -X: " + a + " Block: " + coords.getBlock().getType().toString());
                                //player.sendBlockChange(coords, 46, (byte) 0);
                                strikes++;
                            }
                        }
                    }
                    if(z > 0)
                    {
                        boolean ignoreothers = false;
                        for(int a = 0; a < z + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px,py,pz-a);
                                //player.sendBlockChange(coords, 46, (byte) 0);
                            if(coords.getBlock().getTypeId() == block.getTypeId() && coords.distance(block.getLocation()) < 3D) 
                            {
                                ignoreothers = true;
                            }
                            if(block.getLocation().distance(coords) > 5D) 
                            {
                                continue;
                            }
                            // Don't detect farther than we should be allowed to.
                            if(coords.getZ() < block.getLocation().getZ()) 
                            {
                                ignoreothers = true;
                                //player.sendBlockChange(coords, 66, (byte) 0);
                            }
                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId() && !ignoreothers)
                            {
                                //player.sendMessage("Block detected at -Z: " + a + " Block: " + coords.getBlock().getType().toString());
                                //player.sendBlockChange(coords, 46, (byte) 0);
                                strikes++;
                            }
                        }
                    }
                }
                if(direction.equals("E") || direction.equals("SE"))
                {
                    if(x > 0) 
                    {
                        boolean ignoreothers = false;
                        for(int a = 0; a < x + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px+a,py,pz);
                            if(coords.getBlock().getTypeId() == block.getTypeId() && coords.distance(block.getLocation()) < 3D) 
                            {
                                ignoreothers = true;
                            }
                            if(block.getLocation().distance(coords) > 5D) 
                            {
                                continue;
                            }
                            // Don't detect farther than we should be allowed to.
                            if(coords.getX() < block.getLocation().getX()) 
                            {
                                ignoreothers = true;
                                //player.sendBlockChange(coords, 66, (byte) 0);
                            }
                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId() && !ignoreothers)
                            {
                                //player.sendMessage("Block detected at +X: " + a + " Block: " + coords.getBlock().getType().toString());
                                //player.sendBlockChange(coords, 46, (byte) 0);
                                strikes++;
                            }
                        }
                    }
                    if(z > 0)
                    {
                        boolean ignoreothers = false;
                        for(int a = 0; a < z + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px,py,pz-a);
                            if(coords.getBlock().getTypeId() == block.getTypeId() && coords.distance(block.getLocation()) < 4D) 
                            {
                                ignoreothers = true;
                            }

                            if(block.getLocation().distance(coords) > 5D) 
                            {
                                continue;
                            }

                            // Don't detect farther than we should be allowed to.
                            if(coords.getZ() < block.getLocation().getZ()) 
                            {
                                ignoreothers = true;
                                //player.sendBlockChange(coords, 66, (byte) 0);
                            }

                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId() && !ignoreothers)
                            {
                                //player.sendMessage("Block detected at -Z: " + a + " Block: " + coords.getBlock().getType().toString());
                                strikes++;
                            }
                        }
                    }
                }
                if(direction.equals("S") || direction.equals("SW") || direction.equals("W"))
                {
                    if(x > 0) 
                    {
                        for(int a = 0; a < x + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px+a,py,pz);
                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
                            {
                                //player.sendMessage("Block detected at +X: " + a + " Block: " + coords.getBlock().getType().toString());
                                //player.sendBlockChange(coords, 46, (byte) 0);
                                strikes++;
                            }
                        }
                    }
                    if(z > 0)
                    {
                        for(int a = 0; a < z + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px,py,pz+a);
                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
                            {
                                //player.sendMessage("Block detected at +Z: " + a + " Block: " + coords.getBlock().getType().toString());
                                //player.sendBlockChange(coords, 46, (byte) 0);
                                strikes++;
                            }
                        }
                    }
                }
                if(direction.equals("NW"))
                {
                    if(x > 0) 
                    {
                        boolean ignoreothers = false;
                        for(int a = 0; a < x + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px-a,py,pz);
                            if(coords.getBlock().getTypeId() == block.getTypeId() && coords.distance(block.getLocation()) < 3D) 
                            {
                                ignoreothers = true;
                            }

                            if(block.getLocation().distance(coords) > 5D) 
                            {
                                continue;
                            }

                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId() && !ignoreothers)
                            {
                                //player.sendMessage("Block detected at -X: " + a + " Block: " + coords.getBlock().getType().toString());
                                //player.sendBlockChange(coords, 46, (byte) 0);
                                strikes++;
                            }
                        }
                    }
                    if(z > 0)
                    {
                        boolean ignoreothers = false;
                        for(int a = 0; a < z + 1; a++)
                        {
                            Location coords = new Location(player.getWorld(), px,py,pz+a);
                            if(coords.getBlock().getTypeId() == block.getTypeId() && coords.distance(block.getLocation()) < 3D) 
                            {
                                ignoreothers = true;
                            }

                            if(block.getLocation().distance(coords) > 5D) 
                            {
                                continue;
                            }

                            if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId() && !ignoreothers)
                            {
                                //player.sendMessage("Block detected at +Z: " + a + " Block: " + coords.getBlock().getType().toString());
                                //player.sendBlockChange(coords, 46, (byte) 0);
                                strikes++;
                            }
                        }
                    }
                }
            }	
    	}
    	//player.sendMessage("Strikes: " + strikes + " Dir: " + direction);
    	//player.sendMessage("X: " + x + " Y: " + y + " Z:" + z);
>>>>>>> dcf055cdb271a3ce4095636009962e181e0887a9
    	return strikes > 0;
    }
    
Solution content
    	// Second line of defense.
    	if(!imple.getLocation().equals(block.getLocation()))
    	{
    		strikes++;
    	}
    	
    	// ShamWow! That check was extremely easy!
    	
    	return strikes > 0;
    }
    
File
Backend.java
Developer's decision
Version 1
Kind of conflict
Comment
For statement
Variable