mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-01 05:18:00 +01:00
Add some safe guards for MC API access.
This commit is contained in:
parent
9ad981d22a
commit
61ab8c124a
@ -884,13 +884,21 @@ public class BlockProperties {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hiding the API access here.<br>
|
* Hiding the API access here.<br>
|
||||||
* TODO: Find description of this and use block properties from here, as well as a speaking method name.
|
* TODO: Find description of this and use block properties from here, as well as a speaking method name.<br>
|
||||||
|
* Assumption: This is something like "can stand on this type of block".
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static final boolean i(final int id) {
|
public static final boolean i(final int id) {
|
||||||
|
// TODO: Replace by independent method.
|
||||||
|
try{
|
||||||
return Block.i(id);
|
return Block.i(id);
|
||||||
}
|
}
|
||||||
|
catch(Throwable t){
|
||||||
|
// Minecraft default value.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final long getBLockFlags(final int id){
|
public static final long getBLockFlags(final int id){
|
||||||
return blockFlags[id];
|
return blockFlags[id];
|
||||||
|
@ -331,6 +331,7 @@ public class PlayerLocation {
|
|||||||
final double d0 = 0; //0.001D;
|
final double d0 = 0; //0.001D;
|
||||||
onGround = BlockProperties.isOnGround(getBlockAccess(), minX - d0, minY - yOnGround, minZ - d0, maxX + d0, minY + 0.25, maxZ + d0);
|
onGround = BlockProperties.isOnGround(getBlockAccess(), minX - d0, minY - yOnGround, minZ - d0, maxX + d0, minY + 0.25, maxZ + d0);
|
||||||
if (!onGround) {
|
if (!onGround) {
|
||||||
|
try{
|
||||||
// TODO: Probably check other ids too before doing this ?
|
// TODO: Probably check other ids too before doing this ?
|
||||||
final double d1 = 0.25D;
|
final double d1 = 0.25D;
|
||||||
final AxisAlignedBB box = useBox.b(minX - d1, minY - getyOnGround() - d1, minZ - d1, maxX + d1, minY + 0.25 + d1, maxZ + d1);
|
final AxisAlignedBB box = useBox.b(minX - d1, minY - getyOnGround() - d1, minZ - d1, maxX + d1, minY + 0.25 + d1, maxZ + d1);
|
||||||
@ -350,6 +351,10 @@ public class PlayerLocation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Throwable t){
|
||||||
|
// Ignore exceptions (Context: DisguiseCraft).
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return onGround;
|
return onGround;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user