mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-27 22:17:40 +02:00
MCAccess: Get rid of Block_i method.
This commit is contained in:
parent
e69741f5dc
commit
e1babee538
@ -89,12 +89,6 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
// TODO: This is inaccurate (would be something like "can suffocate"), however it is used for piling upwards and might about do.
|
|
||||||
return BlockProperties.isGround(id) || BlockProperties.isSolid(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -78,17 +78,6 @@ public class MCAccessCB2511 implements MCAccess {
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
try{
|
|
||||||
return Block.i(id);
|
|
||||||
}
|
|
||||||
catch(Throwable t){
|
|
||||||
// Minecraft default value.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -76,17 +76,6 @@ public class MCAccessCB2512 implements MCAccess{
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
try{
|
|
||||||
return Block.i(id);
|
|
||||||
}
|
|
||||||
catch(Throwable t){
|
|
||||||
// Minecraft default value.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -76,17 +76,6 @@ public class MCAccessCB2545 implements MCAccess{
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
try{
|
|
||||||
return Block.i(id);
|
|
||||||
}
|
|
||||||
catch(Throwable t){
|
|
||||||
// Minecraft default value.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -77,17 +77,6 @@ public class MCAccessCB2602 implements MCAccess{
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
try{
|
|
||||||
return Block.i(id);
|
|
||||||
}
|
|
||||||
catch(Throwable t){
|
|
||||||
// Minecraft default value.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -21,7 +21,6 @@ import org.bukkit.entity.Player;
|
|||||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
|
||||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||||
|
|
||||||
public class MCAccessCB2645 implements MCAccess{
|
public class MCAccessCB2645 implements MCAccess{
|
||||||
@ -78,12 +77,6 @@ public class MCAccessCB2645 implements MCAccess{
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
// TODO: This is inaccurate (would be something like "can suffocate"), however it is used for piling upwards and might about do.
|
|
||||||
return BlockProperties.isGround(id) || BlockProperties.isSolid(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -21,7 +21,6 @@ import org.bukkit.entity.Player;
|
|||||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
|
||||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||||
|
|
||||||
public class MCAccessCB2691 implements MCAccess{
|
public class MCAccessCB2691 implements MCAccess{
|
||||||
@ -78,12 +77,6 @@ public class MCAccessCB2691 implements MCAccess{
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
// TODO: This is inaccurate (would be something like "can suffocate"), however it is used for piling upwards and might about do.
|
|
||||||
return BlockProperties.isGround(id) || BlockProperties.isSolid(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -21,7 +21,6 @@ import org.bukkit.entity.Player;
|
|||||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
|
||||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||||
|
|
||||||
public class MCAccessCB2763 implements MCAccess{
|
public class MCAccessCB2763 implements MCAccess{
|
||||||
@ -78,12 +77,6 @@ public class MCAccessCB2763 implements MCAccess{
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
// TODO: This is inaccurate (would be something like "can suffocate"), however it is used for piling upwards and might about do.
|
|
||||||
return BlockProperties.isGround(id) || BlockProperties.isSolid(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -21,7 +21,6 @@ import org.bukkit.entity.Player;
|
|||||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
|
||||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||||
|
|
||||||
public class MCAccessCBDev implements MCAccess{
|
public class MCAccessCBDev implements MCAccess{
|
||||||
@ -78,12 +77,6 @@ public class MCAccessCBDev implements MCAccess{
|
|||||||
else return AlmostBoolean.match(block.material.isLiquid());
|
else return AlmostBoolean.match(block.material.isLiquid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean Block_i(final int id) {
|
|
||||||
// TODO: This is inaccurate (would be something like "can suffocate"), however it is used for piling upwards and might about do.
|
|
||||||
return BlockProperties.isGround(id) || BlockProperties.isSolid(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWidth(final Entity entity) {
|
public double getWidth(final Entity entity) {
|
||||||
return ((CraftEntity) entity).getHandle().width;
|
return ((CraftEntity) entity).getHandle().width;
|
||||||
|
@ -214,7 +214,6 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
* @param event
|
* @param event
|
||||||
* the event
|
* the event
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler(
|
@EventHandler(
|
||||||
ignoreCancelled = true, priority = EventPriority.MONITOR)
|
ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
public void onBlockPlace(final BlockPlaceEvent event) {
|
public void onBlockPlace(final BlockPlaceEvent event) {
|
||||||
@ -246,7 +245,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
if (Math.abs(loc.getX() - 0.5 - block.getX()) <= 1D
|
if (Math.abs(loc.getX() - 0.5 - block.getX()) <= 1D
|
||||||
&& Math.abs(loc.getZ() - 0.5 - block.getZ()) <= 1D
|
&& Math.abs(loc.getZ() - 0.5 - block.getZ()) <= 1D
|
||||||
&& loc.getY() - blockY > 0D && loc.getY() - blockY < 2D
|
&& loc.getY() - blockY > 0D && loc.getY() - blockY < 2D
|
||||||
&& (mcAccess.Block_i(mat.getId()) || BlockProperties.isLiquid(mat.getId()))) {
|
&& (canJumpOffTop(mat.getId()) || BlockProperties.isLiquid(mat.getId()))) {
|
||||||
// The creative fly and/or survival fly check is enabled, the
|
// The creative fly and/or survival fly check is enabled, the
|
||||||
// block was placed below the player and is
|
// block was placed below the player and is
|
||||||
// solid, so do what we have to do.
|
// solid, so do what we have to do.
|
||||||
@ -255,6 +254,16 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for a workaround that resets the set-back for the case of jumping on just placed blocks.
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private final boolean canJumpOffTop(final int id){
|
||||||
|
// TODO: Test if this can be removed!
|
||||||
|
return BlockProperties.isGround(id) || BlockProperties.isSolid(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We listen to this event to prevent player from flying by sending bed leaving packets.
|
* We listen to this event to prevent player from flying by sending bed leaving packets.
|
||||||
*
|
*
|
||||||
|
@ -72,17 +72,6 @@ public interface MCAccess {
|
|||||||
*/
|
*/
|
||||||
public AlmostBoolean isBlockLiquid(int id);
|
public AlmostBoolean isBlockLiquid(int id);
|
||||||
|
|
||||||
/**
|
|
||||||
* Hiding the API access here.<br>
|
|
||||||
* // TODO: Replace by independent method.
|
|
||||||
* 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".
|
|
||||||
* @deprecated Will be replaced by direct calls to BlockProperties soon.
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean Block_i(int id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does only check y bounds, returns false if dead. this is half a check as auxiliary means for PlayerLocation.isIllegal.
|
* Does only check y bounds, returns false if dead. this is half a check as auxiliary means for PlayerLocation.isIllegal.
|
||||||
* @param player
|
* @param player
|
||||||
|
Loading…
Reference in New Issue
Block a user