Make locations and distance available for logging passable violations.

This commit is contained in:
asofold 2014-11-11 02:12:19 +01:00
parent 543753a74d
commit aa4ef31051
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,7 @@
package fr.neatmonster.nocheatplus.checks.moving;
import java.util.Locale;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -158,6 +160,10 @@ public class Passable extends Check {
data.passableVL += 1d;
final ViolationData vd = new ViolationData(this, player, data.passableVL, 1, cc.passableActions);
if (cc.debug || vd.needsParameters()) {
vd.setParameter(ParameterName.LOCATION_FROM, String.format(Locale.US, "%.2f, %.2f, %.2f", from.getX(), from.getY(), from.getZ()));
vd.setParameter(ParameterName.LOCATION_TO, String.format(Locale.US, "%.2f, %.2f, %.2f", to.getX(), to.getY(), to.getZ()));
vd.setParameter(ParameterName.DISTANCE, String.format(Locale.US, "%.2f", TrigUtil.distance(from, to)));
// TODO: Consider adding from.getTypeId() too, if blocks differ and non-air.
vd.setParameter(ParameterName.BLOCK_ID, "" + to.getTypeId());
if (!tags.isEmpty()) {
vd.setParameter(ParameterName.TAGS, tags);

View File

@ -16,7 +16,7 @@ public class DefaultConfig extends ConfigFile {
* NCP build needed for this config.
* (Should only increment with changing or removing paths.)
*/
public static final int buildNumber = 741;
public static final int buildNumber = 754;
// TODO: auto input full version or null to an extra variable or several [fail safe for other syntax checking]?
@ -496,7 +496,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.STRINGS + ".nofall", start + "tried to avoid fall damage" + end);
set(ConfPaths.STRINGS + ".chatfast", 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]) from [locationfrom] to [locationto] distance [distance] " + end);
set(ConfPaths.STRINGS + ".relog", start + "relogs too fast" + end);
set(ConfPaths.STRINGS + ".tellchatnormal", tell + "&cNCP: &eToo many messages, slow down...");
set(ConfPaths.STRINGS + ".tempkick1", "ncp tempkick [player] 1 Wait a minute!");