Sand/gravel exploit fix.

This commit is contained in:
GJ 2012-03-09 14:00:34 -05:00
parent 09044016cd
commit 37b5991dcc
3 changed files with 18 additions and 2 deletions

View File

@ -23,6 +23,8 @@ Version 2.0.00-dev
= Fixed exploit where you could use /ptp to teleport to anyone = Fixed exploit where you could use /ptp to teleport to anyone
= Fixed bug where Green Terra didn't work on Stone Brick = Fixed bug where Green Terra didn't work on Stone Brick
= Fixed bug where Tree Feller could be used without permissions = Fixed bug where Tree Feller could be used without permissions
= Fixed exploit where falling sand & gravel weren't tracked
! Changed Chimera Wing failure check to use the maxWorldHeight.
! Changed inspect failed message to say inspect rather than whois ! Changed inspect failed message to say inspect rather than whois
! Changed Call of the Wild to activate on left-click rather than right-click ! Changed Call of the Wild to activate on left-click rather than right-click
! Changed Blast Mining to track based on Entity ID vs. Location ! Changed Blast Mining to track based on Entity ID vs. Location

View File

@ -37,7 +37,7 @@ public class Item {
if (Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && amount >= itemsUsed) { if (Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && amount >= itemsUsed) {
player.setItemInHand(new ItemStack(chimaeraID, amount - itemsUsed)); player.setItemInHand(new ItemStack(chimaeraID, amount - itemsUsed));
for (int blockY = block.getY(); blockY < 127; blockY++) { for (int blockY = block.getY(); blockY < player.getWorld().getMaxHeight(); blockY++) {
if (player.getLocation().getWorld().getBlockAt(block.getX(), blockY, block.getZ()).getType() != Material.AIR) { if (player.getLocation().getWorld().getBlockAt(block.getX(), blockY, block.getZ()).getType() != Material.AIR) {
player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail")); player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail"));
player.teleport(player.getLocation().getWorld().getBlockAt(block.getX(), (blockY - 1), block.getZ()).getLocation()); player.teleport(player.getLocation().getWorld().getBlockAt(block.getX(), (blockY - 1), block.getZ()).getLocation());

View File

@ -60,7 +60,21 @@ public class mcBlockListener implements Listener {
int id = block.getTypeId(); int id = block.getTypeId();
Material mat = block.getType(); Material mat = block.getType();
//Check if the blocks placed should be monitored so they do not give out XP in the future /* Code to prevent issues with placed falling Sand/Gravel not being tracked */
if (mat.equals(Material.SAND) || mat.equals(Material.GRAVEL)) {
for (int y = -1; y + block.getY() >= 0 ; y--) {
if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
continue;
}
else {
Block newLocation = block.getRelative(0, y+1, 0);
newLocation.setData((byte) 0x5);
break;
}
}
}
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
if (BlockChecks.shouldBeWatched(mat)) { if (BlockChecks.shouldBeWatched(mat)) {
BlockChecks.watchBlock(mat, block, plugin); BlockChecks.watchBlock(mat, block, plugin);
} }