Add block id to fastbreak message.

This commit is contained in:
asofold 2012-09-30 02:04:43 +02:00
parent d58fb3ea0a
commit 26d47cd0f2
2 changed files with 9 additions and 4 deletions

View File

@ -4,8 +4,10 @@ import org.bukkit.GameMode;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.actions.ParameterName;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.ViolationData;
import fr.neatmonster.nocheatplus.players.Permissions;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
@ -49,11 +51,12 @@ public class FastBreak extends Check {
// First, check the game mode of the player and choose the right limit.
final long breakingTime;
final int id = block.getTypeId();
if (player.getGameMode() == GameMode.CREATIVE)
// Modifier defaults to 0, the Frequency check is responsible for those.
breakingTime = Math.round((double) cc.fastBreakModCreative / 100D * (double) 100);
else
breakingTime = Math.round((double) cc.fastBreakModSurvival / 100D * (double) BlockProperties.getBreakingDuration(block.getTypeId(), player));
breakingTime = Math.round((double) cc.fastBreakModSurvival / 100D * (double) BlockProperties.getBreakingDuration(id, player));
// fastBreakfirstDamage is the first interact on block (!).
final long elapsedTime = (data.fastBreakBreakTime > data.fastBreakfirstDamage) ? 0 : now - data.fastBreakfirstDamage;
@ -73,7 +76,9 @@ public class FastBreak extends Check {
if (data.fastBreakPenalties.getScore(cc.fastBreakBucketFactor) > cc.fastBreakBucketContention){
// TODO: maybe add one absolute penalty time for big amounts to stop breaking until then
data.fastBreakVL += missingTime;
cancel = executeActions(player, data.fastBreakVL, missingTime, cc.fastBreakActions);
final ViolationData vd = new ViolationData(this, player, data.fastBreakVL, missingTime, cc.fastBreakActions);
vd.setParameter(ParameterName.BLOCK_ID, "" + id);
cancel = executeActions(vd);
}
// else: still within contention limits.
}

View File

@ -383,7 +383,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.STRINGS + ".combspeed", start + "performs different actions at very high speed" + end);
set(ConfPaths.STRINGS + ".critical", start + "tried to do a critical hit but wasn't technically jumping" + end);
set(ConfPaths.STRINGS + ".drop", start + "tried to drop more items than allowed" + end);
set(ConfPaths.STRINGS + ".fastbreak", start + "tried to break blocks faster than possible" + end);
set(ConfPaths.STRINGS + ".fastbreak", start + "tried to break blocks ([blockid]) faster than possible" + end);
set(ConfPaths.STRINGS + ".fastclick", start + "tried to move items in his inventory too quickly" + end);
set(ConfPaths.STRINGS + ".fastplace", start + "tried to place too many blocks" + end);
set(ConfPaths.STRINGS + ".fdirection", start + "tried to hit an entity out of line of sight" + end);
@ -411,7 +411,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.STRINGS + ".nofall", start + "tried to avoid fall damage for ~[falldistance] block(s)" + end);
set(ConfPaths.STRINGS + ".nopwnage", start + "acted like spamming (IP: [ip])" + end);
set(ConfPaths.STRINGS + ".noswing", start + "didn't swing arm" + end);
set(ConfPaths.STRINGS + ".passable", start + "moved into a block([blockid])" + end);
set(ConfPaths.STRINGS + ".passable", start + "moved into a block ([blockid])" + end);
set(ConfPaths.STRINGS + ".tellglchat", tell + "&cNCP: &eChat can by annoying at times...");
set(ConfPaths.STRINGS + ".tempkick1", "ncp tempkick [player] 1 Wait a minute!");
set(ConfPaths.STRINGS + ".tempkick5", "ncp tempkick [player] 5 You have five minutes to think about it!");