Screw it, i'm calling it the interactables check. Only blocks that can be "switched" in anyway are blocked.

This commit is contained in:
Super Spy committed 2012-06-05 21:49:17 -05:00
1 parent 3a8c591c5b
commit dcb7795f4f
4 files changed
+52 -36

No files matched your search

@@ -261,7 +261,7 @@ public class Backend
}
}
public boolean checkVisuals(Player player, Block block)
public boolean checkInteraction(Player player, Block block)
{
// The most complicated check in the world...approaching nirvana.
int strikes = 0;
@@ -292,6 +292,7 @@ public class Backend
if(direction != null)
{
for(int g = 0; g < 2; g++)
{
py = py+g;
@@ -314,7 +315,7 @@ public class Backend
if(coords.getX() < block.getLocation().getX())
{
ignoreothers = true;
player.sendBlockChange(coords, 66, (byte) 0);
//player.sendBlockChange(coords, 66, (byte) 0);
}
if(block.getLocation().distance(coords) > 5D)
@@ -324,8 +325,8 @@ public class Backend
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);
//player.sendMessage("Block detected at -X: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -350,13 +351,13 @@ public class Backend
if(coords.getZ() < block.getLocation().getZ())
{
ignoreothers = true;
player.sendBlockChange(coords, 66, (byte) 0);
//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);
//player.sendMessage("Block detected at -Z: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -385,13 +386,13 @@ public class Backend
if(coords.getX() < block.getLocation().getX())
{
ignoreothers = true;
player.sendBlockChange(coords, 66, (byte) 0);
//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);
//player.sendMessage("Block detected at +X: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -416,13 +417,13 @@ public class Backend
if(coords.getZ() < block.getLocation().getZ())
{
ignoreothers = true;
player.sendBlockChange(coords, 66, (byte) 0);
//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);
//player.sendMessage("Block detected at -Z: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -438,8 +439,8 @@ public class Backend
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);
//player.sendMessage("Block detected at +X: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -452,8 +453,8 @@ public class Backend
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);
//player.sendMessage("Block detected at +Z: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -479,8 +480,8 @@ public class Backend
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);
//player.sendMessage("Block detected at -X: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -503,8 +504,8 @@ public class Backend
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);
//player.sendMessage("Block detected at +Z: " + a + " Block: " + coords.getBlock().getType().toString());
//player.sendBlockChange(coords, 46, (byte) 0);
strikes++;
}
}
@@ -513,8 +514,8 @@ public class Backend
}
}
player.sendMessage("Strikes: " + strikes + " Dir: " + direction);
player.sendMessage("X: " + x + " Y: " + y + " Z:" + z);
//player.sendMessage("Strikes: " + strikes + " Dir: " + direction);
//player.sendMessage("X: " + x + " Y: " + y + " Z:" + z);
return strikes > 0;
}