mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Sand/gravel exploit fix.
This commit is contained in:
parent
09044016cd
commit
37b5991dcc
@ -23,6 +23,8 @@ Version 2.0.00-dev
|
||||
= 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 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 Call of the Wild to activate on left-click rather than right-click
|
||||
! Changed Blast Mining to track based on Entity ID vs. Location
|
||||
|
@ -37,7 +37,7 @@ public class Item {
|
||||
if (Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && 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) {
|
||||
player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail"));
|
||||
player.teleport(player.getLocation().getWorld().getBlockAt(block.getX(), (blockY - 1), block.getZ()).getLocation());
|
||||
|
@ -60,7 +60,21 @@ public class mcBlockListener implements Listener {
|
||||
int id = block.getTypeId();
|
||||
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)) {
|
||||
BlockChecks.watchBlock(mat, block, plugin);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user