/** * @deprecated Use instead: score(float). * @param factor * @return */ public final float getScore(final int bucket) { return bucketScore(bucket); }
/** * Update and then reduce all given ActionFrequency instances by the given * amount, capped at a maximum of 0 for the resulting first bucket score. * * @param amount * The amount to subtract. * @param freqs */ public static void reduce(final long time, final float amount, final ActionFrequency... freqs) { for (int i = 0; i < freqs.length; i++) { final ActionFrequency freq = freqs[i]; freq.update(time); freq.setBucket(0, Math.max(0f, freq.bucketScore(0) - amount)); } }
/** * Update and then reduce all given ActionFrequency instances by the given * amount, without capping the result. * * @param amount * The amount to subtract. * @param freqs */ public static void subtract(final long time, final float amount, final ActionFrequency... freqs) { for (int i = 0; i < freqs.length; i++) { final ActionFrequency freq = freqs[i]; freq.update(time); freq.setBucket(0, freq.bucketScore(0) - amount); } }
/** * Checks hasBypass on violation only. * @param player * @param time * @param data * @param cc * @return If to cancel. */ public boolean check(final Player player, final long time, final NetData data, final NetConfig cc, final IPlayerData pData) { data.keepAliveFreq.add(time, 1f); final float first = data.keepAliveFreq.bucketScore(0); if (first > 1f) { // Trigger a violation. final double vl = Math.max(first - 1f, data.keepAliveFreq.score(1f) - data.keepAliveFreq.numberOfBuckets()); if (executeActions(player, vl, 1.0, cc.keepAliveFrequencyActions).willCancel()) { return true; } } return false; }
if (tDiff >= winDur && tDiff < totalDur) { float sc0 = packetFreq.bucketScore(0); if (sc0 > maxPackets) { // TODO: Ideal vs. max. packets. final float sci = packetFreq.bucketScore(i); if (sci < maxPackets) { boolean used = false; for (burnStart = 1; burnStart < winNum; burnStart ++) { if (packetFreq.bucketScore(burnStart) > 0f) { if (packetFreq.bucketScore(j) == 0f) { empty += 1; tags.add("epsacc"); float burst = packetFreq.bucketScore(0); if (burst > burstPackets) {
float sum = data.attackFrequencySeconds.bucketScore(0); // HALF float limit = cc.attackFrequencyLimitSecondsHalf; if (sum - limit > maxVL) { sum += data.attackFrequencySeconds.bucketScore(1); limit = cc.attackFrequencyLimitSecondsOne; if (sum - limit > maxVL) {
float shortTerm = data.fastClickFreq.bucketScore(0); if (shortTerm > cc.fastClickShortTermLimit) { player.sendMessage("FastClick: " + data.fastClickFreq.bucketScore(0) + " | " + data.fastClickFreq.score(1f) + " | cursor=" + cursor + " | clicked=" + clicked + " | action=" + inventoryAction);
final float stScore = data.yawFreq.bucketScore(0) * 3f; // TODO: Better have it 2.5 with lower threshold ? final float stViol; if (stScore > threshold) {
final CombinedConfig cc = pData.getGenericInstance(CombinedConfig.class); data.improbableCount.add(now, weight); final float shortTerm = data.improbableCount.bucketScore(0); double violation = 0; boolean violated = false;