mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-10-06 10:27:26 +02:00
More haste.
This commit is contained in:
parent
2b8dd41461
commit
7399bfa8ee
@ -661,9 +661,9 @@ public class BlockProperties {
|
||||
final World world = location.getWorld();
|
||||
final boolean onGround = isOnGround(player, location, 0.3) || world.getBlockTypeIdAt(x, y, z) == Material.WATER_LILY.getId();
|
||||
final boolean inWater = isInWater(world.getBlockTypeIdAt(x, y + 1, z));
|
||||
final int haste = (int) Math.round(PotionUtil.getPotionEffectAmplifier(player, PotionEffectType.FAST_DIGGING));
|
||||
final double haste = PotionUtil.getPotionEffectAmplifier(player, PotionEffectType.FAST_DIGGING);
|
||||
// TODO: haste: int / double !?
|
||||
return getBreakingDuration(blockId, itemInHand, onGround, inWater, helmet != null && helmet.containsEnchantment(Enchantment.WATER_WORKER), haste);
|
||||
return getBreakingDuration(blockId, itemInHand, onGround, inWater, helmet != null && helmet.containsEnchantment(Enchantment.WATER_WORKER), haste == Double.NEGATIVE_INFINITY ? 0 : 1 + (int) haste);
|
||||
}
|
||||
|
||||
|
||||
@ -692,13 +692,13 @@ public class BlockProperties {
|
||||
* @param inWater
|
||||
* @param aquaAffinity
|
||||
* @param efficiency
|
||||
* @param haste Amplifier of haste potion effect (assume >0 for effect there at all).
|
||||
* @param haste Amplifier of haste potion effect (assume > 0 for effect there at all, so 1 is haste I, 2 is haste II).
|
||||
* @return
|
||||
*/
|
||||
public static long getBreakingDuration(final int blockId, final BlockProps blockProps, final ToolProps toolProps, final boolean onGround, final boolean inWater, boolean aquaAffinity, int efficiency, int haste) {
|
||||
final long dur = getBreakingDuration(blockId, blockProps, toolProps, onGround, inWater, aquaAffinity, efficiency);
|
||||
// TODO: haste ...
|
||||
return haste > 0 ? ((long) (dur * 0.66)) : dur;
|
||||
return haste > 0 ? (long) (Math.pow(0.8, haste) * dur): dur;
|
||||
}
|
||||
|
||||
public static long getBreakingDuration(final int blockId, final BlockProps blockProps, final ToolProps toolProps, final boolean onGround, final boolean inWater, boolean aquaAffinity, int efficiency) {
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
@ -11,6 +12,7 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.ViolationData;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
||||
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
|
||||
/*
|
||||
@ -120,7 +122,8 @@ public class FastBreak extends Check {
|
||||
final int blockId = block.getTypeId();
|
||||
final ItemStack stack = player.getItemInHand();
|
||||
final boolean isValidTool = BlockProperties.isValidTool(blockId, stack);
|
||||
String msg = (isInstaBreak ? "[Insta]" : "[Normal]") + "[" + blockId + "] "+ elapsedTime + "u / " + breakingTime +"r (" + (isValidTool?"tool":"no-tool") + ")";
|
||||
final double haste = PotionUtil.getPotionEffectAmplifier(player, PotionEffectType.FAST_DIGGING);
|
||||
String msg = (isInstaBreak ? "[Insta]" : "[Normal]") + "[" + blockId + "] "+ elapsedTime + "u / " + breakingTime +"r (" + (isValidTool?"tool":"no-tool") + ")" + (haste == Double.NEGATIVE_INFINITY ? "" : " haste=" + ((int) haste + 1));
|
||||
player.sendMessage(msg);
|
||||
// net.minecraft.server.Item mcItem = net.minecraft.server.Item.byId[stack.getTypeId()];
|
||||
// if (mcItem != null){
|
||||
|
Loading…
Reference in New Issue
Block a user