mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-02 22:07:50 +01:00
Removed "onliquid" check
This commit is contained in:
parent
fa1f7cfc06
commit
f04be42eb2
@ -60,8 +60,6 @@ permissions:
|
|||||||
children:
|
children:
|
||||||
nocheat.checks.blockplace.reach:
|
nocheat.checks.blockplace.reach:
|
||||||
description: Allow a player to place blocks at maximum range (about 6-7 blocks)
|
description: Allow a player to place blocks at maximum range (about 6-7 blocks)
|
||||||
nocheat.checks.blockplace.onliquid:
|
|
||||||
description: Allow a player to place non-liquid blocks on liquids
|
|
||||||
nocheat.checks.blockplace.direction:
|
nocheat.checks.blockplace.direction:
|
||||||
description: Allow a player to place blocks outside their line of view
|
description: Allow a player to place blocks outside their line of view
|
||||||
nocheat.checks.chat:
|
nocheat.checks.chat:
|
||||||
|
@ -14,7 +14,6 @@ import cc.co.evenprime.bukkit.nocheat.data.BaseData;
|
|||||||
public class BlockPlaceCheck {
|
public class BlockPlaceCheck {
|
||||||
|
|
||||||
private final ReachCheck reachCheck;
|
private final ReachCheck reachCheck;
|
||||||
private final OnLiquidCheck onLiquidCheck;
|
|
||||||
private final DirectionCheck directionCheck;
|
private final DirectionCheck directionCheck;
|
||||||
private final NoCheat plugin;
|
private final NoCheat plugin;
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ public class BlockPlaceCheck {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
reachCheck = new ReachCheck(plugin);
|
reachCheck = new ReachCheck(plugin);
|
||||||
onLiquidCheck = new OnLiquidCheck(plugin);
|
|
||||||
directionCheck = new DirectionCheck(plugin);
|
directionCheck = new DirectionCheck(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +30,6 @@ public class BlockPlaceCheck {
|
|||||||
boolean cancel = false;
|
boolean cancel = false;
|
||||||
|
|
||||||
// Which checks are going to be executed?
|
// Which checks are going to be executed?
|
||||||
final boolean onliquid = cc.blockplace.onliquidCheck && !player.hasPermission(Permissions.BLOCKPLACE_ONLIQUID);
|
|
||||||
final boolean reach = cc.blockplace.reachCheck && !player.hasPermission(Permissions.BLOCKPLACE_REACH);
|
final boolean reach = cc.blockplace.reachCheck && !player.hasPermission(Permissions.BLOCKPLACE_REACH);
|
||||||
final boolean direction = cc.blockplace.directionCheck && !player.hasPermission(Permissions.BLOCKPLACE_DIRECTION);
|
final boolean direction = cc.blockplace.directionCheck && !player.hasPermission(Permissions.BLOCKPLACE_DIRECTION);
|
||||||
|
|
||||||
@ -50,10 +47,6 @@ public class BlockPlaceCheck {
|
|||||||
if(!cancel && reach) {
|
if(!cancel && reach) {
|
||||||
cancel = reachCheck.check(player, data, cc);
|
cancel = reachCheck.check(player, data, cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cancel && onliquid) {
|
|
||||||
cancel = onLiquidCheck.check(player, data, cc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cancel;
|
return cancel;
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
package cc.co.evenprime.bukkit.nocheat.checks.blockplace;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.config.cache.ConfigurationCache;
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.data.BaseData;
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.data.BlockPlaceData;
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.data.LogData;
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.data.SimpleLocation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class OnLiquidCheck {
|
|
||||||
|
|
||||||
private final NoCheat plugin;
|
|
||||||
|
|
||||||
public OnLiquidCheck(NoCheat plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean check(final Player player, final BaseData data, final ConfigurationCache cc) {
|
|
||||||
|
|
||||||
boolean cancel = false;
|
|
||||||
|
|
||||||
final BlockPlaceData blockplace = data.blockplace;
|
|
||||||
final SimpleLocation blockplaced = blockplace.blockPlaced;
|
|
||||||
final LogData log = data.log;
|
|
||||||
|
|
||||||
if(isSolid(blockplace.placedType.getId())) {
|
|
||||||
// all ok
|
|
||||||
} else if(nextToSolid(player.getWorld(), blockplaced.x, blockplaced.y, blockplaced.z)) {
|
|
||||||
// all ok
|
|
||||||
} else {
|
|
||||||
blockplace.onliquidViolationLevel += 1;
|
|
||||||
log.check = "blockplace.onliquid";
|
|
||||||
|
|
||||||
cancel = plugin.execute(player, cc.blockplace.onliquidActions, (int) blockplace.onliquidViolationLevel, blockplace.history, cc);
|
|
||||||
}
|
|
||||||
|
|
||||||
blockplace.onliquidViolationLevel *= 0.95D; // Reduce level over
|
|
||||||
// time
|
|
||||||
|
|
||||||
return cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final boolean nextToSolid(final World world, final int x, final int y, final int z) {
|
|
||||||
return isSolid(world.getBlockTypeIdAt(x, y - 1, z)) || isSolid(world.getBlockTypeIdAt(x - 1, y, z)) || isSolid(world.getBlockTypeIdAt(x + 1, y, z)) || isSolid(world.getBlockTypeIdAt(x, y, z + 1)) || isSolid(world.getBlockTypeIdAt(x, y, z - 1)) || isSolid(world.getBlockTypeIdAt(x, y + 1, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final boolean isSolid(int id) {
|
|
||||||
return !((id == Material.AIR.getId()) || (id == Material.WATER.getId()) || (id == Material.STATIONARY_WATER.getId()) || (id == Material.LAVA.getId()) || (id == Material.STATIONARY_LAVA.getId()));
|
|
||||||
}
|
|
||||||
}
|
|
@ -24,7 +24,6 @@ public class Permissions {
|
|||||||
public static final String BLOCKBREAK_NOSWING = BLOCKBREAK + ".noswing";
|
public static final String BLOCKBREAK_NOSWING = BLOCKBREAK + ".noswing";
|
||||||
|
|
||||||
public final static String BLOCKPLACE = CHECKS + ".blockplace";
|
public final static String BLOCKPLACE = CHECKS + ".blockplace";
|
||||||
public final static String BLOCKPLACE_ONLIQUID = BLOCKPLACE + ".onliquid";
|
|
||||||
public final static String BLOCKPLACE_REACH = BLOCKPLACE + ".reach";
|
public final static String BLOCKPLACE_REACH = BLOCKPLACE + ".reach";
|
||||||
public static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + ".direction";
|
public static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + ".direction";
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@ import cc.co.evenprime.bukkit.nocheat.config.util.ActionList;
|
|||||||
public class CCBlockPlace {
|
public class CCBlockPlace {
|
||||||
|
|
||||||
public final boolean check;
|
public final boolean check;
|
||||||
public final boolean onliquidCheck;
|
|
||||||
public final ActionList onliquidActions;
|
|
||||||
|
|
||||||
public final boolean reachCheck;
|
public final boolean reachCheck;
|
||||||
public final double reachDistance;
|
public final double reachDistance;
|
||||||
@ -25,9 +23,6 @@ public class CCBlockPlace {
|
|||||||
|
|
||||||
check = data.getBoolean(Configuration.BLOCKPLACE_CHECK);
|
check = data.getBoolean(Configuration.BLOCKPLACE_CHECK);
|
||||||
|
|
||||||
onliquidCheck = data.getBoolean(Configuration.BLOCKPLACE_ONLIQUID_CHECK);
|
|
||||||
onliquidActions = data.getActionList(Configuration.BLOCKPLACE_ONLIQUID_ACTIONS);
|
|
||||||
|
|
||||||
reachCheck = data.getBoolean(Configuration.BLOCKPLACE_REACH_CHECK);
|
reachCheck = data.getBoolean(Configuration.BLOCKPLACE_REACH_CHECK);
|
||||||
reachDistance = data.getInteger(Configuration.BLOCKPLACE_REACH_LIMIT);
|
reachDistance = data.getInteger(Configuration.BLOCKPLACE_REACH_LIMIT);
|
||||||
reachActions = data.getActionList(Configuration.BLOCKPLACE_REACH_ACTIONS);
|
reachActions = data.getActionList(Configuration.BLOCKPLACE_REACH_ACTIONS);
|
||||||
|
@ -95,8 +95,6 @@ public class BlockPlaceEventManager extends BlockListener implements EventManage
|
|||||||
public List<String> getActiveChecks(ConfigurationCache cc) {
|
public List<String> getActiveChecks(ConfigurationCache cc) {
|
||||||
LinkedList<String> s = new LinkedList<String>();
|
LinkedList<String> s = new LinkedList<String>();
|
||||||
|
|
||||||
if(cc.blockplace.check && cc.blockplace.onliquidCheck)
|
|
||||||
s.add("blockplace.onliquid");
|
|
||||||
if(cc.blockplace.check && cc.blockplace.reachCheck)
|
if(cc.blockplace.check && cc.blockplace.reachCheck)
|
||||||
s.add("blockplace.reach");
|
s.add("blockplace.reach");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user