Skip to content

Commit

Permalink
Revert allowing placing boats on ground.
Browse files Browse the repository at this point in the history
Placing boats on ground is possible at least down to CraftBukkit
1.4.5-R1.0, thus the reason for having the boatsanywhere feature solely
is to prevent abuse. Thus allowing to place boats on ground does not
really provide a 'fix'. In order to allow placing boats anywhere, the
configuration flag has to be altered.

It may be worth a discussion, if we want checks to prevent Minecraft
features at all. A proper fix for abuse would be more complicated,
involving checking the estimated bounding box of the placed boat not to
collide with blocks neither with entities while being on ground-.
Determining the bounding box and re-checking with entity spawn might be
the more complicated part, as for the rest API/Infrastructure exists.
  • Loading branch information
asofold committed May 31, 2017
1 parent b441c1e commit 0b2882c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
Expand Up @@ -27,8 +27,6 @@
import fr.neatmonster.nocheatplus.checks.access.ACheckConfig;
import fr.neatmonster.nocheatplus.checks.access.CheckConfigFactory;
import fr.neatmonster.nocheatplus.checks.access.ICheckConfig;
import fr.neatmonster.nocheatplus.compat.activation.ActivationUtil;
import fr.neatmonster.nocheatplus.components.registry.activation.Activation;
import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigFile;
import fr.neatmonster.nocheatplus.config.ConfigManager;
Expand Down Expand Up @@ -106,7 +104,6 @@ public static BlockPlaceConfig getConfig(final Player player) {

/** General activation flag. */
public final boolean preventBoatsAnywhere;
public final boolean preventBoatsGround;

/**
* Instantiates a new block place configuration.
Expand Down Expand Up @@ -146,9 +143,13 @@ public BlockPlaceConfig(final ConfigFile config) {
speedActions = config.getOptimizedActionList(ConfPaths.BLOCKPLACE_SPEED_ACTIONS, Permissions.BLOCKPLACE_SPEED);

preventBoatsAnywhere = config.getBoolean(ConfPaths.BLOCKPLACE_PREVENTMISC_BOATSANYWHERE);
Activation activation = ActivationUtil.addMultiProtocolSupportPlugins(
new Activation().setConditionsOR().minecraftVersionGT("1.12", true));
preventBoatsGround = !activation.isAvailable();
/*
* TODO: Placing boats has been possible since 1.4.5-R1.0. Behavior
* differs, e.g. 1.12 only places boats when clicking the top of a
* block, while in 1.7.10 the boat is placed on top of a block you click
* the side of. If exceptions are to be implemented at all, they must
* contain protection against abuse.
*/
}

/* (non-Javadoc)
Expand Down
Expand Up @@ -370,16 +370,6 @@ private void checkBoatsAnywhere(final Player player, final PlayerInteractEvent e
return;
}

// Allow placing boats on ground since 1.12.
/*
* TODO: Prevent, if the placed boat would collide with any blocks or
* entities - alternatively perform post-mortem entity destruction.
*/
if (!cc.preventBoatsGround && blockFace == BlockFace.UP && BlockProperties.isGround(mat)
&& BlockProperties.isPassable(block.getRelative(BlockFace.UP).getType())) {
return;
}

// TODO: Add a check type for exemption?
if (!player.hasPermission(Permissions.BLOCKPLACE_BOATSANYWHERE)) {
final Result previousUseBlock = event.useInteractedBlock();
Expand Down

0 comments on commit 0b2882c

Please sign in to comment.